From 3952a7dfcd13993bd51ac7dc07cb3a01b4658e25 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 30 Apr 2014 16:35:39 +0200 Subject: hide srp forms when no js is available Hiding them using two mechanisms in case one fails: .hidden class - bootstrap hides them then style='display:none' - so they are hidden even if css load fails --- app/views/sessions/new.html.haml | 4 ++-- app/views/users/_warnings.html.haml | 2 +- app/views/users/new.html.haml | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'app/views') diff --git a/app/views/sessions/new.html.haml b/app/views/sessions/new.html.haml index 6f3b324..bb7e4bd 100644 --- a/app/views/sessions/new.html.haml +++ b/app/views/sessions/new.html.haml @@ -1,9 +1,9 @@ .span1 .span9 - = render :partial => 'users/warnings' %h2=t :login .lead=t :login_info - = simple_form_for [:api, @session], :validate => true, :html => { :id => :new_session, :class => 'form-horizontal' } do |f| + = render :partial => 'users/warnings' + = simple_form_for [:api, @session], validate: true, html: { id: :new_session, class: 'form-horizontal hidden js-show', style: "display:none;" } do |f| = f.input :login, :required => false, :label => t(:username), :input_html => { :id => :srp_username } = f.input :password, :required => false, :input_html => { :id => :srp_password } = f.button :wrapped, value: t(:login), cancel: home_path diff --git a/app/views/users/_warnings.html.haml b/app/views/users/_warnings.html.haml index 79ab103..baf80a4 100644 --- a/app/views/users/_warnings.html.haml +++ b/app/views/users/_warnings.html.haml @@ -9,4 +9,4 @@ document.getElementById('cookie_warning').style.display = 'block'; } else { document.getElementById('cookie_warning').style.display = 'none'; - } \ No newline at end of file + } diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml index 3478989..bf7ae31 100644 --- a/app/views/users/new.html.haml +++ b/app/views/users/new.html.haml @@ -1,14 +1,16 @@ -# --# This form is handled entirely by javascript, so take care when changing element ids. +-# This form is handled entirely by javascript +-# Please take care when changing element ids. +-# The form hidden when no js is available to prevent submission in the clear. -# -- form_options = {:url => '/not-used', :html => {:id => 'new_user', :class => user_form_class('form-horizontal')}, :validate => true} +- form_options = {url: '/not-used', html: {id: 'new_user', class: user_form_class('form-horizontal'), style: 'display:none'}, validate: true} .span1 .span9 - = render :partial => 'warnings' %h2=t :signup .lead=t :signup_info + = render :partial => 'warnings' = simple_form_for(@user, form_options) do |f| = f.input :login, :label => t(:username), :required => false, :input_html => { :id => :srp_username } = f.input :password, :required => false, :validate => true, :input_html => { :id => :srp_password } -- cgit v1.2.3 From 616313b406e561b45a73e34f54fd5fc7595f9658 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 6 May 2014 09:34:38 +0200 Subject: minor: fixing comment --- app/views/users/new.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml index bf7ae31..bc36068 100644 --- a/app/views/users/new.html.haml +++ b/app/views/users/new.html.haml @@ -1,7 +1,9 @@ -# -# This form is handled entirely by javascript -# Please take care when changing element ids. --# The form hidden when no js is available to prevent submission in the clear. +-# +-# The form is hidden when no js is available +-# to prevent submission in the clear. -# - form_options = {url: '/not-used', html: {id: 'new_user', class: user_form_class('form-horizontal'), style: 'display:none'}, validate: true} -- cgit v1.2.3