Module: Alchemy::Admin::ContentsHelper
- Includes:
- BaseHelper
- Included in:
- ElementsHelper
- Defined in:
- app/helpers/alchemy/admin/contents_helper.rb
Instance Method Summary collapse
-
#content_label(content) ⇒ Object
Renders the label and a remove link for a content.
-
#render_content_name(content) ⇒ Object
Renders the name of elements content.
Methods included from BaseHelper
#alchemy_body_class, #alchemy_datepicker, #button_with_confirm, #clipboard_select_tag_options, #current_alchemy_user_name, #delete_button, #hint_with_tooltip, #js_filter_field, #link_to_confirm_dialog, #link_to_dialog, #link_url_regexp, #new_asset_path_with_session_information, #page_layout_missing_warning, #render_alchemy_title, #render_hint_for, #sites_for_select, #toolbar_button, #translations_for_select
Methods included from NavigationHelper
#alchemy_main_navigation_entry, #entry_active?, #main_navigation_css_classes, #navigate_module, #sorted_alchemy_modules, #url_for_module, #url_for_module_sub_navigation
Methods included from BaseHelper
#message_icon_class, #page_or_find, #render_flash_notice, #render_icon, #render_message, #shorten, #warning
Instance Method Details
#content_label(content) ⇒ Object
Renders the label and a remove link for a content.
40 41 42 43 44 |
# File 'app/helpers/alchemy/admin/contents_helper.rb', line 40 def content_label(content) content_tag :label, for: content.form_field_id do [render_hint_for(content), render_content_name(content)].compact.join(" ").html_safe end end |
#render_content_name(content) ⇒ Object
Renders the name of elements content.
Displays a warning icon if content is missing its definition.
Displays a mandatory field indicator, if the content has validations.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/alchemy/admin/contents_helper.rb', line 14 def render_content_name(content) if content.blank? warning("Content is nil") return end content_name = content.name_for_label if content.definition.blank? warning("Content #{content.name} is missing its definition") icon = hint_with_tooltip( Alchemy.t(:content_definition_missing), ) content_name = "#{icon} #{content_name}".html_safe end if content.has_validations? "#{content_name}<span class='validation_indicator'>*</span>".html_safe else content_name end end |