2011-11-09 01:35:59 +00:00
|
|
|
module Locomotive
|
|
|
|
class CodeInput < Formtastic::Inputs::TextInput
|
|
|
|
|
|
|
|
def input_wrapping(&block)
|
|
|
|
template.content_tag(:li,
|
|
|
|
[template.capture(&block), error_html, image_picker_html, hint_html].join("\n").html_safe,
|
|
|
|
wrapper_html_options
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2011-11-27 16:22:54 +00:00
|
|
|
def hint_text
|
2011-11-29 01:24:02 +00:00
|
|
|
localized_string(method, options[:hint], :hint)
|
2011-11-27 16:22:54 +00:00
|
|
|
end
|
|
|
|
|
2011-11-09 01:35:59 +00:00
|
|
|
def to_html
|
|
|
|
input_wrapping do
|
|
|
|
builder.text_area(method, input_html_options)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def image_picker_html
|
2011-11-27 16:22:54 +00:00
|
|
|
return '' if options.delete(:picker) == false
|
2011-11-09 01:35:59 +00:00
|
|
|
template.content_tag(:div,
|
|
|
|
template.link_to(template.t('locomotive.image_picker.link'), template.theme_assets_path, :id => 'image-picker-link', :class => 'picture'),
|
|
|
|
:class => 'more')
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|