Sha256: 0ab3aa57a1d64f2731867677b6c17ce61abfdda06a3685216b79061bbae915ff
Contents?: true
Size: 991 Bytes
Versions: 16
Compression:
Stored size: 991 Bytes
Contents
# frozen_string_literal: true module Lcms module Engine module TagsHelper TAG_GROUPS = { ccss_standards: 'CCSS Standard', ccss_domain: 'CCSS Domain', ccss_cluster: 'CCSS Cluster', texts: 'Texts', authors: 'Authors' }.freeze def render_tag_clouds(resource) named_tags = resource.filtered_named_tags render partial: 'lcms/engine/resources/tags', locals: { tag_clouds: tag_clouds(named_tags), color_code: color_code(resource) } end def tag_clouds(named_tags) named_tags[:ell_appropriate] = named_tags[:ell_appropriate] ? 'ELL Appropriate' : nil named_tags.transform_values { |v| Array.wrap(v).flatten.compact.uniq.sort } end def each_tags_cloud!(tag_clouds) tags = tag_clouds.keep_if { |k, v| TAG_GROUPS.key?(k) && v.present? } tags.each { |k, v| yield(v, TAG_GROUPS[k]) } yield([], nil) if tags.empty? end end end end
Version data entries
16 entries across 16 versions & 1 rubygems