Skip to content

Instantly share code, notes, and snippets.

@uris77
Last active August 29, 2015 13:55
Show Gist options
  • Save uris77/8718111 to your computer and use it in GitHub Desktop.
Save uris77/8718111 to your computer and use it in GitHub Desktop.
Suggestion Refactor
@Cuda.module "Login", (Login, App, Backbone, Marionette, $, _) ->
# Login Form
class Login.Form extends Marionette.Layout
initialize: (options) ->
@model = new Backbone.Model({error: ""})
@model.bind('change', @render)
handleSubmit: ->
$form = $(e.currentTarget)
if $form.data("ajax")
@trigger 'submit:form', dataFromForm
e.preventDefault()
class LoginForm.Controller extends Marionette.Controller
initialize: (options) ->
@_createLoginForm()
# True when we are checking for an existing cas session
@isCookieCheck = false
# True when user is logged in. Only controlls view. Does not grant any special acess.
@isLoggedIn = false
_createLoginForm: ->
@loginForm = new Login.Form
@listenTo @loginForm, 'submt:form', (dataFromForm) =>
loginController.authenticate(dataForm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment