module Alchemy::UserManual::TemplateHelper
Private Instance Methods
element_anchor_name(element_name)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 11 def element_anchor_name(element_name) "element_#{translated_element_name(element_name).parameterize}" end
element_properties(element)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 23 def element_properties(element) properties = [] properties << ['element_amount', possible_amount_of_element(element)] end
layout_properties(layout)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 15 def layout_properties(layout) properties = [] properties << ["layoutpage", layout["layoutpage"] || "false"] properties << ["uniqueness", layout["unique"] || "false"] properties << ["available_elements", linked_element_collection(layout["elements"]) || "none" ] properties << ["element_autogenerating", linked_element_collection(layout["autogenerate"]) || "none"] end
linked_element_collection(element_names=[])
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 36 def linked_element_collection(element_names=[]) return if element_names.blank? element_names.map {|e| "[#{translated_element_name(e)}](##{element_anchor_name(e)})" }.join(", ") end
possible_amount_of_element(element)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 41 def possible_amount_of_element(element) if element['unique'].to_s == "true" 'once_per_page' else element['amount'].present? ? element['amount'] : 'unlimited' end end
property_name(property)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 28 def property_name(property) I18n.t(property.first, :scope => "user_manual") end
property_value(property)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 32 def property_value(property) I18n.t(property.last, :scope => "user_manual") end
translated_element_name(name)
click to toggle source
# File lib/alchemy/user_manual/helpers/template_helper.rb, line 7 def translated_element_name(name) I18n.t(name, scope: 'element_names', default: name.humanize) end