Retire semantic_form_for
Also a buttload of form cleanups...
This commit is contained in:
parent
350b1ebbbe
commit
81853d1ef9
136 changed files with 1825 additions and 1441 deletions
49
app/views/devise/registrations/_form_fields.html.haml
Normal file
49
app/views/devise/registrations/_form_fields.html.haml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
.form-group
|
||||
= f.label :username
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.text_field :username, required: true, autocomplete: 'off', class: 'form-control', placeholder: 'Username'
|
||||
.form-group
|
||||
= f.label :email
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.email_field :email, required: true, autocomplete: 'off', class: 'form-control', placeholder: 'Email'
|
||||
- if local_assigns[:full]
|
||||
.checkbox
|
||||
%label
|
||||
= f.check_box :email_public
|
||||
Check if you want your email address to appear publicly (e.g. on sessions, registration lists, etc.)
|
||||
.form-group
|
||||
= f.label :name, 'Real Name'
|
||||
= f.text_field :name, required: true, class: 'form-control', placeholder: 'Name'
|
||||
.form-group
|
||||
= f.label :password, 'Password'
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.password_field :password, required: true, class: 'form-control', placeholder: 'Password'
|
||||
.form-group
|
||||
= f.label :password_confirmation, 'Password Confirmation'
|
||||
= f.password_field :password_confirmation, required: true, class: 'form-control', placeholder: 'Password Confirmation'
|
||||
- if @user.persisted?
|
||||
%p.text-muted
|
||||
Leave blank if you don't want to change your password
|
||||
= render partial: 'form_fields_openid', locals: { f: f }
|
||||
- if current_user.try(:is_admin?)
|
||||
.checkbox
|
||||
%label
|
||||
= f.check_box :is_admin
|
||||
is Admin?
|
||||
%span.help-block
|
||||
An admin can create a new conference, manage users and make other users admins.
|
||||
- elsif @user.persisted?
|
||||
%h4
|
||||
Confirmation
|
||||
%hr
|
||||
.form-group
|
||||
= f.label :password, "Current Password"
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.password_field :current_password, autocomplete: 'off', class: 'form-control', placeholder: 'Password'
|
||||
%p.text-muted
|
||||
We need your current password to confirm password, email or username changes
|
||||
- Feature.with(:recaptcha) do
|
||||
.form-group
|
||||
= recaptcha_tags
|
||||
%p.text-right
|
||||
= f.submit nil, class: 'btn btn-success'
|
||||
23
app/views/devise/registrations/_form_fields_openid.html.haml
Normal file
23
app/views/devise/registrations/_form_fields_openid.html.haml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
- if omniauth_configured.present? && @user == current_user
|
||||
%h4
|
||||
OpenID
|
||||
%hr
|
||||
- openids = Openid.where(user: @user).order(:provider)
|
||||
- if openids.any?
|
||||
%p
|
||||
Currently the following openIDs are associated with your account
|
||||
- openids.each do |openid|
|
||||
%li{ style: "list-style: none; margin-left: 20px;" }
|
||||
= link_to user_openid_path(openid, user_id: current_user.id), method: :delete,
|
||||
data: { confirm: "Remove association with #{openid.provider} account?" } do
|
||||
%span.fa.fa-times{ style: "color: red;" }
|
||||
%span #{openid.provider}:#{openid.email}
|
||||
%br
|
||||
- else
|
||||
%p
|
||||
Currently there are no openIDs are associated with your account.
|
||||
%p
|
||||
To add an openID with a different email address to your account, sign in with your
|
||||
openID while logged in to OSEM
|
||||
#openidlinks
|
||||
= render 'devise/shared/openid_links'
|
||||
5
app/views/devise/registrations/_new_embedded.html.haml
Normal file
5
app/views/devise/registrations/_new_embedded.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
- unless current_user
|
||||
= fields_for @user do |u|
|
||||
= render partial: 'devise/registrations/form_fields', locals: { f: u }
|
||||
= render partial: 'devise/shared/openid'
|
||||
= render partial: 'devise/shared/help'
|
||||
|
|
@ -5,30 +5,5 @@
|
|||
%h1 Edit your Account
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
|
||||
= f.input :username, required: false, input_html: { autocomplete: 'off' }
|
||||
= f.input :email, required: false, input_html: { autocomplete: 'off' }
|
||||
= f.input :email_public,
|
||||
hint: "Do you want your email address to appear publicly? (e.g. on sessions, registration lists, etc.)"
|
||||
= f.input :password, hint: "(Leave blank if you don't want to change it)", input_html: { autocomplete: 'off' }
|
||||
= f.input :password_confirmation, input_html: { autocomplete: 'off' }
|
||||
= f.inputs name: 'OpenID' do
|
||||
%h4
|
||||
Currently the following openIDs are associated with your account
|
||||
- @openids.each do |openid|
|
||||
%li{ style: "list-style: none; margin-left: 20px;" }
|
||||
= link_to user_openid_path(openid, user_id: current_user.id), method: :delete,
|
||||
data: { confirm: "Remove association with #{openid.provider} account?" } do
|
||||
%span.fa.fa-times{ style: "color: red;" }
|
||||
%span #{openid.provider}:#{openid.email}
|
||||
%br
|
||||
%h4
|
||||
To add an openID with a different email address to your account, sign in with your
|
||||
openID while logged in to OSEM
|
||||
- if User.omniauth_providers.present?
|
||||
#openidlinks
|
||||
= render 'devise/shared/openid_links'
|
||||
= f.inputs name: 'Confirmation' do
|
||||
= f.input :current_password, input_html: {autocomplete: 'off'},
|
||||
hint: '(we need your current password to confirm password, email or username changes)'
|
||||
= f.action :submit, as: :button, label: 'Update Account', button_html: {class: 'btn btn-primary'}
|
||||
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
|
||||
= render partial: 'form_fields', locals: { f: f, full: true, edit: true }
|
||||
|
|
|
|||
|
|
@ -6,16 +6,8 @@
|
|||
%h3.panel-title
|
||||
Sign Up
|
||||
.panel-body
|
||||
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
||||
= f.input :username, input_html: { required: true }, hint: 'This is how the other users see you, not your real name'
|
||||
= f.input :email, input_html: { required: true }
|
||||
= f.input :name, input_html: { required: true }, hint: 'This is your real name'
|
||||
= f.input :password, input_html: { required: true }
|
||||
= f.input :password_confirmation, input_html: { required: true }
|
||||
- Feature.with(:recaptcha) do
|
||||
= recaptcha_tags
|
||||
%p.text-right
|
||||
= f.action :submit, as: :button, label: 'Sign Up', button_html: { class: 'btn btn-success' }
|
||||
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
||||
= render partial: 'form_fields', locals: { f: f }
|
||||
|
||||
= render partial: 'devise/shared/openid'
|
||||
= render partial: 'devise/shared/help'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue