module LibrariesHelper def show_library_tags(library, opts = {}) html = '' library.library_tags.each do |tag| klass = "edu-filter-btn fl cdefault #{library_tag_class(tag)} #{opts[:class]}" html += content_tag(:span, tag.name, class: klass) end raw html end def library_tag_class(tag) case tag.name when '获奖案例' then 'edu-activity-red' when '入库案例' then 'edu-activity-blue' end end end