From 93202fc13c560fc84d49cfd2b9cf4358bbde097e Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 10 Feb 2017 21:09:16 +1300 Subject: [PATCH] haml clean up for devise views --- app/views/devise/confirmations/new.html.haml | 12 ++++--- .../confirmation_instructions.html.haml | 6 ++-- .../reset_password_instructions.html.haml | 4 +-- .../mailer/unlock_instructions.html.haml | 4 +-- app/views/devise/passwords/edit.html.haml | 14 ++++---- app/views/devise/passwords/new.html.haml | 11 +++--- .../devise/registrations/_edit_apps.html.haml | 34 ++++++++++++------- .../registrations/_edit_email.html.haml | 15 ++++---- .../registrations/_edit_password.html.haml | 20 ++++++----- .../registrations/_edit_profile.html.haml | 19 ++++++----- app/views/devise/registrations/edit.html.haml | 18 +++++----- app/views/devise/registrations/new.html.haml | 26 +++++++------- app/views/devise/sessions/new.html.haml | 14 ++++---- app/views/devise/unlocks/new.html.haml | 12 ++++--- 14 files changed, 119 insertions(+), 90 deletions(-) diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 03a021478..e817346c8 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -1,17 +1,21 @@ - content_for :title, "Resend confirmation instructions" -= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, :class => 'form-horizontal', :role => 'form' }) do |f| += form_for(resource, as: resource_name, + url: confirmation_path(resource_name), + html: { method: :post, + class: 'form-horizontal', + role: 'form' }) do |f| = devise_error_messages! %p Enter either your login name or your email address to resend the confirmation email. .form-group - = f.label :login, :class => 'control-label col-md-2' + = f.label :login, class: 'control-label col-md-2' .col-md-8 - = f.text_field :login, :class => 'form-control' + = f.text_field :login, class: 'form-control' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Resend confirmation instructions", :class => 'btn btn-primary' + = f.submit "Resend confirmation instructions", class: 'btn btn-primary' .form-group .col-md-offset-2.col-md-8 diff --git a/app/views/devise/mailer/confirmation_instructions.html.haml b/app/views/devise/mailer/confirmation_instructions.html.haml index f8a275dba..333258a5d 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.haml +++ b/app/views/devise/mailer/confirmation_instructions.html.haml @@ -5,7 +5,7 @@ Your account on #{site_name} has been created. You just need to confirm your email address through the link below: -%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) +%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %p Once you're confirmed, you can sign in with your login name @@ -17,9 +17,9 @@ We're excited to have you as a member, and hope you'll enjoy what #{site_name} has to offer. Take a look around the site, = succeed "," do - = link_to('plant some things', url_for(:controller => '/crops', :only_path => false)) + = link_to('plant some things', url_for(controller: '/crops', only_path: false)) and feel free to drop in on the - = link_to 'forums', url_for(:controller => '/forums', :only_path => false) + = link_to 'forums', url_for(controller: '/forums', only_path: false) if you have any questions or feedback. %p diff --git a/app/views/devise/mailer/reset_password_instructions.html.haml b/app/views/devise/mailer/reset_password_instructions.html.haml index 4a80b1065..2af1c27f3 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.haml +++ b/app/views/devise/mailer/reset_password_instructions.html.haml @@ -5,7 +5,7 @@ Someone has requested a link to reset your password on #{site_name}. We presume this was you, in which case you can do so through this link: -%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) +%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %p If it wasn't you, then someone's made a typo or has been messing @@ -17,5 +17,5 @@ %p The #{site_name} team. %br/ - =link_to root_url, root_url + = link_to root_url, root_url diff --git a/app/views/devise/mailer/unlock_instructions.html.haml b/app/views/devise/mailer/unlock_instructions.html.haml index 971a00d59..9bdc87543 100644 --- a/app/views/devise/mailer/unlock_instructions.html.haml +++ b/app/views/devise/mailer/unlock_instructions.html.haml @@ -8,7 +8,7 @@ forgotten your password. In either case, use the link below to unlock your account: -%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) +%p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %p If you have actually forgotten your password, you can @@ -20,4 +20,4 @@ %p The #{site_name} team. %br/ - =link_to root_url, root_url + = link_to root_url, root_url diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 8e31924e5..e71357b32 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,21 +1,23 @@ - content_for :title, "Change your password" -= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, :class => 'form-horizontal', :role => 'form' }) do |f| += form_for(resource, as: resource_name, + url: password_path(resource_name), + html: { method: :put, class: 'form-horizontal', role: 'form' }) do |f| = devise_error_messages! = f.hidden_field :reset_password_token .form-group - = f.label :password, "New password", :class => 'control-label col-md-2' + = f.label :password, "New password", class: 'control-label col-md-2' .col-md-8 - = f.password_field :password, :class => 'form-control' + = f.password_field :password, class: 'form-control' .form-group - = f.label :password_confirmation, "Confirm new password", :class => 'control-label col-md-2' + = f.label :password_confirmation, "Confirm new password", class: 'control-label col-md-2' .col-md-8 - = f.password_field :password_confirmation, :class => 'form-control' + = f.password_field :password_confirmation, class: 'form-control' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Change my password", :class => 'btn btn-primary' + = f.submit "Change my password", class: 'btn btn-primary' = render "devise/shared/links" diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 2044264c8..c137a797b 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,15 +1,18 @@ - content_for :title, "Forgot your password?" -= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :class => 'form-horizontal', :role => 'form' }) do |f| += form_for(resource, as: resource_name, + url: password_path(resource_name), + html: { method: :post, + class: 'form-horizontal', role: 'form' }) do |f| = devise_error_messages! .form-group - = f.label :login, :class => 'control-label col-md-2' + = f.label :login, class: 'control-label col-md-2' .col-md-8 - = f.text_field :login, :class => 'form-control' + = f.text_field :login, class: 'form-control' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Send me reset password instructions", :class => 'btn btn-primary' + = f.submit "Send me reset password instructions", class: 'btn btn-primary' .form-group .col-md-offset-2.col-md-8 diff --git a/app/views/devise/registrations/_edit_apps.html.haml b/app/views/devise/registrations/_edit_apps.html.haml index e4d49c9ef..caea27165 100644 --- a/app/views/devise/registrations/_edit_apps.html.haml +++ b/app/views/devise/registrations/_edit_apps.html.haml @@ -1,39 +1,47 @@ -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| += form_for(resource, as: resource_name, + url: registration_path(resource_name), + html: { method: :put, class: 'form-horizontal' }) do |_f| %br/ = devise_error_messages! .row .col-md-12 %p - = image_tag "twitter_32.png", :size => "32x32", :alt => 'Twitter logo' + = image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo' - if @twitter_auth You are connected to Twitter as = succeed "." do - =link_to @twitter_auth.name, "http://twitter.com/#{@twitter_auth.name}" - = link_to "Disconnect", @twitter_auth, :confirm => "Are you sure you want to remove this connection?", :method => :delete, :class => "remove" + = link_to @twitter_auth.name, "http://twitter.com/#{@twitter_auth.name}" + = link_to "Disconnect", @twitter_auth, + confirm: "Are you sure you want to remove this connection?", + method: :delete, class: "remove" - else - =link_to 'Connect to Twitter', '/auth/twitter' + = link_to 'Connect to Twitter', '/auth/twitter' .row .col-md-12 %p - = image_tag "flickr_32.png", :size => "32x32", :alt => 'Flickr logo' + = image_tag "flickr_32.png", size: "32x32", alt: 'Flickr logo' - if @flickr_auth You are connected to Flickr as = succeed "." do - =link_to @flickr_auth.name, "http://flickr.com/photos/#{@flickr_auth.uid}" - = link_to "Disconnect", @flickr_auth, :confirm => "Are you sure you want to remove this connection?", :method => :delete, :class => "remove" + = link_to @flickr_auth.name, "http://flickr.com/photos/#{@flickr_auth.uid}" + = link_to "Disconnect", @flickr_auth, + confirm: "Are you sure you want to remove this connection?", + method: :delete, class: "remove" - else - =link_to 'Connect to Flickr', '/auth/flickr' + = link_to 'Connect to Flickr', '/auth/flickr' .row .col-md-12 %p - = image_tag "facebook_32.png", :size => "32x32", :alt => 'Facebook logo' + = image_tag "facebook_32.png", size: "32x32", alt: 'Facebook logo' - if @facebook_auth You are connected to Facebook as = succeed "." do - =link_to @facebook_auth.name, "http://facebook.com/profile/#{@facebook_auth.uid}" - = link_to "Disconnect", @facebook_auth, :confirm => "Are you sure you want to remove this connection?", :method => :delete, :class => "remove" + = link_to @facebook_auth.name, "http://facebook.com/profile/#{@facebook_auth.uid}" + = link_to "Disconnect", @facebook_auth, + confirm: "Are you sure you want to remove this connection?", + method: :delete, class: "remove" - else - =link_to 'Connect to Facebook', '/auth/facebook' \ No newline at end of file + = link_to 'Connect to Facebook', '/auth/facebook' diff --git a/app/views/devise/registrations/_edit_email.html.haml b/app/views/devise/registrations/_edit_email.html.haml index a44fbc3c8..c351897b6 100644 --- a/app/views/devise/registrations/_edit_email.html.haml +++ b/app/views/devise/registrations/_edit_email.html.haml @@ -1,11 +1,13 @@ -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| += form_for(resource, as: resource_name, + url: registration_path(resource_name), + html: { method: :put, class: 'form-horizontal' }) do |f| %br/ = devise_error_messages! .form-group - = f.label :email, :class => 'control-label col-md-2' + = f.label :email, class: 'control-label col-md-2' .col-md-8 - = f.email_field :email, :class => 'form-control' + = f.email_field :email, class: 'form-control' %span.help-block If you change your email address you will have to reconfirm. .form-group @@ -32,10 +34,9 @@ = f.check_box :newsletter Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter .help-block - = render :partial => 'newsletter_blurb' + = render partial: 'newsletter_blurb' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Save", :class => 'btn btn-primary' - - =f.hidden_field(:tos_agreement, :value => true) + = f.submit "Save", class: 'btn btn-primary' + = f.hidden_field(:tos_agreement, value: true) diff --git a/app/views/devise/registrations/_edit_password.html.haml b/app/views/devise/registrations/_edit_password.html.haml index 3e660ab98..c36f287b4 100644 --- a/app/views/devise/registrations/_edit_password.html.haml +++ b/app/views/devise/registrations/_edit_password.html.haml @@ -1,23 +1,25 @@ -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| += form_for(resource, as: resource_name, + url: registration_path(resource_name), + html: { method: :put, class: 'form-horizontal' }) do |f| %br/ = devise_error_messages! .form-group - = f.label :current_password, :class => 'control-label col-md-2' + = f.label :current_password, class: 'control-label col-md-2' .col-md-4 - = f.password_field :current_password, :class => 'form-control' + = f.password_field :current_password, class: 'form-control' .form-group - = f.label :password, "New password", :class => 'control-label col-md-2' + = f.label :password, "New password", class: 'control-label col-md-2' .col-md-4 - = f.password_field :password, :autocomplete => "off", :class => 'form-control' + = f.password_field :password, autocomplete: "off", class: 'form-control' .form-group - = f.label :password_confirmation, :class => 'control-label col-md-2' - .col-md-4= f.password_field :password_confirmation, :class => 'form-control' + = f.label :password_confirmation, class: 'control-label col-md-2' + .col-md-4= f.password_field :password_confirmation, class: 'form-control' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Save", :class => 'btn btn-primary' + = f.submit "Save", class: 'btn btn-primary' - =f.hidden_field(:tos_agreement, :value => true) + = f.hidden_field(:tos_agreement, value: true) diff --git a/app/views/devise/registrations/_edit_profile.html.haml b/app/views/devise/registrations/_edit_profile.html.haml index 003cdbe1e..f12d68e20 100644 --- a/app/views/devise/registrations/_edit_profile.html.haml +++ b/app/views/devise/registrations/_edit_profile.html.haml @@ -1,23 +1,25 @@ -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| += form_for(resource, as: resource_name, + url: registration_path(resource_name), + html: { method: :put, class: 'form-horizontal' }) do |f| %br/ = devise_error_messages! .form-group - =f.label :location, 'Your location', :class => 'control-label col-md-2' + = f.label :location, 'Your location', class: 'control-label col-md-2' .col-md-8 - =f.text_field :location, :autocomplete => "off", :class => 'form-control' + = f.text_field :location, autocomplete: "off", class: 'form-control' %span.help-block This will be displayed on a map. You can be as detailed or vague as you like. .form-group - =f.label :bio, :class => 'control-label col-md-2' + = f.label :bio, class: 'control-label col-md-2' .col-md-8 - =f.text_area :bio, :rows => 6, :class => 'form-control' + = f.text_area :bio, rows: 6, class: 'form-control' .form-group %label.control-label.col-md-2 Profile picture .col-md-8 - = render :partial => "members/avatar", :locals => { :member => @member } + = render partial: "members/avatar", locals: { member: @member } - unless @member.preferred_avatar_uri.present? %p %br/ @@ -27,6 +29,5 @@ .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Save", :class => 'btn btn-primary' - - =f.hidden_field(:tos_agreement, :value => true) + = f.submit "Save", class: 'btn btn-primary' + = f.hidden_field(:tos_agreement, value: true) diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 85ba205d9..c1e59214d 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,25 +1,25 @@ - content_for :title, "Settings for #{current_member.login_name}" -%ul.nav.nav-tabs{:role => 'tablist'} +%ul.nav.nav-tabs{ role: 'tablist' } %li.active - %a{:href => '#profile', :role => 'tab', 'data-toggle' => 'tab'} + %a{ href: '#profile', role: 'tab', 'data-toggle': 'tab' } Profile %li - %a{:href => '#email', :role => 'tab', 'data-toggle' => 'tab'} + %a{ href: '#email', role: 'tab', 'data-toggle': 'tab' } Email %li - %a{:href => '#apps', :role => 'tab', 'data-toggle' => 'tab'} + %a{ href: '#apps', role: 'tab', 'data-toggle': 'tab' } Apps %li - %a{:href => '#password', :role => 'tab', 'data-toggle' => 'tab'} + %a{ href: '#password', role: 'tab', 'data-toggle': 'tab' } Password .tab-content .tab-pane.active#profile - = render :partial => 'edit_profile' + = render partial: 'edit_profile' .tab-pane#email - = render :partial => 'edit_email' + = render partial: 'edit_email' .tab-pane#apps - = render :partial => 'edit_apps' + = render partial: 'edit_apps' .tab-pane#password - = render :partial => 'edit_password' + = render partial: 'edit_password' diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 3ec01a0ef..8632b782e 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -2,28 +2,30 @@ %p Sign up for a Growstuff account to track your veggie garden and connect with other local growers. -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "form-horizontal"}) do |f| += form_for(resource, as: resource_name, + url: registration_path(resource_name), + html: { class: "form-horizontal" }) do |f| = devise_error_messages! .form-group - = f.label :login_name, :class => "control-label col-md-2" + = f.label :login_name, class: "control-label col-md-2" .col-md-8 - = f.text_field :login_name, :class => 'form-control' + = f.text_field :login_name, class: 'form-control' %span.help-inline This is the name that will show on the website. .form-group - = f.label :email, :class => "control-label col-md-2" + = f.label :email, class: "control-label col-md-2" .col-md-8 - = f.email_field :email, :class => 'form-control' + = f.email_field :email, class: 'form-control' %span.help-inline We'll use this address to contact you (we never spam!) .form-group - = f.label :password, :class => "control-label col-md-2" - .col-md-8= f.password_field :password, :class => 'form-control' + = f.label :password, class: "control-label col-md-2" + .col-md-8= f.password_field :password, class: 'form-control' .form-group - = f.label :password_confirmation, :class => "control-label col-md-2" - .col-md-8= f.password_field :password_confirmation, :class => 'form-control' + = f.label :password_confirmation, class: "control-label col-md-2" + .col-md-8= f.password_field :password_confirmation, class: 'form-control' .form-group .col-md-offset-2.col-md-8.checkbox @@ -35,14 +37,14 @@ .form-group .col-md-offset-2.col-md-8.checkbox %label - = f.check_box :newsletter, :checked => true + = f.check_box :newsletter, checked: true Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter .help-inline - = render :partial => 'newsletter_blurb' + = render partial: 'newsletter_blurb' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Sign up", :class => 'btn btn-primary' + = f.submit "Sign up", class: 'btn btn-primary' .form-group .col-md-offset-2.col-md-8 diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 4fdef08be..3645463e4 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,17 +1,19 @@ - content_for :title, "Sign in" -= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "form-horizontal"}) do |f| += form_for(resource, as: resource_name, + url: session_path(resource_name), + html: { class: "form-horizontal" }) do |f| = devise_error_messages! .form-group - = f.label :login, :class => "control-label col-md-2" + = f.label :login, class: "control-label col-md-2" .col-md-8 - = f.text_field :login, :class => 'form-control' + = f.text_field :login, class: 'form-control' .form-group - = f.label :password, :class => "control-label col-md-2" + = f.label :password, class: "control-label col-md-2" .col-md-8 - = f.password_field :password, :class => 'form-control' + = f.password_field :password, class: 'form-control' - if devise_mapping.rememberable? .form-group @@ -22,7 +24,7 @@ .form-group .form-actions.col-md-8.col-md-offset-2 - = f.submit "Sign in", :class => 'btn btn-primary' + = f.submit "Sign in", class: 'btn btn-primary' .form-group .col-md-8.col-md-offset-2 diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index 1e612e9bf..6dbcd8af3 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -1,15 +1,19 @@ - content_for :title, "Resend unlock instructions" -= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post, :class => 'form-horizontal', :role => 'form' }) do |f| += form_for(resource, as: resource_name, + url: unlock_path(resource_name), + html: { method: :post, + class: 'form-horizontal', + role: 'form' }) do |f| = devise_error_messages! .form-group - = f.label :email, :class => 'control-label col-md-2' + = f.label :email, class: 'control-label col-md-2' .col-md-8 - = f.email_field :email, :class => 'form-control' + = f.email_field :email, class: 'form-control' .form-group .form-actions.col-md-offset-2.col-md-8 - = f.submit "Resend unlock instructions", :class => 'btn btn-primary' + = f.submit "Resend unlock instructions", class: 'btn btn-primary' .form-group .col-md-offset-2.col-md-8