Module: Alchemy::Admin::ContentsHelper

Includes:
BaseHelper
Included in:
ElementsHelper
Defined in:
app/helpers/alchemy/admin/contents_helper.rb

Instance Method Summary collapse

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.



35
36
37
38
39
# File 'app/helpers/alchemy/admin/contents_helper.rb', line 35

def (content)
   :label, for: content.form_field_id do
    [render_content_name(content), render_hint_for(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
# 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.has_warnings?
    icon = hint_with_tooltip(content.warnings)
    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