module Fiona7OverrideHelper
include ScrivitoHelper
{
'cms_image_tag' => 'scrivito_image_tag',
'cms_path' => 'scrivito_path',
'cms_tag' => 'scrivito_tag',
'cms_tag_list' => 'scrivito_tag_list',
'cms_url' => 'scrivito_url',
'display_field' => 'scrivito_field',
'display_value' => 'scrivito_value',
'scrivito_after_content_tags' => 'scrivito_body_tags',
'scrivito_header_tags' => 'scrivito_head_tags',
}.each_pair do |old_method_name, new_method_name|
ScrivitoHelper.send(:remove_method, old_method_name) if ScrivitoHelper.method_defined?(old_method_name)
end
def scrivito_body_tags
obj = @obj.kind_of?(RailsConnector::BasicObj) ? @obj.scrivito_obj : @obj
Scrivito::LayoutTags.new(self).page_config(obj)
end
def fiona7_head_tags
scrivito_head_tags
end
def fiona7_body_tags
scrivito_body_tags
end
def fiona7_workflow_buttons
locale = Scrivito::Configuration.ui_locale || I18n.locale
tt = lambda {|action|
I18n.t(:"fiona7.workflow.#{action}", locale: locale)
}
# TODO: add translation
html = <<-EOHTML
EOHTML
html.html_safe
end
def fiona7_tag(tag_name, obj_or_widget, field_name, html_options = {}, editing_options = {}, &block)
raise "This method can only be used in legacy mode" unless Fiona7.mode == :legacy
obj_or_widget = obj_or_widget.kind_of?(RailsConnector::BasicObj) ? obj_or_widget.scrivito_obj : obj_or_widget
scrivito_tag(tag_name, obj_or_widget, field_name, html_options, editing_options, &block)
end
def fiona7_tag_list(tag_name, obj, field_name, options = {}, &block)
raise "This method can only be used in legacy mode" unless Fiona7.mode == :legacy
fiona_obj = obj.kind_of?(RailsConnector::BasicObj) ? obj : obj.fiona_obj
obj = obj.kind_of?(RailsConnector::BasicObj) ? obj.scrivito_obj : obj
children_map = Hash[fiona_obj.children.map {|c| [c.id.to_s, c] }]
scrivito_tag_list(tag_name, obj, field_name, options) do |list, scrivito_child|
fiona_child = children_map[scrivito_child.id]
next if fiona_child.suppressed? # suppress_export
next if !Fiona7::EditingEnvCheck.new(request.env).rtc_selected? && !fiona_child.active? # valid_from & valid_until
block.call(list, fiona_child)
end
end
end