Class: Editor::PropertiesBuilderHelper::PropertyFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- Editor::PropertiesBuilderHelper::PropertyFormBuilder
- Defined in:
- app/helpers/amalgam/editor/properties_builder_helper.rb
Instance Method Summary collapse
- #attachment(name, options = {}) ⇒ Object
- #attachment_list(name, options = {}) ⇒ Object
- #string(attribute, options = {}) ⇒ Object
- #text(attribute, options = {}) ⇒ Object
Instance Method Details
#attachment(name, options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/helpers/amalgam/editor/properties_builder_helper.rb', line 33 def (name, ={}) [:class] ||= 'input-xlarge' index_create obj = object.[name] @buffer = label("#{I18n.t('amalgam.attachment')} : #{name}",.delete(:lable_options)||{:style => 'font-weight:bold;'}) @buffer.concat '<div style = "border-bottom: solid #cccccc 1px;padding:5px; margin-bottom:3px;">'.html_safe @buffer.concat label(I18n.t("amalgam.description")+':',:style => "display:inline;margin-right:35px;") @buffer.concat (:text_field, :description, obj.try(:description), ) @buffer.concat '<br>'.html_safe @buffer.concat label(I18n.t("amalgam.file_upload")+':',:style => "display:inline;margin-right:10px;") @buffer.concat (:file_field, :file) @buffer.concat '<br>'.html_safe if obj.try(:content_type).to_s =~ /image/ @buffer.concat label(I18n.t("amalgam.file_pre")+':',:style => "display:inline;margin-right:10px;") @buffer.concat @template.image_tag(obj.file.thumb.url) else @buffer.concat "<a href= '#{obj.file.try(:url)}'>#{I18n.t("amalgam.file_download")}</a>".html_safe if obj end @buffer.concat (:hidden_field, :name, name) @buffer.concat (:hidden_field, :id, obj.id) if obj.try(:persisted?) @buffer.concat '</div>'.html_safe @buffer.html_safe end |
#attachment_list(name, options = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/helpers/amalgam/editor/properties_builder_helper.rb', line 57 def (name, ={}) [:class] ||= "attachment_list_#{name}" @buffer = @template.content_tag(:div,) do buffer = label("#{I18n.t('amalgam.attachment_list')} : #{name}",.delete(:lable_options)||{:style => 'font-weight:bold;'}) objs = object.[name] || [] objs.each do |obj| buffer.concat (obj).html_safe end buffer end link = @template.link_to('#', :class => 'new_attachment', :name => name, :data => {"model-id" => object.id, "type" => object.class.to_s.underscore}) do "<i class=\"icon-plus\"></i>#{::I18n.t('amalgam.admin.actions.new')}".html_safe end @buffer.concat link end |
#string(attribute, options = {}) ⇒ Object
25 26 27 |
# File 'app/helpers/amalgam/editor/properties_builder_helper.rb', line 25 def string(attribute, ={}) field_with_label(:text_field,attribute,) end |
#text(attribute, options = {}) ⇒ Object
29 30 31 |
# File 'app/helpers/amalgam/editor/properties_builder_helper.rb', line 29 def text(attribute, ={}) field_with_label(:text_area,attribute,) end |