Class: Locomotive::FileInput
- Inherits:
-
Object
- Object
- Locomotive::FileInput
- Includes:
- Formtastic::Inputs::Base
- Defined in:
- app/inputs/locomotive/file_input.rb
Instance Method Summary collapse
- #file_wrapper_html ⇒ Object
- #input_wrapping(&block) ⇒ Object
- #to_html ⇒ Object
- #with_file_html ⇒ Object
- #without_file_html ⇒ Object
Instance Method Details
#file_wrapper_html ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/inputs/locomotive/file_input.rb', line 19 def file_wrapper_html template.content_tag(:script, %( {{#if url}} #{with_file_html} {{else}} #{without_file_html} {{/if}}).html_safe, :type => 'text/html', :id => "#{method}_file_input") end |
#input_wrapping(&block) ⇒ Object
12 13 14 15 16 17 |
# File 'app/inputs/locomotive/file_input.rb', line 12 def input_wrapping(&block) template.content_tag(:li, [template.capture(&block), file_wrapper_html, error_html, hint_html].join("\n").html_safe, ) end |
#to_html ⇒ Object
6 7 8 9 10 |
# File 'app/inputs/locomotive/file_input.rb', line 6 def to_html input_wrapping do label_html end end |
#with_file_html ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/inputs/locomotive/file_input.rb', line 30 def with_file_html = I18n.t('locomotive.shared.form.cancel') html = template.link_to '{{filename}}', '{{url}}', :target => '_blank' html += builder.file_field(method, .merge(:style => 'display: none')) html += template.link_to I18n.t('locomotive.shared.form.change_file'), '#', :class => 'change', :'data-alt-label' => html += template.link_to I18n.t('locomotive.shared.form.delete_file'), '#', :class => 'delete', :'data-alt-label' => html += builder.hidden_field "remove_#{method}", :class => 'remove-flag' end |
#without_file_html ⇒ Object
40 41 42 |
# File 'app/inputs/locomotive/file_input.rb', line 40 def without_file_html builder.file_field(method, ).html_safe end |