Browse Source

Some js wasn't getting loaded at login. and other fixes

eperez-timeinput
Jason Denney 11 years ago
parent
commit
51caa93afa
  1. 2
      Gemfile.lock
  2. 4
      app/assets/javascripts/custom_netzke_helpers.js
  3. 45
      app/assets/javascripts/devise/sessions.js
  4. 43
      app/assets/javascripts/login.js
  5. 1
      app/views/devise/sessions/new.html.erb
  6. 2
      config/locales/devise.en.yml

2
Gemfile.lock

@ -161,6 +161,7 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.4)
rb-fsevent (0.9.3)
rdoc (3.12.2)
json (~> 1.4)
rspec (2.8.0)
@ -245,6 +246,7 @@ DEPENDENCIES
netzke-core (~> 0.8.0)
pry (~> 0.9.8)
rails (= 3.2.13)
rb-fsevent
rspec-rails (~> 2.8.1)
sass-rails (~> 3.2.3)
shoulda-matchers (~> 1.0.0)

4
app/assets/javascripts/custom_netzke_helpers.js

@ -38,11 +38,9 @@ Ext.define('Ext.ux.form.field.ColorCombo', {
submitValue:false,
readOnly: me.readOnly,
onTriggerClick: function() {
//needs to be called twice because?
me.picker.alignTo(me.colorField.inputEl);
//show renders, so put first
me.picker.show();
me.picker.alignTo(me.colorField.inputEl);
me.picker.show();
}
});
me.items.push(me.colorField);

45
app/assets/javascripts/devise/sessions.js

@ -0,0 +1,45 @@
$(document).ready(function(){
$("#checkin_menu").show();
$("#checkin").click( function(e){
var username = $("#user_email").val();
var password = $("#user_password").val();
$.ajax({
type: 'POST',
url: '/api/v1/checkin',
dataType: 'json',
contentType: 'application/json',
processData: false,
data: JSON.stringify({"username": username, "password": password }),
complete: function() { },
success: function(data) {
alert("Checked IN!");
$("#user_email").val('');
$("#user_password").val('');
},
error: function(data,textStatus) {
alert( "Error: " + JSON.parse(data.responseText)["error"]);
}
})
});
$("#checkout").click( function(e){
var username = $("#user_email").val();
var password = $("#user_password").val();
$.ajax({
type: 'POST',
url: '/api/v1/checkout',
dataType: 'json',
contentType: 'application/json',
processData: false,
data: JSON.stringify({"username": username, "password": password }),
complete: function() { },
success: function(data) {
alert("Checked OUT!");
$("#user_email").val('');
$("#user_password").val('');
},
error: function(data,textStatus) {
alert( "Error: " + JSON.parse(data.responseText)["error"]);
}
})
});
});

43
app/assets/javascripts/login.js

@ -1,43 +0,0 @@
$("#checkin_menu").show();
$("#checkin").click( function(e){
var username = $("#user_email").val();
var password = $("#user_password").val();
$.ajax({
type: 'POST',
url: '/api/v1/checkin',
dataType: 'json',
contentType: 'application/json',
processData: false,
data: JSON.stringify({"username": username, "password": password }),
complete: function() { },
success: function(data) {
alert("Checked IN!");
$("#user_email").val('');
$("#user_password").val('');
},
error: function(data,textStatus) {
alert( "Error: " + JSON.parse(data.responseText)["error"]);
}
})
});
$("#checkout").click( function(e){
var username = $("#user_email").val();
var password = $("#user_password").val();
$.ajax({
type: 'POST',
url: '/api/v1/checkout',
dataType: 'json',
contentType: 'application/json',
processData: false,
data: JSON.stringify({"username": username, "password": password }),
complete: function() { },
success: function(data) {
alert("Checked OUT!");
$("#user_email").val('');
$("#user_password").val('');
},
error: function(data,textStatus) {
alert( "Error: " + JSON.parse(data.responseText)["error"]);
}
})
});

1
app/views/devise/sessions/new.html.erb

@ -34,4 +34,3 @@
<% end %>
<% end %>
<% end %>

2
config/locales/devise.en.yml

@ -14,7 +14,7 @@ en:
devise:
failure:
already_authenticated: 'You are already signed in.'
unauthenticated: 'You need to sign in or sign up before continuing.'
unauthenticated: 'You need to provide your username and password or sign in/sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
invalid: 'Invalid email or password.'

Loading…
Cancel
Save