Commit 6058326e authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Move styling of rounded tag description boxes to Tag classes.

Introduce .rounded-box CSS class for the generic rounded style.
Then add additional classes to the actual divs to apply custom
styles through @css attribute.
parent a30f3eaa
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -4,7 +4,15 @@ module JsDuck::Tag
  class Deprecated < DeprecatedTag
    def initialize
      @tagname = :deprecated
      @css = ".signature .deprecated { background-color: #aa0000 }" # red
      @css = <<-EOCSS
        .signature .deprecated {
          background-color: #aa0000;
        }
        .deprecated-box strong {
          color: white;
          background-color: #aa0000;
        }
      EOCSS
      super
    end
  end
+13 −1
Original line number Diff line number Diff line
@@ -10,6 +10,18 @@ module JsDuck::Tag
        @pattern = @tagname.to_s
        @signature = {:long => @tagname.to_s, :short => @tagname.to_s[0..2].upcase}
        @html_position = POS_DEPRECATED
        @css += <<-EOCSS
          .deprecated-tag-box {
            text-align: center;
            color: #600;
            background-color: #fee;
          }
          .deprecated-tag-box strong {
            text-transform: uppercase;
            border-radius: 2px;
            padding: 0 3px;
          }
        EOCSS
      end
    end

@@ -35,7 +47,7 @@ module JsDuck::Tag
      depr = context[@tagname]
      v = depr[:version] ? "since " + depr[:version] : ""
      <<-EOHTML
        <div class='signature-box #{@tagname}'>
        <div class='rounded-box #{@tagname}-box deprecated-tag-box'>
        <p>This #{context[:tagname]} has been <strong>#{@tagname}</strong> #{v}</p>
        #{depr[:text]}
        </div>
+3 −1
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ module JsDuck::Tag
      @tagname = :preventable
      @signature = {:long => "preventable", :short => "PREV"}
      @html_position = POS_PREVENTABLE
      # Use the default white box with dark gray border.
      @css = ".preventable-box { text-align: center }"
    end

    # @preventable is optionally followed by some method name, but we
@@ -25,7 +27,7 @@ module JsDuck::Tag

    def to_html(context)
      <<-EOHTML
        <div class='signature-box preventable'>
        <div class='rounded-box preventable-box'>
        <p>This action following this event is <b>preventable</b>.
        When any of the listeners returns false, the action is cancelled.</p>
        </div>
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,12 @@ module JsDuck::Tag
          border: 1px solid #aa0000;
          text-decoration: line-through;
        }
        .removed-box strong {
          color: #aa0000;
          border: 1px solid #aa0000;
          background-color: transparent;
          text-decoration: line-through;
        }
      EOCSS
      super
    end
+8 −1
Original line number Diff line number Diff line
@@ -6,12 +6,19 @@ module JsDuck::Tag
      @pattern = "template"
      @signature = {:long => "template", :short => "TMP"}
      @html_position = POS_TEMPLATE
      # Box with light gray background
      @css = <<-EOCSS
        .template-box {
          text-align: center;
          background-color: #eee;
        }
      EOCSS
      super
    end

    def to_html(context)
      <<-EOHTML
      <div class='signature-box template'>
      <div class='rounded-box template-box'>
      <p>This is a <a href="#!/guide/components">template method</a>.
         a hook into the functionality of this class.
         Feel free to override it in child classes.</p>
Loading