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
95
app/views/admin/conferences/_form_fields.html.haml
Normal file
95
app/views/admin/conferences/_form_fields.html.haml
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
%h4
|
||||
Basic Information
|
||||
%hr
|
||||
- if f.object.new_record?
|
||||
.form-group
|
||||
= f.label :organization, "Organization"
|
||||
= f.select :organization_id, Organization.accessible_by(current_ability, :update).pluck(:name, :id)
|
||||
.form-group
|
||||
= f.label :title, "Title"
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.text_field :title, required: true, class: 'form-control', placeholder: 'Title'
|
||||
%span.help-block
|
||||
The name of your conference as it shall appear throughout the site. Example: 'openSUSE Conference 2013'
|
||||
.form-group
|
||||
= f.label :title, "Short Title"
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.text_field :short_title, required: true, pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.', prepend: conferences_url + '/', class: 'form-control', placeholder: 'Short Title'
|
||||
%span.help-block
|
||||
A short and unique handle for your conference, using only letters, numbers, underscores, and dashes. This will be used to identify your conference in URLs etc. Example:
|
||||
%em
|
||||
froscon2011
|
||||
- unless f.object.new_record? # We are showing more fields on the edit form
|
||||
.form-group
|
||||
= f.text_area :description, rows: 5, data: { provide: 'markdown' }, class: 'form-control'
|
||||
%span.help-block
|
||||
= markdown_hint('A description of the conference.')
|
||||
.form-group
|
||||
= f.color_field :color, size: 6, class: 'form-control'
|
||||
%span.help-block
|
||||
The color will be used for the dashboard, for instance.
|
||||
.form-group
|
||||
= f.label :picture, 'Conference Logo'
|
||||
- if f.object.picture?
|
||||
= image_tag f.object.picture.thumb.url
|
||||
= f.file_field :picture
|
||||
%span.help-block
|
||||
This will be displayed on the front page.
|
||||
= f.hidden_field :picture_cache
|
||||
= f.select :ticket_layout, Conference.ticket_layouts.keys, {}, class: 'form-control'
|
||||
%span.help-block
|
||||
Layout type for tickets of the conference.
|
||||
|
||||
%h4
|
||||
Scheduling
|
||||
%hr
|
||||
= f.time_zone_select :timezone, nil, { default: 'UTC' }, { class: 'form-control' }
|
||||
%span.help-block
|
||||
Please select in what time zone your conference will take place.
|
||||
.form-group
|
||||
= f.label :start_date, "Start Date"
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.text_field :start_date, id: 'conference-start-datepicker', required: true, class: 'form-control'
|
||||
.form-group
|
||||
= f.label :end_date, "End Date"
|
||||
%abbr{title: 'This field is required'} *
|
||||
= f.text_field :end_date, id: 'conference-end-datepicker', required: true, class: 'form-control'
|
||||
- unless f.object.new_record? # We are showing more fields on the edit form
|
||||
.form-group
|
||||
= f.number_field :start_hour, size: 2, min: 0, max: 23, class: 'form-control'
|
||||
%span.help-block
|
||||
= rescheduling_hint(@affected_event_count)
|
||||
.form-group
|
||||
= f.number_field :end_hour, size: 2, min: 1, max: 24, class: 'form-control'
|
||||
%span.help-block
|
||||
= rescheduling_hint(@affected_event_count)
|
||||
%h4
|
||||
Registrations
|
||||
%hr
|
||||
.form-group
|
||||
= f.number_field :registration_limit, in: 0..9999, class: 'form-control'
|
||||
%span.help-block
|
||||
Limit the number of registrations to the conference (0 no limit). Please note that the registration limit
|
||||
does not apply to speakers of confirmed events, they will still be able to register even if the limit has been reached.
|
||||
You currently have
|
||||
= pluralize(@conference.registrations.count, 'registration')
|
||||
%h4
|
||||
Booths
|
||||
%hr
|
||||
.form-group
|
||||
= f.number_field :booth_limit, in: 0..9999, class: 'form-control'
|
||||
%span.help-block
|
||||
= (t'booth').capitalize
|
||||
limit is the maximum number of
|
||||
= (t'booth').pluralize
|
||||
that you can accept for this conference. By setting this number (0 no limit) you can be sure that you are not
|
||||
going to accept more
|
||||
= (t'booth').pluralize
|
||||
than the conference can accommodate. You currently have
|
||||
= pluralize(@conference.booths.accepted.count, "accepted #{t'booth'}") + '.'
|
||||
%p.text-right
|
||||
- if f.object.new_record?
|
||||
= f.submit nil, { class: 'btn btn-success' }
|
||||
- else
|
||||
= f.submit nil, { class: 'btn btn-success', data: { confirm: 'Are you sure you want to proceed?' } }
|
||||
|
||||
|
|
@ -6,27 +6,5 @@
|
|||
The most basic settings of your conference
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@conference, url: admin_conference_path(@conference.short_title), html: {multipart: true}) do |f|
|
||||
= f.input :title, hint: "The full title of the conference, e.g. 'openSUSE Conference 2014'"
|
||||
= f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs"
|
||||
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown' } }
|
||||
= f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'}
|
||||
= f.label 'Conference Logo'
|
||||
%br
|
||||
- if @conference.picture?
|
||||
= image_tag @conference.picture.thumb.url
|
||||
= f.input :picture, label: false, hint: 'This will be displayed on the front page.'
|
||||
= f.hidden_field :picture_cache
|
||||
= f.input :ticket_layout, as: :select, collection: Conference.ticket_layouts.keys, hint: "Layout type for tickets of the conference."
|
||||
= f.inputs name: 'Scheduling' do
|
||||
= f.input :timezone, as: :time_zone, hint: 'The conference time zone'
|
||||
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', readonly: 'readonly' }
|
||||
= f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', readonly: 'readonly' }
|
||||
= f.input :start_hour, input_html: {size: 2, type: 'number', min: 0, max: 23}, hint: rescheduling_hint(@affected_event_count)
|
||||
= f.input :end_hour, input_html: {size: 2, type: 'number', min: 1, max: 24}, hint: rescheduling_hint(@affected_event_count)
|
||||
= f.inputs name: 'Registrations' do
|
||||
= f.input :registration_limit, as: :number, in: 0..9999, hint: 'Limit the number of registrations to the conference (0 no limit). Please note that the registration limit doesn\'t apply to speakers of confirmed events (they will still be able to register even if it has been reached). You currently have ' + pluralize(@conference.registrations.count, 'registration')
|
||||
= f.inputs name: 'Booths' do
|
||||
= f.input :booth_limit, as: :number, in: 0..9999,
|
||||
hint: "#{(t'booth').capitalize } limit is the maximum number of #{(t'booth').pluralize} that you can accept for this conference. By setting this number (0 no limit) you can be sure that you are not going to accept more #{(t'booth').pluralize} than the conference can accommodate. You currently have " + pluralize(@conference.booths.accepted.count, "accepted #{t'booth'}") +'.'
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary', data: { confirm: 'Are you sure you want to proceed?' } }
|
||||
= form_for(@conference, url: admin_conference_path(@conference.short_title), html: {multipart: true}) do |f|
|
||||
= render partial: 'form_fields', locals: { f: f }
|
||||
|
|
|
|||
|
|
@ -1,15 +1,4 @@
|
|||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@conference, url: admin_conferences_path) do |f|
|
||||
= f.inputs 'Basic Information' do
|
||||
= f.input :organization, as: :select, collection: @organizations
|
||||
= f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'",
|
||||
input_html: { required: 'required' }
|
||||
= f.input :short_title, hint: "A short and unique handle for your conference, using only letters, numbers, underscores, and dashes. This will be used to identify your conference in URLs etc. Example: 'froscon2011'",
|
||||
input_html: { required: 'required', pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.' }, prepend: conferences_url + '/'
|
||||
= f.inputs 'Scheduling' do
|
||||
= f.input :timezone, as: :time_zone, default: Time.zone.name, hint: 'Please select in what time zone your conference will take place.'
|
||||
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', required: 'required' }
|
||||
= f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', required: 'required' }
|
||||
= f.actions do
|
||||
= f.action :submit, button_html: {class: 'btn btn-success pull-right'}
|
||||
= form_for(@conference, url: admin_conferences_path) do |f|
|
||||
= render partial: 'form_fields', locals: { f: f }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue