Module: Alchemy::Admin::ContentsHelper
- Includes:
- BaseHelper
- Included in:
- ElementsHelper, EssencesHelper
- 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, #js_filter_field, #link_to_confirm_dialog, #link_to_dialog, #link_url_regexp, #max_image_count, #merge_params, #merge_params_only, #merge_params_without, #new_asset_path_with_session_information, #render_alchemy_title, #render_hint_for, #sites_for_select, #toolbar, #toolbar_button, #translations_for_select
Methods included from NavigationHelper
#admin_subnavigation, #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
#_t, #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.
32 33 34 35 36 |
# File 'app/helpers/alchemy/admin/contents_helper.rb', line 32 def content_label(content) content_tag :label 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.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/alchemy/admin/contents_helper.rb', line 12 def render_content_name(content) if content.blank? warning('Content is nil') return else content_name = content.name_for_label end if content.definition.blank? warning("Content #{content.name} is missing its definition") title = Alchemy.t(:content_definition_missing) content_name = %(<span class="warning icon" title="#{title}"></span> #{content_name}).html_safe end if content.has_validations? "#{content_name}<span class='validation_indicator'>*</span>".html_safe else content_name end end |