Module: Editor::EditorHelper
- Defined in:
- app/helpers/amalgam/editor/editor_helper.rb
Instance Method Summary collapse
- #editable_content_tag(tag, obj, field, options = {}, &block) ⇒ Object
- #properties_button(model_or_url, title = nil) ⇒ Object
Instance Method Details
#editable_content_tag(tag, obj, field, options = {}, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/amalgam/editor/editor_helper.rb', line 4 def editable_content_tag tag,obj,field,={},&block if can_edit? [:data] = ([:data] || {}).merge(:type => 'editable') [:data][:mercury] = "full" [:data][:id] = "#{obj.class.to_s.tableize}/#{obj.id.to_s}.#{field.to_s}" end value = fetch_field(obj,field) if value.present? content_tag(tag,value.to_s.html_safe,) else content_tag(tag,,&block) if block_given? end end |
#properties_button(model_or_url, title = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/amalgam/editor/editor_helper.rb', line 18 def (model_or_url,title=nil) return unless can_edit? title ||= I18n.t('properties_edit') url = case url when String then "#{model_or_url}?mercury_frame=true" else "#{url_for(model_or_url)}?mercury_frame=true" end (title, :type=>'button', :data => {:url => url }, :class => 'properties', :style => "display:none") end |