Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #27 from dlindahl/features/remove_jquery_dependency
Browse files Browse the repository at this point in the history
Removes jQuery dependency
  • Loading branch information
pencil committed Oct 29, 2013
2 parents 7c7783b + d6cbe59 commit 2f5ffa8
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 26 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/casino/application.js
@@ -0,0 +1 @@
// Place all the behaviors and hooks related to the matching controller here.
5 changes: 0 additions & 5 deletions app/assets/javascripts/casino/application.js.coffee

This file was deleted.

2 changes: 0 additions & 2 deletions app/assets/javascripts/casino/index.js
Expand Up @@ -10,6 +10,4 @@
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
23 changes: 23 additions & 0 deletions app/assets/javascripts/casino/sessions.js
@@ -0,0 +1,23 @@
(function(win, doc) {
var url = '/login',
cookie_regex = /(^|;)\s*tgt=/;

function checkCookieExists() {
var serviceEl = doc.getElementById('service'),
svcValue = serviceEl ? serviceEl.getAttribute('value') : null;

if(svcValue) {
if(cookie_regex.test(doc.cookie)) {
win.location = url + '?service=' + encodeURIComponent(svcValue);
}
} else {
setTimeout(checkCookieExists, 1000);
}
}

// Auto-login when logged-in in other browser window (9887c4e)
if(doc.getElementById('login-form')) {
checkCookieExists();
}

})(this, document);
15 changes: 0 additions & 15 deletions app/assets/javascripts/casino/sessions.js.coffee

This file was deleted.

6 changes: 5 additions & 1 deletion app/views/casino/sessions/new.html.erb
Expand Up @@ -16,7 +16,7 @@
<%= hidden_field_tag :lt, @login_ticket.ticket %>
<%= hidden_field_tag :service, params[:service] unless params[:service].nil? %>
<%= label_tag :username, t('login.label_username') %>
<%= text_field_tag :username, params[:username] %>
<%= text_field_tag :username, params[:username], autofocus:true %>
<%= label_tag :password, t('login.label_password') %>
<%= password_field_tag :password %>
<%= label_tag :rememberMe do %>
Expand All @@ -28,3 +28,7 @@
</div>
<%= render 'footer' %>
</div>

<%= javascript_tag do %>
<%= Rails.application.assets.find_asset('casino/sessions').to_s.html_safe %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/casino/sessions/validate_otp.html.erb
Expand Up @@ -8,7 +8,7 @@
<%= hidden_field_tag :tgt, @ticket_granting_ticket || params[:tgt] %>
<%= hidden_field_tag :service, params[:service] %>
<%= label_tag :code, t('validate_otp.code') %>
<%= text_field_tag :otp, nil, maxlength: 6 %>
<%= text_field_tag :otp, nil, maxlength: 6, autofocus:true %>
<%= button_tag t('validate_otp.submit'), :class => 'button' %>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/casino/two_factor_authenticators/new.html.erb
Expand Up @@ -22,7 +22,7 @@
<%= form_tag(two_factor_authenticators_path, method: :post, id: 'two_factor_authenticators-form') do %>
<%= hidden_field_tag :id, @two_factor_authenticator.id %>
<%= label_tag :code, t('two_factor_authenticators.code') %>
<%= text_field_tag :otp, nil, maxlength: 6 %>
<%= text_field_tag :otp, nil, maxlength: 6, autofocus:true %>
<%= link_to t('two_factor_authenticators.cancel'), sessions_path, :class => 'secondary button' %>
<%= button_tag t('two_factor_authenticators.submit'), :class => 'button' %>
<% end %>
Expand Down
1 change: 0 additions & 1 deletion casino.gemspec
Expand Up @@ -33,7 +33,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'coveralls', '~> 0.7'

s.add_runtime_dependency 'rails', '~> 3.2.9'
s.add_runtime_dependency 'jquery-rails', '~> 2.1'
s.add_runtime_dependency 'http_accept_language', '~> 2.0.0.pre'
s.add_runtime_dependency 'addressable', '~> 2.3'
s.add_runtime_dependency 'terminal-table', '~> 1.4'
Expand Down

0 comments on commit 2f5ffa8

Please sign in to comment.