Moved form helpers from application_helper to a real FormHelper
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user