Loading lib/jsduck/examples.rb +5 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,11 @@ module JsDuck JsonDuck.write_json(dir+"/examples.json", @groups) end # Extracts example icon URL from example hash def icon_url(example) @opts.examples_base_url + example["icon"] end end end lib/jsduck/guides.rb +6 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,12 @@ module JsDuck </div> EOHTML end # Extracts guide icon URL from guide hash def icon_url(guide) "guides/" + guide["name"] + "/icon-lg.png" end end end lib/jsduck/tag/aside.rb +19 −10 Original line number Diff line number Diff line Loading @@ -36,24 +36,33 @@ module JsDuck::Tag def to_html(asides) asides.map do |aside| asset = get_asset(aside[:type], aside[:name]) type = aside[:type] name = aside[:name] assets_group = get_assets_group(type) asset = assets_group[name] if asset url = "#!/#{aside[:type]}/#{aside[:name]}" heading = aside[:type].to_s.capitalize url = "#!/#{type}/#{name}" heading = type.to_s.capitalize title = asset["title"] "<div class='aside #{aside[:type]}'><h4>#{heading}</h4><p><a href='#{url}'>#{title}</a></p></div>" icon_url = assets_group.icon_url(asset) <<-EOHTML <div class='aside #{type}'> <h4>#{heading}</h4> <p><a href='#{url}'><img src='#{icon_url}' alt=''> #{title}</a></p> </div> EOHTML else warn("Unknown @aside name: #{aside[:type]} #{aside[:name]}") warn("Unknown @aside name: #{type} #{name}") end end.compact end def get_asset(type, name) def get_assets_group(type) case type when :guide then @assets.guides[name] when :video then @assets.videos[name] when :example then @assets.examples[name] else nil when :guide then @assets.guides when :video then @assets.videos when :example then @assets.examples else {} end end Loading lib/jsduck/videos.rb +5 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ module JsDuck JsonDuck.write_json(dir+"/videos.json", @groups) end # Extracts video icon URL from video hash def icon_url(video) video["thumb"] end end end template/resources/sass/_class_overview.scss +5 −1 Original line number Diff line number Diff line Loading @@ -27,12 +27,16 @@ background: none; padding-left: 15px; } } } .aside { width: 150px; width: 180px; h4 { margin: 4px 0; font-size: larger; color: #526c83; padding-left: 22px; } img { width: 50px; float: left; margin-right: 10px; } &.guide h4 { background: url(../images/tabs.png) no-repeat -5px -55px; } &.video h4 { Loading Loading
lib/jsduck/examples.rb +5 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,11 @@ module JsDuck JsonDuck.write_json(dir+"/examples.json", @groups) end # Extracts example icon URL from example hash def icon_url(example) @opts.examples_base_url + example["icon"] end end end
lib/jsduck/guides.rb +6 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,12 @@ module JsDuck </div> EOHTML end # Extracts guide icon URL from guide hash def icon_url(guide) "guides/" + guide["name"] + "/icon-lg.png" end end end
lib/jsduck/tag/aside.rb +19 −10 Original line number Diff line number Diff line Loading @@ -36,24 +36,33 @@ module JsDuck::Tag def to_html(asides) asides.map do |aside| asset = get_asset(aside[:type], aside[:name]) type = aside[:type] name = aside[:name] assets_group = get_assets_group(type) asset = assets_group[name] if asset url = "#!/#{aside[:type]}/#{aside[:name]}" heading = aside[:type].to_s.capitalize url = "#!/#{type}/#{name}" heading = type.to_s.capitalize title = asset["title"] "<div class='aside #{aside[:type]}'><h4>#{heading}</h4><p><a href='#{url}'>#{title}</a></p></div>" icon_url = assets_group.icon_url(asset) <<-EOHTML <div class='aside #{type}'> <h4>#{heading}</h4> <p><a href='#{url}'><img src='#{icon_url}' alt=''> #{title}</a></p> </div> EOHTML else warn("Unknown @aside name: #{aside[:type]} #{aside[:name]}") warn("Unknown @aside name: #{type} #{name}") end end.compact end def get_asset(type, name) def get_assets_group(type) case type when :guide then @assets.guides[name] when :video then @assets.videos[name] when :example then @assets.examples[name] else nil when :guide then @assets.guides when :video then @assets.videos when :example then @assets.examples else {} end end Loading
lib/jsduck/videos.rb +5 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ module JsDuck JsonDuck.write_json(dir+"/videos.json", @groups) end # Extracts video icon URL from video hash def icon_url(video) video["thumb"] end end end
template/resources/sass/_class_overview.scss +5 −1 Original line number Diff line number Diff line Loading @@ -27,12 +27,16 @@ background: none; padding-left: 15px; } } } .aside { width: 150px; width: 180px; h4 { margin: 4px 0; font-size: larger; color: #526c83; padding-left: 22px; } img { width: 50px; float: left; margin-right: 10px; } &.guide h4 { background: url(../images/tabs.png) no-repeat -5px -55px; } &.video h4 { Loading