Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

continued

  • Loading branch information...
commit 6961efabeda9da9ed329c98bc8d2d32d48e55f3b 1 parent 56e890d
Axel Nitzschner bartcc authored

Showing 1 changed file with 20 additions and 7 deletions. Show diff stats Hide diff stats

  1. +20 7 app/webroot/js/backbone/app/todos/views/login.js
27 app/webroot/js/backbone/app/todos/views/login.js
@@ -9,18 +9,19 @@ jQuery(function() {
9 9 loginText: 'Enter Username and Password',
10 10
11 11 initialize: function() {
12   - _.bindAll(this, 'login', 'close', 'newAttributes', 'validateLogin', 'updateAuth', 'renderFlash');
  12 + _.bindAll(this, 'login', 'close', 'cancel', 'newAttributes', 'validateLogin', 'updateAuth', 'renderFlash');
13 13
14 14 this.bind('error:auth', this.show);
15 15 this.bind('flash', this.renderFlash);
16 16 Todos.bind('update:auth', this.updateAuth);
17 17
18   - this.username = this.$('.username');
19   - this.password = this.$('.password');
20   - this.closeButton = this.$('._close');
21   - this.localButton = this.$('._local');
22   - this.loginButton = this.$('._login');
23   - this.flash = this.$('._flash span');
  18 + this.username = this.$('.username');
  19 + this.password = this.$('.password');
  20 + this.closeButton = this.$('._close');
  21 + this.cancelButton = this.$('._cancel');
  22 + this.localButton = this.$('._local');
  23 + this.loginButton = this.$('._login');
  24 + this.flash = this.$('._flash span');
24 25
25 26 this.model = Todos.Models.User;
26 27 this.isValid = false;
@@ -31,6 +32,7 @@ jQuery(function() {
31 32
32 33 events: {
33 34
  35 + 'click footer ._cancel' : 'cancel',
34 36 'click footer ._login' : 'login',
35 37 'keypress #login input' : 'login',
36 38 'keyup #login input' : 'validateLogin',
@@ -116,6 +118,17 @@ jQuery(function() {
116 118 setTimeout(function(t) {
117 119 $(that.el).hide();
118 120 }, t)
  121 + },
  122 +
  123 + cancel: function(e) {
  124 + this.redirect();
  125 + },
  126 +
  127 + redirect: function(url, external) {
  128 + if (url == null) {
  129 + url = '';
  130 + }
  131 + return location.href = (external ? 'http://' : base_url) + url;
119 132 }
120 133
121 134 })

0 comments on commit 6961efa

Please sign in to comment.
Something went wrong with that request. Please try again.