diff options
author | jessib <jessib@leap.se> | 2013-06-17 11:33:56 -0700 |
---|---|---|
committer | jessib <jessib@leap.se> | 2013-06-17 11:33:56 -0700 |
commit | 11c4155aff42fe3f8bbce858bc87cdb6a91f67a2 (patch) | |
tree | aaa92e55c88bff3a1bbb47f5741701467f8451cd | |
parent | beacb663226085a77ce03a6dda70e8b135d2e8c7 (diff) |
Tweaks to display javascript and cookies warning:
* will only display cookies warning if javascript is enabled.
* remove redundant code
* tweak noscript html to display better div
-rw-r--r-- | users/app/views/sessions/new.html.haml | 12 | ||||
-rw-r--r-- | users/app/views/users/_warnings.html.haml | 12 | ||||
-rw-r--r-- | users/app/views/users/new.html.haml | 12 |
3 files changed, 14 insertions, 22 deletions
diff --git a/users/app/views/sessions/new.html.haml b/users/app/views/sessions/new.html.haml index 20705b9..6743407 100644 --- a/users/app/views/sessions/new.html.haml +++ b/users/app/views/sessions/new.html.haml @@ -1,15 +1,5 @@ .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'; - } + = render :partial => 'users/warnings' %h2=t :login = simple_form_for @session, :validate => true, :html => { :id => :new_session, :class => 'form-horizontal' } do |f| %legend=t :login_message diff --git a/users/app/views/users/_warnings.html.haml b/users/app/views/users/_warnings.html.haml new file mode 100644 index 0000000..7e0b2ce --- /dev/null +++ b/users/app/views/users/_warnings.html.haml @@ -0,0 +1,12 @@ +%noscript + %div.alert.alert-error=t :js_required +#cookie_warning.alert.alert-error{:style => "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'; + }
\ 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 709289e..80482b2 100644 --- a/users/app/views/users/new.html.haml +++ b/users/app/views/users/new.html.haml @@ -1,15 +1,5 @@ .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'; - } + = render :partial => 'warnings' %h2=t :signup = user_form do |f| %legend= t(:signup_message) |