Loading lib/jsduck/categories/class_name.rb +3 −27 Original line number Diff line number Diff line Loading @@ -26,36 +26,12 @@ module JsDuck # Adds small star to new classes in the current version. def render_new_label(cls) if cls[:new] " <span class='new-class' title='New class'>#{stars(1)}</span>" else n = new_members_count(cls) if n > 0 title = "#{n} new member#{(n>1) ? 's' : ''}" " <span class='new-members' title='#{title}'>#{stars(n)}</span>" if cls[:meta][:new] " <span class='new-class' title='New class'>★</span>" else "" end end end # Produces string of n stars. # First 3 stars are rendered as "<unicode-star>", the following as "+". # At max 15 stars are rendered. def stars(n) if n > 15 stars(3) + ("+" * (15-3)) elsif n > 3 stars(3) + ("+" * (n-3)) else "★" * n end end # Returns number of new members the class has in the current version def new_members_count(cls) cls.find_members(:local => true).find_all {|m| m[:new] && !m[:private] }.length end end Loading template/resources/sass/_categories.scss +4 −6 Original line number Diff line number Diff line Loading @@ -34,12 +34,10 @@ // A list of links .links { margin-left: 1.5em; .new-class, .new-members { .new-class { @include border-radius(2px); padding: 0 0.5em; background: #F5D833; } .new-members { background: #F5D833; position: relative; top: -3px; font-size: 5px; } } } } top: -2px; font-size: 7px; } } } } Loading
lib/jsduck/categories/class_name.rb +3 −27 Original line number Diff line number Diff line Loading @@ -26,36 +26,12 @@ module JsDuck # Adds small star to new classes in the current version. def render_new_label(cls) if cls[:new] " <span class='new-class' title='New class'>#{stars(1)}</span>" else n = new_members_count(cls) if n > 0 title = "#{n} new member#{(n>1) ? 's' : ''}" " <span class='new-members' title='#{title}'>#{stars(n)}</span>" if cls[:meta][:new] " <span class='new-class' title='New class'>★</span>" else "" end end end # Produces string of n stars. # First 3 stars are rendered as "<unicode-star>", the following as "+". # At max 15 stars are rendered. def stars(n) if n > 15 stars(3) + ("+" * (15-3)) elsif n > 3 stars(3) + ("+" * (n-3)) else "★" * n end end # Returns number of new members the class has in the current version def new_members_count(cls) cls.find_members(:local => true).find_all {|m| m[:new] && !m[:private] }.length end end Loading
template/resources/sass/_categories.scss +4 −6 Original line number Diff line number Diff line Loading @@ -34,12 +34,10 @@ // A list of links .links { margin-left: 1.5em; .new-class, .new-members { .new-class { @include border-radius(2px); padding: 0 0.5em; background: #F5D833; } .new-members { background: #F5D833; position: relative; top: -3px; font-size: 5px; } } } } top: -2px; font-size: 7px; } } } }