Loading template/app/view/cls/Overview.js +23 −6 Original line number Diff line number Diff line Loading @@ -70,10 +70,13 @@ Ext.define('Docs.view.cls.Overview', { docClass: this.docClass, listeners: { hideInherited: function(hideInherited) { this.filterMembers(this.toolbar.getFilterValue(), hideInherited); this.filterMembers(this.toolbar.getFilterValue(), hideInherited, Docs.Settings.get("hideAccessors")); }, hideAccessors: function(hideAccessors) { this.filterMembers(this.toolbar.getFilterValue(), Docs.Settings.get("hideInherited"), hideAccessors); }, filter: function(search) { this.filterMembers(search, Docs.Settings.get("hideInherited")); this.filterMembers(search, Docs.Settings.get("hideInherited"), Docs.Settings.get("hideAccessors")); }, scope: this } Loading @@ -84,8 +87,8 @@ Ext.define('Docs.view.cls.Overview', { Docs.Syntax.highlight(this.getEl()); if (Docs.Settings.get("hideInherited")) { this.filterMembers("", true); if (Docs.Settings.get("hideInherited") || Docs.Settings.get("hideAccessors")) { this.filterMembers("", Docs.Settings.get("hideInherited"), Docs.Settings.get("hideAccessors")); } this.fireEvent('afterload'); Loading @@ -95,10 +98,12 @@ Ext.define('Docs.view.cls.Overview', { * Filters members by search string and inheritance. * @param {String} search * @param {Boolean} hideInherited * @param {Boolean} hideAccessors * @private */ filterMembers: function(search, hideInherited) { filterMembers: function(search, hideInherited, hideAccessors) { Docs.Settings.set("hideInherited", hideInherited); Docs.Settings.set("hideAccessors", hideAccessors); var isSearch = search.length > 0; // Hide the class documentation when filtering Loading @@ -108,15 +113,27 @@ Ext.define('Docs.view.cls.Overview', { // Hide members who's name doesn't match with the search string // and hide inherited members if hideInherited=true // and hide accessor methods when hideAccessors=true var re = new RegExp(Ext.String.escapeRegex(search), "i"); if (hideAccessors) { // build map of all possible accessor method names var accessors = {}; Ext.Array.forEach(this.docClass.members.cfg, function(m) { var capName = Ext.String.capitalize(m.name); accessors["get"+capName] = true; accessors["set"+capName] = true; }); } this.eachMember(function(m) { var el = Ext.get(m.id); var byInheritance = !hideInherited || (m.owner === this.docClass.name); var byAccessor = !hideAccessors || m.tagname !== 'method' || !accessors.hasOwnProperty(m.name); var byFilter = !isSearch || re.test(m.name); if (byInheritance && byFilter) { if (byInheritance && byFilter && byAccessor) { el.setStyle({display: 'block'}); } else { console.log(m.name); el.setStyle({display: 'none'}); } }, this); Loading template/app/view/cls/Toolbar.js +18 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,12 @@ Ext.define('Docs.view.cls.Toolbar', { * @param {Boolean} hide True when inherited items should get hidden. */ "hideInherited", /** * @event hideAccessors * Fires when hideAccessors checkbox toggled. * @param {Boolean} hide True when accessor methods should get hidden. */ "hideAccessors", /** * @event filter * Fires when text typed to filter. Loading Loading @@ -115,6 +121,18 @@ Ext.define('Docs.view.cls.Toolbar', { }, scope: this }, { boxLabel: 'Hide accessors', boxLabelAlign: 'before', xtype: 'checkbox', margin: '0 5 0 0', padding: '0 0 5 0', checked: Docs.Settings.get("hideAccessors"), handler: function(el) { this.fireEvent("hideAccessors", el.checked); }, scope: this }, { xtype: 'button', iconCls: 'expand-all-members', Loading Loading
template/app/view/cls/Overview.js +23 −6 Original line number Diff line number Diff line Loading @@ -70,10 +70,13 @@ Ext.define('Docs.view.cls.Overview', { docClass: this.docClass, listeners: { hideInherited: function(hideInherited) { this.filterMembers(this.toolbar.getFilterValue(), hideInherited); this.filterMembers(this.toolbar.getFilterValue(), hideInherited, Docs.Settings.get("hideAccessors")); }, hideAccessors: function(hideAccessors) { this.filterMembers(this.toolbar.getFilterValue(), Docs.Settings.get("hideInherited"), hideAccessors); }, filter: function(search) { this.filterMembers(search, Docs.Settings.get("hideInherited")); this.filterMembers(search, Docs.Settings.get("hideInherited"), Docs.Settings.get("hideAccessors")); }, scope: this } Loading @@ -84,8 +87,8 @@ Ext.define('Docs.view.cls.Overview', { Docs.Syntax.highlight(this.getEl()); if (Docs.Settings.get("hideInherited")) { this.filterMembers("", true); if (Docs.Settings.get("hideInherited") || Docs.Settings.get("hideAccessors")) { this.filterMembers("", Docs.Settings.get("hideInherited"), Docs.Settings.get("hideAccessors")); } this.fireEvent('afterload'); Loading @@ -95,10 +98,12 @@ Ext.define('Docs.view.cls.Overview', { * Filters members by search string and inheritance. * @param {String} search * @param {Boolean} hideInherited * @param {Boolean} hideAccessors * @private */ filterMembers: function(search, hideInherited) { filterMembers: function(search, hideInherited, hideAccessors) { Docs.Settings.set("hideInherited", hideInherited); Docs.Settings.set("hideAccessors", hideAccessors); var isSearch = search.length > 0; // Hide the class documentation when filtering Loading @@ -108,15 +113,27 @@ Ext.define('Docs.view.cls.Overview', { // Hide members who's name doesn't match with the search string // and hide inherited members if hideInherited=true // and hide accessor methods when hideAccessors=true var re = new RegExp(Ext.String.escapeRegex(search), "i"); if (hideAccessors) { // build map of all possible accessor method names var accessors = {}; Ext.Array.forEach(this.docClass.members.cfg, function(m) { var capName = Ext.String.capitalize(m.name); accessors["get"+capName] = true; accessors["set"+capName] = true; }); } this.eachMember(function(m) { var el = Ext.get(m.id); var byInheritance = !hideInherited || (m.owner === this.docClass.name); var byAccessor = !hideAccessors || m.tagname !== 'method' || !accessors.hasOwnProperty(m.name); var byFilter = !isSearch || re.test(m.name); if (byInheritance && byFilter) { if (byInheritance && byFilter && byAccessor) { el.setStyle({display: 'block'}); } else { console.log(m.name); el.setStyle({display: 'none'}); } }, this); Loading
template/app/view/cls/Toolbar.js +18 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,12 @@ Ext.define('Docs.view.cls.Toolbar', { * @param {Boolean} hide True when inherited items should get hidden. */ "hideInherited", /** * @event hideAccessors * Fires when hideAccessors checkbox toggled. * @param {Boolean} hide True when accessor methods should get hidden. */ "hideAccessors", /** * @event filter * Fires when text typed to filter. Loading Loading @@ -115,6 +121,18 @@ Ext.define('Docs.view.cls.Toolbar', { }, scope: this }, { boxLabel: 'Hide accessors', boxLabelAlign: 'before', xtype: 'checkbox', margin: '0 5 0 0', padding: '0 0 5 0', checked: Docs.Settings.get("hideAccessors"), handler: function(el) { this.fireEvent("hideAccessors", el.checked); }, scope: this }, { xtype: 'button', iconCls: 'expand-all-members', Loading