orbit-basic/app/helpers/admin/tags_helper.rb

28 lines
724 B
Ruby

module Admin::TagsHelper
def get_module_app_icon(module_app)
app = OrbitApp::Module::Registration.find_by_key(module_app.key)
app.get_icon_class rescue 'icons-daniel-bruce-2'
end
def show_names_slash(tag)
span_names = @site_valid_locales.inject([]) do |names, locale|
names << content_tag(:span, tag.name_translations[locale], class: "tag")
end
span_names.join(" / ").html_safe
end
def get_tagging_count(module_tag)
if module_tag.is_default && module_tag.parent.blank?
count = module_tag.children.inject(0) do |count, child|
count += child.tag.taggings.count
count
end
else
count = module_tag.tag.taggings.count
end
count
end
end