Class: JsDuck::Web::ClassIcons
- Inherits:
-
Object
- Object
- JsDuck::Web::ClassIcons
- Defined in:
- lib/jsduck/web/class_icons.rb
Class Method Summary collapse
-
.css ⇒ Object
Generates CSS for class icons.
-
.get(cls) ⇒ Object
Returns CSS class name for an icon of class.
-
.write(dir) ⇒ Object
Copies all class icons to given destination dir.
Class Method Details
.css ⇒ Object
Generates CSS for class icons
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jsduck/web/class_icons.rb', line 21 def css css = [] class_icon_providers.each do |tag| css << <<-EOCSS #center-container h1.icon-#{tag.tagname} .class-source-link { background: url(class-icons/#{tag.tagname}-large.png) no-repeat 0 -5px; } #treecontainer .x-grid-cell-inner .icon-#{tag.tagname} { background: url(class-icons/#{tag.tagname}.png) no-repeat; } #search-dropdown .icon-#{tag.tagname} { background: url(class-icons/#{tag.tagname}.png) no-repeat; } #search-dropdown .icon-#{tag.tagname}-redirect { background: url(class-icons/#{tag.tagname}-redirect.png) no-repeat; } .doctabs .icon-#{tag.tagname} { background: url(class-icons/#{tag.tagname}.png) no-repeat; } EOCSS end css.join("\n") end |
.get(cls) ⇒ Object
Returns CSS class name for an icon of class
10 11 12 13 14 15 16 17 18 |
# File 'lib/jsduck/web/class_icons.rb', line 10 def get(cls) class_icon_providers.each do |tag| if cls[tag.tagname] return "icon-#{tag.tagname}" end end return "icon-class" end |
.write(dir) ⇒ Object
Copies all class icons to given destination dir.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/jsduck/web/class_icons.rb', line 41 def write(dir) FileUtils.mkdir(dir) icons = {} class_icon_providers.each do |tag| icons[tag.class_icon[:small]] = "#{dir}/#{tag.tagname}.png" icons[tag.class_icon[:large]] = "#{dir}/#{tag.tagname}-large.png" icons[tag.class_icon[:redirect]] = "#{dir}/#{tag.tagname}-redirect.png" end icons.each_pair do |source, target| if File.exists?(source) FileUtils.cp(source, target) else Logger.warn(nil, "Class icon file not found", {:filename => source}) end end end |