Class: JsDuck::Web::MemberIcons
- Inherits:
-
Object
- Object
- JsDuck::Web::MemberIcons
- Defined in:
- lib/jsduck/web/member_icons.rb
Overview
Manages member icons. Generating CSS for them and coping the image files over to output dir.
Class Method Summary collapse
-
.css ⇒ Object
Generates CSS for member icons.
- .members_with_icons ⇒ Object
-
.write(dir) ⇒ Object
Copies all member icons to given destination dir.
Class Method Details
.css ⇒ Object
Generates CSS for member icons
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jsduck/web/member_icons.rb', line 11 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 |
.members_with_icons ⇒ Object
37 38 39 |
# File 'lib/jsduck/web/member_icons.rb', line 37 def self.members_with_icons TagRegistry.member_types.find_all {|m| m[:icon] } end |
.write(dir) ⇒ Object
Copies all member icons to given destination dir.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jsduck/web/member_icons.rb', line 25 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", m[:icon]) end end end |