Sha256: 15d36bfc37be1d5e7b202c08f1432d70698e955e88cfbddd121393ba2c2f6e0e
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
module Alchemy module Admin module ContentsHelper include Alchemy::Admin::BaseHelper # 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. # 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 # Renders the label and a remove link for a content. def content_label(content) content_tag :label do [render_hint_for(content), render_content_name(content)].compact.join(' ').html_safe end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems