Commit a7534820 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Remove new-methods icons from API overview page.

Leave just small stars behind new classes.  This way it's lot
less cluttered.

The new "New in this version" section covers the details of
what's new much better and doesn't get on the way.
parent 0f731957
Loading
Loading
Loading
Loading
+2 −26
Original line number Diff line number Diff line
@@ -26,35 +26,11 @@ module JsDuck
    # Adds small star to new classes in the current version.
    def render_new_label(cls)
      if cls[:meta][:new]
        "&nbsp;<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' : ''}"
          "&nbsp;<span class='new-members' title='#{title}'>#{stars(n)}</span>"
        "&nbsp;<span class='new-class' title='New class'>&#9733;</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
        "&#9733;" * 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[:meta][:new] && !m[:private] }.length
    end

  end

+4 −6
Original line number Diff line number Diff line
@@ -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; } } } }