Retire semantic_form_for

Also a buttload of form cleanups...
This commit is contained in:
Henne Vogelsang 2022-02-23 17:52:16 +01:00
parent 350b1ebbbe
commit 81853d1ef9
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
136 changed files with 1825 additions and 1441 deletions

View file

@ -6,9 +6,13 @@
%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 }
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), method: :post) do |f|
.form-group
= f.label :email, "Email"
%abbr{title: 'This field is required'} *
= f.email_field :email, autofocus: true, required: true, class: 'form-control', placeholder: 'Email'
%p.text-right
= f.action :submit, as: :button, label: 'Submit', button_html: { class: 'btn btn-success' }
%button{type: 'submit', class: 'btn btn-success'}
Send me reset password instructions
= render partial: 'devise/shared/help'

View file

@ -6,15 +6,21 @@
%h3.panel-title
Sign in
.panel-body
= semantic_form_for '', method: :post, enctype: 'application/x-www-form-urlencoded', url: @login_url do |f|
= f.input :url, as: :hidden, input_html: { value: @back_url }
= f.input :context, as: :hidden, input_html: { value: @context }
= f.input :proxypath, as: :hidden, input_html: { value: @proxypath }
= f.input :username, input_html: { autofocus: true }
= f.input :password, as: :password
= form_for(@login_url, method: :post, enctype: 'application/x-www-form-urlencoded', id: 'session' do |f|
= f.hidden_field :url, value: @back_url
= f.hidden_field :context, value: @context
= f.hidden_field :proxypath, value: @proxypath
.form-group
= f.label :username, "Username"
%abbr{title: 'This field is required'} *
= f.text_field :username, autofocus: true, required: true, class: 'form-control', placeholder: 'Username'
.form-group
= f.label :password, "Password"
%abbr{title: 'This field is required'} *
= f.password_field :password, required: true, class: 'form-control', placeholder: 'Password'
%p.text-right
= f.action :submit, as: :button, label: 'Sign In', button_html: { class: 'btn btn-success' }
%button{type: 'submit', class: 'btn btn-success'}
Sign In
= render partial: 'devise/shared/help'

View file

@ -3,17 +3,21 @@
.col-md-6.col-md-offset-3
.panel.panel-default
.panel-heading
%h3.panel-title
Sign in (TEST MODE)
%h3 Sign In (TEST MODE)
%p.text-muted
Just fill out all the details and you're logged in.
.panel-body
= semantic_form_for "", method: :post, enctype: 'application/x-www-form-urlencoded', url: @login_url do |f|
= f.input :username, input_html: { autofocus: true }
- if ::Devise.ichain_force_test_attributes.blank?
= form_tag(@login_url, method: :post, enctype: 'application/x-www-form-urlencoded', id: 'session') do
.form-group
= label_tag :username, "Username"
= text_field_tag :username, "", :autofocus => true, :placeholder => 'Username', :class => 'form-control', :required => "required"
.form-group
- @fields.each do |field|
= f.input "attributes[#{field}]", label: field.to_s.humanize
= label_tag "attributes[#{field}]", field.to_s.humanize
= text_field_tag "attributes[#{field}]", nil, :class => 'form-control', :required => "required"
%p.text-right
= f.action :submit, as: :button, label: 'Sign In', button_html: { class: 'btn btn-success' }
%button{type: 'submit', class: 'btn btn-success'}
Sign In
= render partial: 'devise/shared/help'
- if devise_mapping.ichain_registerable?
= link_to "Sign up", new_ichain_registration_path(resource_name)

View file

@ -1,16 +0,0 @@
.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'

View file

@ -6,9 +6,13 @@
%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}
= form_for(resource, as: resource_name, url: password_path(resource_name), method: :post) do |f|
.form-group
= f.label :email, "Email"
%abbr{title: 'This field is required'} *
= f.email_field :email, autofocus: true, required: true, class: 'form-control', placeholder: 'Email'
%p.text-right
= f.action :submit, as: :button, label: 'Send me reset password instructions', button_html: { class: 'btn btn-success' }
%button{type: 'submit', class: 'btn btn-success'}
Send me reset password instructions
= render partial: 'devise/shared/help'

View 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'

View 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'

View 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'

View file

@ -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 }

View file

@ -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'

View file

@ -0,0 +1,15 @@
.form-group
= f.label :login, "Username"
%abbr{title: 'This field is required'} *
= f.text_field :login, autofocus: true, required: true, class: 'form-control', placeholder: 'Username'
.form-group
= f.label :password, "Password"
%abbr{title: 'This field is required'} *
= f.password_field :password, required: true, class: 'form-control', placeholder: 'Password'
- if devise_mapping.rememberable?
%p.text-right.small
= f.label 'Remember me'
= f.check_box :remember_me
%p.text-right
%button{type: 'submit', class: 'btn btn-success'}
Sign In

View file

@ -21,5 +21,5 @@
%p.text-right
%a.small.btn.btn-default{"data-toggle" => "collapse", "data-target" => "#devise-help-sign-in"}
Need Help?
#devise-help-sign-in.collapse
.collapse#devise-help-sign-in
= render partial: 'devise/shared/links'

View file

@ -6,14 +6,7 @@
%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'}
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
= render partial: 'form_fields', locals: { f: f }
= render partial: 'devise/shared/openid'
= render partial: 'devise/shared/help'

View file

@ -1,8 +0,0 @@
- unless current_user
= semantic_fields_for @user do |u|
= u.input :username, input_html: { required: 'required', autocomplete: 'off' }
= u.input :email, input_html: { required: 'required', autocomplete: 'off' }
= u.input :password, input_html: { required: 'required', autocomplete: 'off', id: 'password_inline' }
= u.input :password_confirmation, input_html: { required: 'required', autocomplete: 'off' }
= render partial: 'devise/shared/openid'
= render partial: 'devise/shared/help'