Commit 205b9b6e authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Render all member labels in dropdown menus.

Refactored handling of required configs.  They now have required=true,
instead of former optional=false which was a bit awequard.
parent 92f9f337
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ module JsDuck

    def compact_member(m)
      m_copy = {}
      [:name, :tagname, :owner, :protected, :static, :deprecated, :required].each do |key|
      [:name, :tagname, :owner, :protected, :static, :deprecated, :required, :template].each do |key|
        m_copy[key] = m[key]
      end
      m_copy
+3 −3
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ module JsDuck
        :owner => detect_owner(doc_map) || owner,
        :type => detect_type(:cfg, doc_map, code),
        :doc => detect_doc(docs),
        :optional => detect_optional(:cfg, doc_map),
        :required => detect_required(:cfg, doc_map),
        :default => detect_default(:cfg, doc_map, code),
        :properties => detect_subproperties(docs, :cfg),
        :accessor => !!doc_map[:accessor],
@@ -294,9 +294,9 @@ module JsDuck
      return explicit_name == "" || explicit_name == implicit_name
    end

    def detect_optional(tagname, doc_map)
    def detect_required(tagname, doc_map)
      main_tag = doc_map[tagname] ? doc_map[tagname].first : {}
      return main_tag[:optional] != false
      return main_tag[:optional] == false
    end

    # for detecting mixins and alternateClassNames
+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ module JsDuck
      if m[:deprecated]
        after += "<strong class='deprecated-signature'>deprecated</strong>"
      end
      if m[:tagname] == :cfg && !m[:optional]
      if m[:required]
        after += "<strong class='required-signature'>required</strong>"
      end
      if m[:template]
+4 −4
Original line number Diff line number Diff line
@@ -360,8 +360,8 @@ describe JsDuck::Aggregator do
         */
      EOS
    end
    it "is optional by default" do
      @doc[:optional].should == true
    it "is not required by default" do
      @doc[:required].should == false
    end
  end

@@ -373,8 +373,8 @@ describe JsDuck::Aggregator do
         */
      EOS
    end
    it "has optional flag set to false" do
      @doc[:optional].should == false
    it "has required flag set to true" do
      @doc[:required].should == true
    end
  end

+6 −5
Original line number Diff line number Diff line
@@ -46,11 +46,12 @@ Ext.define('Docs.view.HoverMenu', {
                columnHeight: this.columnHeight,
                showCloseButtons: this.showCloseButtons,
                renderLink: function(values) {
                    var url = values.url || values.cls,
                        label = values.label || values.cls,
                        stat = values['static'] ? '<span class="static">static</span>' : "",
                        prot = values['protected'] ? '<span class="protected">protected</span>' : "";
                    return Ext.String.format('<a href="#!/api/{0}" rel="{0}" class="docClass">{1} {2} {3}</a>', url, label, stat, prot);
                    var url = values.url || values.cls;
                    var label = values.label || values.cls;
                    var tags = Ext.Array.map(['static', 'protected', 'deprecated', 'template', 'required'], function(tag) {
                        return values[tag] ? '<span class="'+tag+'">'+tag+'</span>' : '';
                    }).join(' ');
                    return Ext.String.format('<a href="#!/api/{0}" rel="{0}" class="docClass">{1} {2}</a>', url, label, tags);
                }
            }
        );
Loading