Sha256: c071a1d7765cfdb30a3ae71d069c462f8c5235a3b1150480ff6d5983a19258f4
Contents?: true
Size: 1.21 KB
Versions: 16
Compression:
Stored size: 1.21 KB
Contents
require 'jsduck/member_registry' require 'fileutils' module JsDuck module Web # Manages member icons. # Generating CSS for them and coping the image files over to output dir. class MemberIcons # Generates CSS for member icons def self.css css = [] members_with_icons.each do |m| name = m[:name] rule = ".icon-#{name} { background-image: url(member-icons/#{name}.png); background-repeat: no-repeat; }" css << "#search-dropdown #{rule}" css << ".members .members-section #{rule}" css << ".members .comments-section #{rule}" css << ".class-overview .x-toolbar.member-links #{rule}" end css.join("\n") end # Copies all member icons to given destination dir. def self.write(dir) FileUtils.mkdir(dir) members_with_icons.each do |m| if File.exists?(m[:icon]) FileUtils.cp(m[:icon], "#{dir}/#{m[:name]}.png") else Logger.warn(nil, "Member icon file not found", {:filename => m[:icon]}) end end end def self.members_with_icons MemberRegistry.definitions.find_all {|m| m[:icon] } end end end end
Version data entries
16 entries across 16 versions & 3 rubygems