Class: Locomotive::CodeInput
- Inherits:
-
Formtastic::Inputs::TextInput
- Object
- Formtastic::Inputs::TextInput
- Locomotive::CodeInput
- Defined in:
- app/inputs/locomotive/code_input.rb
Instance Method Summary collapse
- #copy_from_main_locale_html ⇒ Object
- #hint_text ⇒ Object
- #image_picker_html ⇒ Object
- #input_wrapping(&block) ⇒ Object
- #to_html ⇒ Object
- #toolbar_html ⇒ Object
Instance Method Details
#copy_from_main_locale_html ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'app/inputs/locomotive/code_input.rb', line 39 def copy_from_main_locale_html url = .delete(:main_locale_template_url) return nil unless url template.link_to( template.content_tag(:i, '', :class => 'icon-download') + template.t('locomotive.code_editing.copy_template'), url, :id => 'copy-template-link', :class => 'copy') end |
#hint_text ⇒ Object
10 11 12 |
# File 'app/inputs/locomotive/code_input.rb', line 10 def hint_text localized_string(method, [:hint], :hint) end |
#image_picker_html ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/inputs/locomotive/code_input.rb', line 30 def image_picker_html return nil if .delete(:picker) == false template.link_to( template.content_tag(:i, '', :class => 'icon-picture') + template.t('locomotive.code_editing.image_picker'), template.theme_assets_path, :id => 'image-picker-link', :class => 'picture') end |
#input_wrapping(&block) ⇒ Object
4 5 6 7 8 |
# File 'app/inputs/locomotive/code_input.rb', line 4 def input_wrapping(&block) elements = [template.capture(&block), error_html, , hint_html] template.content_tag(:li, elements.join("\n").html_safe, ) end |
#to_html ⇒ Object
14 15 16 17 18 |
# File 'app/inputs/locomotive/code_input.rb', line 14 def to_html input_wrapping do builder.text_area(method, ) end end |
#toolbar_html ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/inputs/locomotive/code_input.rb', line 20 def elements = [image_picker_html, copy_from_main_locale_html].compact return '' if elements.size == 0 template.content_tag(:div, elements.join(' | ').html_safe, :class => 'more error-anchor') end |