diff options
author | jessib <jessib@leap.se> | 2013-06-13 14:29:15 -0700 |
---|---|---|
committer | jessib <jessib@leap.se> | 2013-06-13 14:29:15 -0700 |
commit | beacb663226085a77ce03a6dda70e8b135d2e8c7 (patch) | |
tree | 283bf23b48cda085eb16fab28aa4eb973babf56a /users/app | |
parent | 15d48c24e529e2f944b026749c5eb35eb4c5cfa7 (diff) |
Quick way to give warnings if javascript and/or cookies are not enabled. Will want to tweak so the code isn't redundant, and ideally so check for cookies doesn't rely on javascript.
And we'll want to expand the texts.
Diffstat (limited to 'users/app')
-rw-r--r-- | users/app/views/sessions/new.html.haml | 15 | ||||
-rw-r--r-- | users/app/views/users/new.html.haml | 11 |
2 files changed, 24 insertions, 2 deletions
diff --git a/users/app/views/sessions/new.html.haml b/users/app/views/sessions/new.html.haml index a04f584..20705b9 100644 --- a/users/app/views/sessions/new.html.haml +++ b/users/app/views/sessions/new.html.haml @@ -1,8 +1,19 @@ .span8.offset2 + %noscript.alert.alert-error=t :js_required + #cookie_warning.alert.alert-error{:display => 'none'} + =t :cookie_disabled_warning + :javascript + document.cookie = "testing=cookies_enabled; path=/"; + if(document.cookie.indexOf("testing=cookies_enabled") < 0) + { + document.getElementById('cookie_warning').style.display = 'block'; + } else { + document.getElementById('cookie_warning').style.display = 'none'; + } %h2=t :login = simple_form_for @session, :validate => true, :html => { :id => :new_session, :class => 'form-horizontal' } do |f| %legend=t :login_message = f.input :login, :input_html => { :id => :srp_username } = f.input :password, :required => true, :input_html => { :id => :srp_password } - = f.button :submit, :value => t(:login), :class => 'btn-primary' - = link_to t(:cancel), root_url, :class => :btn + = f.button :submit, :value => t(:login), :class => 'btn-primary' + = link_to t(:cancel), root_url, :class => :btn
\ No newline at end of file diff --git a/users/app/views/users/new.html.haml b/users/app/views/users/new.html.haml index 98cccb0..709289e 100644 --- a/users/app/views/users/new.html.haml +++ b/users/app/views/users/new.html.haml @@ -1,4 +1,15 @@ .span8.offset2 + %noscript.alert.alert-error=t :js_required + #cookie_warning.alert.alert-error{:display => 'none'} + =t :cookie_disabled_warning + :javascript + document.cookie = "testing=cookies_enabled; path=/"; + if(document.cookie.indexOf("testing=cookies_enabled") < 0) + { + document.getElementById('cookie_warning').style.display = 'block'; + } else { + document.getElementById('cookie_warning').style.display = 'none'; + } %h2=t :signup = user_form do |f| %legend= t(:signup_message) |