Moved form helpers from application_helper to a real FormHelper
This commit is contained in:
@@ -1,19 +1,5 @@
|
||||
= form_for @conference_registration do |f|
|
||||
- if @conference_registration.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@conference_registration.errors.count, "error")} prohibited this conference_registration from being saved:"
|
||||
%ul
|
||||
- @conference_registration.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.field
|
||||
= f.label :conference_id
|
||||
= f.number_field :conference_id
|
||||
.field
|
||||
= f.label :user_id
|
||||
= f.number_field :user_id
|
||||
.field
|
||||
= f.label :is_attending
|
||||
= f.text_field :is_attending
|
||||
.actions
|
||||
= f.submit 'Save'
|
||||
= f.number_field :conference_id
|
||||
= f.number_field :user_id
|
||||
= f.text_field :is_attending
|
||||
= f.actions :Save
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
= form_for @conference_registraton_form_field do |f|
|
||||
- if @conference_registraton_form_field.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@conference_registraton_form_field.errors.count, "error")} prohibited this conference_registraton_form_field from being saved:"
|
||||
%ul
|
||||
- @conference_registraton_form_field.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.field
|
||||
= f.label :conference_id
|
||||
= f.number_field :conference_id
|
||||
.field
|
||||
= f.label :registration_form_field_id
|
||||
= f.number_field :registration_form_field_id
|
||||
.field
|
||||
= f.label :order
|
||||
= f.number_field :order
|
||||
.actions
|
||||
= f.submit 'Save'
|
||||
= f.label :conference_id
|
||||
= f.number_field :conference_id
|
||||
= f.label :registration_form_field_id
|
||||
= f.number_field :registration_form_field_id
|
||||
= f.label :order
|
||||
= f.number_field :order
|
||||
= f.actions :Save
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
= form_for @conference do |f|
|
||||
.columns
|
||||
- if @conference.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@conference.errors.count, "error")} prohibited this conference from being saved:"
|
||||
%ul
|
||||
- @conference.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
= field f, :title, :text_field
|
||||
= field f, :slug, :text_field
|
||||
= f.text_field :title
|
||||
= f.text_field :slug
|
||||
.columns.medium-4
|
||||
= field f, :poster, :image_field, @conference.poster_url
|
||||
= field f, :cover, :image_field, @conference.cover_url
|
||||
= f.image_field :poster, @conference.poster_url
|
||||
= f.image_field :cover, @conference.cover_url
|
||||
- # @parse_data['photos'].each do |img|
|
||||
- # - if img['width'] > 980
|
||||
- # %img{src: img['photo_file_url']}
|
||||
.columns.medium-8
|
||||
= field f, :conference_type_id, :collection_select, ConferenceType.all, attrs: [:id, :title]
|
||||
= f.collection_select :conference_type_id, ConferenceType.all, :id, :title
|
||||
.row
|
||||
.columns.small-6
|
||||
= field f, :start_date, :date_field
|
||||
= f.date_field :start_date
|
||||
.columns.small-6
|
||||
= field f, :end_date, :date_field
|
||||
= field f, :workshop_schedule_published, :check_box
|
||||
= field f, :meals_provided, :check_box
|
||||
= field f, :meal_info, :text_area
|
||||
= field f, :travel_info, :text_area
|
||||
= f.date_field :end_date
|
||||
= f.check_box :workshop_schedule_published
|
||||
= f.check_box :meals_provided
|
||||
= f.text_area :meal_info
|
||||
= f.text_area :travel_info
|
||||
.columns
|
||||
= field f, :info, :text_area
|
||||
= actions :save
|
||||
= f.text_area :info
|
||||
= f.actions :save
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.columns.medium-8
|
||||
= field f, :registration_open, :check_box, help: true
|
||||
= field f, :preregistration_info, :text_area, help: true
|
||||
= field f, :registration_info, :text_area, help: true
|
||||
= field f, :postregistration_info, :text_area, help: true
|
||||
= f.check_box :registration_open, help: true
|
||||
= f.text_area :preregistration_info, help: true
|
||||
= f.text_area :registration_info, help: true
|
||||
= f.text_area :postregistration_info, help: true
|
||||
.columns
|
||||
= actions :save
|
||||
= f.actions :save
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
.columns.medium-8
|
||||
= field :is_attending, :select_tag, ConferenceRegistration::AttendingOptions, label: 'Are you attending?', value: @conference_registration.try(:is_attending)
|
||||
= select_tag :is_attending, ConferenceRegistration::AttendingOptions, label: 'Are you attending?', value: @conference_registration.try(:is_attending)
|
||||
%ol
|
||||
- @conference.registration_form_fields.each do |ff|
|
||||
%li
|
||||
- response = @conference_registration ? ConferenceRegistrationResponse.find_by(conference_registration_id: @conference_registration.id, registration_form_field_id: ff.id) : nil
|
||||
= form_field ff, response
|
||||
= actions :register
|
||||
= form_actions :register
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
.columns.medium-8
|
||||
.clearfix
|
||||
= f.fields_for :conference_host_organizations, :include_id => true do |u|
|
||||
= field u, :id, :organization_select_field, @conference.organizations[u.index], attrs: @conference
|
||||
= actions :save
|
||||
= u.organization_select_field :id, @conference.organizations[u.index] #, attrs: @conference
|
||||
= f.actions :save
|
||||
|
||||
@@ -3,13 +3,6 @@
|
||||
= tabs!
|
||||
.row
|
||||
= form_for @conference do |f|
|
||||
.columns
|
||||
- if @conference.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@conference.errors.count, "error")} prohibited this conference from being saved:"
|
||||
%ul
|
||||
- @conference.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
.columns.medium-4
|
||||
=sub_tabs!
|
||||
%h2=_'conference.hosts.help.title', :t
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.actions
|
||||
- @actions.each do |action|
|
||||
- if action.to_sym == :facebook_sign_in
|
||||
%a.facebook-sign-in.button{href: '/oauth/facebook'}
|
||||
= _ action.to_s
|
||||
- else
|
||||
%button{id: action.to_s, name: action.to_s, type: 'submit'}
|
||||
= _ action.to_s
|
||||
@@ -0,0 +1,10 @@
|
||||
- namekey = @name.to_s.gsub('_', '-')
|
||||
- typekey = @type.gsub('_', '-').gsub(/^(.*?)(\-field)?$/, '\1-field')
|
||||
%div{class: ['field', typekey, 'field-' + namekey, @value ? nil : 'new']}
|
||||
- if @options[:help]
|
||||
%p.help=_(("form.#{@options[:_controller]}.#{namekey}.help"), :w, 20)
|
||||
- @label = @label_template ? (render ('layouts/fields/label_' + @label_template)) : nil
|
||||
= @label_position == :before && @label ? @label : ''
|
||||
- if @label_position != :inside
|
||||
%div=@html
|
||||
= @label_position == :after && @label ? '' : @label
|
||||
@@ -0,0 +1,9 @@
|
||||
- # we should render errors here
|
||||
- if @record.errors.any?
|
||||
.form-errors
|
||||
%ul
|
||||
- @record.errors.full_messages.each do |msg|
|
||||
- # not sure how this works, we may have to pull
|
||||
- # some sort of error id out of this and construct
|
||||
- # an I18n translation key
|
||||
%li=msg
|
||||
@@ -0,0 +1,7 @@
|
||||
= image_tag (@value || 'http://placehold.it/300x300&text=Click%20to%20upload%20an%20Image')
|
||||
- if @form
|
||||
-# = @form.hidden_field (@name.to_s + '_cache')
|
||||
= @form.file_field @name, {:no_wrapper => true}
|
||||
- else
|
||||
= file_field_tag @name, {:no_wrapper => true}
|
||||
= hidden_field_tag (@name.to_s + '_cache')
|
||||
@@ -0,0 +1,11 @@
|
||||
= @form.hidden_field(:id, { class: 'id' })
|
||||
= @form.check_box(:_destroy, {:no_wrapper => true})
|
||||
= @form.label(:_destroy, '×')
|
||||
= @form.hidden_field(:organization_id, { class: 'organzation-id'} )
|
||||
- if @value && @value.id
|
||||
= form_html = image_tag(@value.avatar.url :thumb)
|
||||
.organizationname=@value.name
|
||||
- else
|
||||
%a.select-organization{href: '#'}
|
||||
= image_tag('http://placehold.it/120x120&text=%252B')
|
||||
.organizationname
|
||||
@@ -0,0 +1,14 @@
|
||||
= @form.hidden_field(:id, { class: 'id' })
|
||||
= @form.check_box(:_destroy, {:no_wrapper => true})
|
||||
= @form.label(:_destroy, '×')
|
||||
= @form.hidden_field(:user_id, { class: 'user-id'} )
|
||||
- if @value && @value.id
|
||||
= image_tag(@value.avatar.url :thumb)
|
||||
.username=@value.username
|
||||
- if @options[:relationship]
|
||||
= @form.select(:relationship, options_for_select(UserOrganizationRelationship::AllRelationships, @options[:relationship]), {:no_wrapper => true}, {class: 'small'})
|
||||
- else
|
||||
- if @options[:relationship]
|
||||
%a.select-user{href: '#'}=image_tag('http://placehold.it/120x120&text=%252B')
|
||||
.username
|
||||
= @form.select(:relationship, options_for_select(UserOrganizationRelationship::AllRelationships, UserOrganizationRelationship::DefaultRelationship), {:no_wrapper => true}, {class: 'small'})
|
||||
@@ -0,0 +1,8 @@
|
||||
- label = @options[:label] || _('form.label.' + @name.to_s)
|
||||
= label_tag @name do
|
||||
- if @label_position == :inside
|
||||
%div=@html
|
||||
%span
|
||||
%span=label
|
||||
- else
|
||||
%span=label
|
||||
@@ -1,41 +1,20 @@
|
||||
= form_for @organization do |f|
|
||||
.columns
|
||||
- if @organization.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@organization.errors.count, "error")} prohibited this organization from being saved:"
|
||||
%ul
|
||||
- @organization.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
= field f, :name, :text_field
|
||||
= field f, :slug, :text_field
|
||||
= f.text_field :name
|
||||
= f.text_field :slug
|
||||
|
||||
.columns.medium-4.small-text-centered
|
||||
-#%h2=_'organization.create.intro-title', :t
|
||||
-#%p=_'organization.create.intro', :p
|
||||
=# field f, :avatar, :image_field
|
||||
= field f, :avatar, :image_field, @organization.avatar_url
|
||||
-#= field f, :year_founded, :number_field
|
||||
=# f.label :avatar do
|
||||
=# %div
|
||||
=# = image_tag(@organization.avatar_url || ''
|
||||
=# = f.hidden_field :avatar_cache
|
||||
= f.image_field :avatar, @organization.avatar_url
|
||||
.columns.medium-8
|
||||
= field f, :email_address, :email_field
|
||||
= f.email_field :email_address
|
||||
= f.fields_for :locations do |b|
|
||||
= field_set_tag 'Location' do
|
||||
= field b, :country, :country_select, {help: 'Select a Country'}
|
||||
= b.country_select :country, {help: 'Select a Country'}
|
||||
- cc = @organization.locations && @organization.locations[b.index].country ? @organization.locations[b.index].country : 'US'
|
||||
= field b, :territory, :subregion_select, cc, html: {class: @organization.locations[b.index].country ? 'can' : 'cant', data: {:country => cc}}
|
||||
= field b, :city, :text_field
|
||||
= field b, :street, :text_field
|
||||
= field b, :postal_code, :text_field
|
||||
-#= field f, :logo, :text_field
|
||||
-#= field f, :avatar, :text_field
|
||||
-#= field f, :requires_approval, :check_box
|
||||
-#= field f, :secret_question, :text_field
|
||||
-#= field f, :secret_answer, :text_field
|
||||
-#= field f, :location_id, :number_field
|
||||
-#= field f, :user_organization_replationship_id, :number_field
|
||||
= b.subregion_select :territory, cc, html: {class: @organization.locations[b.index].country ? 'can' : 'cant', data: {:country => cc}}
|
||||
= b.text_field :city
|
||||
= b.text_field :street
|
||||
= b.text_field :postal_code
|
||||
.columns
|
||||
= field f, :info, :text_area
|
||||
= actions :save
|
||||
= f.text_area :info
|
||||
= f.actions :save
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
%h2=_'organization.members.help.title', :t
|
||||
%p=_'organization.members.help', :p
|
||||
.columns.medium-8
|
||||
= field f, :cover, :image_field, @organization.cover_url
|
||||
= field f, :year_founded, :number_field
|
||||
= actions :save
|
||||
= f.image_field :cover, @organization.cover_url
|
||||
= f.number_field :year_founded
|
||||
= f.actions :save
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
.columns.medium-8
|
||||
.clearfix
|
||||
= f.fields_for :user_organization_relationships, :include_id => true do |u|
|
||||
= field u, :id, :user_select_field, @organization.users[u.index], attrs: [@organization.user_organization_relationships[u.index]]
|
||||
= actions :save
|
||||
= u.user_select_field :id, @organization.users[u.index], {:relationship => @organization.user_organization_relationships[u.index].relationship || true}
|
||||
-#attrs: [@organization.user_organization_relationships[u.index]]
|
||||
= f.actions :save
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
= form_for @registration_form_field do |f|
|
||||
- if @registration_form_field.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@registration_form_field.errors.count, "error")} prohibited this registration_form_field from being saved:"
|
||||
%ul
|
||||
- @registration_form_field.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
- if @conference
|
||||
= field :conference_id, :hidden_field_tag, value: @conference.id
|
||||
= field f, :field_type, :select, RegistrationFormField::Types.keys
|
||||
= f.hidden_field :conference_id, value: @conference.id
|
||||
= f.select :field_type, RegistrationFormField::Types.keys
|
||||
- RegistrationFormField::Fields.each do |key, value|
|
||||
- classes = RegistrationFormField::TypesForField(key.to_sym).collect{|v| 'field-type-' + v.to_s}
|
||||
- classes << 'registration-form-field-field'
|
||||
= eval('field f, :' + key.to_s + ', :' + value[:control] + (value[:options] ? ', ' + (value[:options].map.with_index{|v, i| 'value[:options][' + i.to_s + ']'}.join(', ') || 'nil') : '') + ", classes: classes")
|
||||
= actions :save
|
||||
- options = {:html => { :classes => RegistrationFormField::TypesForField(key.to_sym).collect{|v| 'field-type-' + v.to_s} } }
|
||||
- options[:html][:classes] << 'registration-form-field-field'
|
||||
-# eval('field f, :' + key.to_s + ', :' + value[:control] + (value[:options] ? ', ' + (value[:options].map.with_index{|v, i| 'value[:options][' + i.to_s + ']'}.join(', ') || 'nil') : '') + ", classes: classes")
|
||||
- if value[:options]
|
||||
- fields = options_for_select(value[:options].first.map { |v| [_("form_field.#{v}"), v]})
|
||||
= f.send(value[:control], key.to_s, fields, options)
|
||||
- else
|
||||
= f.send(value[:control], key.to_s, options)
|
||||
= f.actions :save
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= form_tag user_sessions_path, :method => :post do
|
||||
= field :email, :email_field
|
||||
= field :password, :password_field_tag
|
||||
= actions [:Sign_In, :facebook_sign_in]
|
||||
= email_field_tag :email
|
||||
= password_field_tag :password
|
||||
= form_actions [:Sign_In, :facebook_sign_in]
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
= form_for @user, :html => (@user.id ? {:multipart => true} : {}) do |f|
|
||||
%div{:class => (@user.id ? 'columns medium-6' : '')}
|
||||
- if @user.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:"
|
||||
%ul
|
||||
- @user.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
= field f, :username, :text_field
|
||||
= field f, :email, :text_field
|
||||
= f.text_field :username
|
||||
= f.email_field :email
|
||||
- if !@user.id
|
||||
= field f, :password, :password_field
|
||||
= field f, :password_confirmation, :password_field
|
||||
= actions :register
|
||||
= f.password_field, :password
|
||||
= f.password_field, :password_confirmation
|
||||
= f.actions :register
|
||||
- if @user.id
|
||||
.columns.medium-6
|
||||
= field f, :avatar, :image_field, @user.avatar_url
|
||||
= actions :save
|
||||
= f.image_field :avatar, @user.avatar_url
|
||||
= f.actions :save
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
= form_for @workshop, url: conference_workshops_path(@conference, @workshop) do |f|
|
||||
.columns
|
||||
- if @workshop.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@workshop.errors.count, "error")} prohibited this workshop from being saved:"
|
||||
%ul
|
||||
- @workshop.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
= field f, :title, :text_field
|
||||
= field f, :slug, :text_field
|
||||
= f.text_field :title
|
||||
= f.text_field :slug
|
||||
.columns.medium-4
|
||||
%h2=_'workshop.form.help.title', :t
|
||||
=_'workshop.form.help', :p
|
||||
.columns.medium-8
|
||||
= field f, :info, :text_area
|
||||
= field f, :workshop_stream_id, :number_field
|
||||
= field f, :workshop_presentation_style, :number_field
|
||||
=# field f, :min_facilitators, :number_field
|
||||
=# field f, :location_id, :number_field
|
||||
=# field f, :start_time, :datetime_select
|
||||
=# field f, :end_time, :datetime_select
|
||||
= f.text_area :info
|
||||
= f.number_field :workshop_stream_id
|
||||
= f.number_field :workshop_presentation_style
|
||||
.columns
|
||||
= actions :save
|
||||
= f.actions :save
|
||||
|
||||
Reference in New Issue
Block a user