app/helpers/locomotive/content_entries_helper.rb in locomotivecms-3.0.0.pre.alpha.3 vs app/helpers/locomotive/content_entries_helper.rb in locomotivecms-3.0.0.pre.beta.1
- old
+ new
@@ -1,25 +1,15 @@
module Locomotive
module ContentEntriesHelper
- # Display the name of the account (+ avatar) who created or updated the content entry
- # as well as the date when it happened.
- #
- # @param [ Object ] entry The content entry instance
- #
- # @return [ String ] The html output
- #
- def content_entry_stamp(entry)
- distance = time_ago_in_words(entry.updated_at)
+ # Tell if the tab specified by the name argument should
+ # be displayed or not. It is based on the display_settings
+ # property of the content type.
+ def display_content_entry_tab?(content_type, name)
+ return true if content_type.display_settings.blank?
- if account = entry.updated_by || entry.created_by
- profile = account_avatar_and_name(account, '40x40#')
- key = entry.updated_by ? :updated_by : :created_by
- t(key, scope: 'locomotive.content_entries.index', distance: distance, who: profile)
- else
- t('locomotive.content_entries.index.updated_at', distance: distance)
- end
+ content_type.display_settings[name.to_s] != false
end
# Display the label related to a field of a content entry.
# If the field is not localized, we just display the label.
# If the field is localized, then we display a nice flag icon
@@ -32,13 +22,13 @@
#
def label_for_custom_field(entry, field)
if field.localized?
translated_css = entry.translated_field?(field) ? '' : 'untranslated'
- icon = content_tag(:i, '', class: 'icon-flag')
- tag = content_tag(:span, icon, class: "localized-icon #{translated_css}")
- "#{tag}#{field.label}"
+ icon = content_tag(:i, '', class: "fa fa-globe #{translated_css}")
+
+ "#{icon} #{field.label}".html_safe
else
field.label
end
end
@@ -63,9 +53,13 @@
where: %({"#{field.name}_id": "#{group[:_id]}"}),
q: params[:q]
})
})
end
+ end
+
+ def can_edit_public_submission_accounts?(content_type)
+ policy(content_type).update? && content_type.public_submission_enabled?
end
end
end