From 30831ce718cafb467fa42693c3fa7b5349d856ec Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Wed, 22 Apr 2015 20:40:21 +0300 Subject: [PATCH] Add styling to passwords and confirmations --- app/helpers/application_helper.rb | 2 ++ app/views/devise/confirmations/new.html.haml | 14 ++++++++ app/views/devise/passwords/edit.html.haml | 16 +++++++++ app/views/devise/passwords/new.html.haml | 14 ++++++++ app/views/devise/registrations/new.html.haml | 12 +++---- app/views/devise/sessions/new.html.haml | 37 ++++++++++---------- app/views/devise/shared/_help.html.haml | 2 +- 7 files changed, 72 insertions(+), 25 deletions(-) create mode 100644 app/views/devise/confirmations/new.html.haml create mode 100644 app/views/devise/passwords/edit.html.haml create mode 100644 app/views/devise/passwords/new.html.haml diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3c22da91..7e9f7652 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,10 @@ module ApplicationHelper + # Set resource_name for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposal#new) def resource_name :user end + # Set devise_mapping for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposal#new) def devise_mapping @devise_mapping ||= Devise.mappings[:user] end diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml new file mode 100644 index 00000000..8df4efc1 --- /dev/null +++ b/app/views/devise/confirmations/new.html.haml @@ -0,0 +1,14 @@ +.container + .row + .col-md-6.col-md-offset-3 + .panel.panel-default + .panel-heading + %h3.panel-title + Resend confirmation instructions + .panel-body + = semantic_form_for(resource, as: resource_name, url: confirmation_path(resource_name), method: :post) do |f| + = f.input :email, input_html: { autofocus: true, required: true } + %p.text-right + = f.action :submit, as: :button, label: 'Submit', button_html: { class: 'btn btn-success' } + + = render partial: 'devise/shared/help' diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml new file mode 100644 index 00000000..1f3f785d --- /dev/null +++ b/app/views/devise/passwords/edit.html.haml @@ -0,0 +1,16 @@ +.container + .row + .col-md-6.col-md-offset-3 + .panel.panel-default + .panel-heading + %h3.panel-title + Change your password + .panel-body + = semantic_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + = f.hidden_field :reset_password_token + = f.input :password, input_html: { autofocus: true, required: true, autocomplete: "off"}, label: 'New password' + = f.input :password_confirmation, input_html: { required: true, autocomplete: "off" }, label: 'New password confirmation' + %p.text-right + = f.action :submit, as: :button, label: 'Change my password', button_html: { class: 'btn btn-success' } + + = render partial: 'devise/shared/help' diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml new file mode 100644 index 00000000..24a061a8 --- /dev/null +++ b/app/views/devise/passwords/new.html.haml @@ -0,0 +1,14 @@ +.container + .row + .col-md-6.col-md-offset-3 + .panel.panel-default + .panel-heading + %h3.panel-title + Forgot your password? + .panel-body + = semantic_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + = f.input :email, input_html: { autofocus: true, required: true} + %p.text-right + = f.action :submit, as: :button, label: 'Send me reset password instructions', button_html: { class: 'btn btn-success' } + + = render partial: 'devise/shared/help' diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index a36e06cf..36eeb6e3 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -7,13 +7,13 @@ Sign Up .panel-body = semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| - = f.input :username, required: true - = f.input :email - = f.input :name, required: true - = f.input :password - = f.input :password_confirmation + = f.input :username, input_html: { required: true } + = f.input :email, input_html: { required: true } + = f.input :name, input_html: { required: true } + = f.input :password, input_html: { required: true } + = f.input :password_confirmation, input_html: { required: true } %p.text-right - = f.action :submit, as: :button, label: 'Sign Up', button_html: {class: 'btn btn-success' } + = f.action :submit, as: :button, label: 'Sign Up', button_html: { class: 'btn btn-success' } = render partial: 'devise/shared/openid' = render partial: 'devise/shared/help' diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 1ef5c169..2c1bb613 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,18 +1,19 @@ -.row - .col-md-6.col-md-offset-3 - .panel.panel-default - .panel-heading - %h3.panel-title - Sign In - .panel-body - = semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| - = f.input :login - = f.input :password - - if devise_mapping.rememberable? - %p.text-right.small - = f.label 'Remember me' - = f.check_box :remember_me - %p.text-right - = f.action :submit, as: :button, label: 'Sign In', button_html: {class: 'btn btn-success'} - = render partial: 'devise/shared/openid' - = render partial: 'devise/shared/help' +.container + .row + .col-md-6.col-md-offset-3 + .panel.panel-default + .panel-heading + %h3.panel-title + Sign In + .panel-body + = semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| + = f.input :login + = f.input :password + - if devise_mapping.rememberable? + %p.text-right.small + = f.label 'Remember me' + = f.check_box :remember_me + %p.text-right + = f.action :submit, as: :button, label: 'Sign In', button_html: {class: 'btn btn-success'} + = render partial: 'devise/shared/openid' + = render partial: 'devise/shared/help' diff --git a/app/views/devise/shared/_help.html.haml b/app/views/devise/shared/_help.html.haml index 50962d6d..22a7ce21 100644 --- a/app/views/devise/shared/_help.html.haml +++ b/app/views/devise/shared/_help.html.haml @@ -1,5 +1,5 @@ %p.text-right - %a.small.btn.btn-default{"data-toggle" => "collapse", "data-target" => "#devise-help"} + %a.small.btn.btn-default.btn-xs{"data-toggle" => "collapse", "data-target" => "#devise-help"} Need Help? #devise-help.collapse = render 'devise/shared/links'