Module: Sinicum::TaglibHelper5
- Includes:
- Sinicum::Templating::TemplatingUtils
- Included in:
- MgnlHelper5
- Defined in:
- app/helpers/sinicum/taglib_helper5.rb
Instance Method Summary collapse
- #mgnl_area(name, options = {}) ⇒ Object
- #mgnl_components ⇒ Object
- #mgnl_init ⇒ Object
- #mgnl_preview_mode ⇒ Object
- #mgnl_render_bars ⇒ Object
- #mgnl_render_component(key_or_object, options = {}) ⇒ Object
Instance Method Details
#mgnl_area(name, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/sinicum/taglib_helper5.rb', line 22 def mgnl_area(name, = {}) area_name = name result = nil if area_name.present? available_components = initialize_area(mgnl_content_data, area_name) if available_components result = mgnl_comment_tag( :'cms:area', content: "#{mgnl_content_data.jcr_workspace}:#{mgnl_content_data.jcr_path}/" \ "#{area_name}", name: area_name, availableComponents: available_components.join(","), type: "list", label: area_name, inherit: "false", optional: "false", showAddButton: "true", showNewComponentArea: "true", description: area_name) do mgnl_render_component(area_name.to_sym, ) end result = result.html_safe if result elsif ! result = mgnl_render_component(area_name.to_sym, ) end end result end |
#mgnl_components ⇒ Object
51 52 53 |
# File 'app/helpers/sinicum/taglib_helper5.rb', line 51 def mgnl_components mgnl_content_data.children end |
#mgnl_init ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/sinicum/taglib_helper5.rb', line 5 def mgnl_init return unless result = "<!-- begin js and css added by @cms.init -->\n" result << content_tag(:meta, nil, name: "gwt:property", content: "locale=en") + "\n" result << comment_tag( :'cms:page', nil, content: component_path(mgnl_original_content.jcr_workspace, mgnl_original_content.path), dialog: dialog_for_node(mgnl_original_content), preview: mgnl_preview_mode) result << "\n" result << "<!-- end js and css added by @cms.init -->" result.html_safe end |
#mgnl_preview_mode ⇒ Object
89 90 91 |
# File 'app/helpers/sinicum/taglib_helper5.rb', line 89 def mgnl_preview_mode request.headers["HTTP_X_MGNL_PREVIEW"] == "true" || ! end |
#mgnl_render_bars ⇒ Object
85 86 87 |
# File 'app/helpers/sinicum/taglib_helper5.rb', line 85 def request.headers["HTTP_X_MGNL_ADMIN"].present? && !Rails.env.production? end |
#mgnl_render_component(key_or_object, options = {}) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/helpers/sinicum/taglib_helper5.rb', line 55 def mgnl_render_component(key_or_object, = {}) result = nil node = object_from_key_or_object(key_or_object) if node mgnl_push(node) do if node.jcr_primary_type == "mgnl:component" && result = mgnl_comment_tag( :'cms:component', content: "#{node.jcr_workspace}:#{node.jcr_path}", dialog: dialog_for_node(node), label: node.mgnl_template) do begin render create_render_params(node, ) rescue ActionView::MissingTemplate => e render_missing_template(node, e) end end result = result.html_safe else begin result = render create_render_params(node, ) rescue ActionView::MissingTemplate => e result = render_missing_template(node, e) end end end end result end |