Module: Lcms::Engine::TagsHelper
- Defined in:
- app/helpers/lcms/engine/tags_helper.rb
Constant Summary collapse
- TAG_GROUPS =
{ ccss_standards: 'CCSS Standard', ccss_domain: 'CCSS Domain', ccss_cluster: 'CCSS Cluster', texts: 'Texts', authors: 'Authors' }.freeze
Instance Method Summary collapse
- #each_tags_cloud!(tag_clouds) {|[], nil| ... } ⇒ Object
- #render_tag_clouds(resource) ⇒ Object
- #tag_clouds(named_tags) ⇒ Object
Instance Method Details
#each_tags_cloud!(tag_clouds) {|[], nil| ... } ⇒ Object
25 26 27 28 29 |
# File 'app/helpers/lcms/engine/tags_helper.rb', line 25 def (tag_clouds) = tag_clouds.keep_if { |k, v| TAG_GROUPS.key?(k) && v.present? } .each { |k, v| yield(v, TAG_GROUPS[k]) } yield([], nil) if .empty? end |
#render_tag_clouds(resource) ⇒ Object
14 15 16 17 18 |
# File 'app/helpers/lcms/engine/tags_helper.rb', line 14 def render_tag_clouds(resource) = resource. render partial: 'lcms/engine/resources/tags', locals: { tag_clouds: tag_clouds(), color_code: color_code(resource) } end |
#tag_clouds(named_tags) ⇒ Object
20 21 22 23 |
# File 'app/helpers/lcms/engine/tags_helper.rb', line 20 def tag_clouds() [:ell_appropriate] = [:ell_appropriate] ? 'ELL Appropriate' : nil .transform_values { |v| Array.wrap(v).flatten.compact.uniq.sort } end |