Commit 5abd55eb authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Add all three visibility levels to members show/hide menu.

So we can now toggle public/protected/private separately.
parent 657bdeeb
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -83,10 +83,7 @@ Ext.define('Docs.view.cls.Overview', {

        Docs.Syntax.highlight(this.getEl());

        var hide = Docs.Settings.get("hide");
        if (hide.inherited || hide.accessors || hide.privates) {
            this.filterMembers("", hide);
        }
        this.filterMembers("", Docs.Settings.get("hide"));

        this.fireEvent('afterload');
    },
@@ -114,11 +111,14 @@ Ext.define('Docs.view.cls.Overview', {
        var re = new RegExp(Ext.String.escapeRegex(search), "i");
        this.eachMember(function(m) {
            var el = Ext.get(m.id);
            var byInheritance = !hide.inherited || (m.owner === this.docClass.name);
            var byAccessor = !hide.accessors || m.tagname !== 'method' || !this.accessors.hasOwnProperty(m.name);
            var byPrivate = !hide.privates || !m.meta['private'];
            var byFilter = !isSearch || re.test(m.name);
            if (byInheritance && byFilter && byAccessor && byPrivate) {
            var visible = (!hide.publics || (m.meta['private'] || m.meta['protected']))
                       && (!hide.protecteds || !m.meta['protected'])
                       && (!hide.privates || !m.meta['private'])
                       && (!hide.inherited || (m.owner === this.docClass.name))
                       && (!hide.accessors || m.tagname !== 'method' || !this.accessors.hasOwnProperty(m.name))
                       && (!isSearch || re.test(m.name));

            if (visible) {
                el.setStyle({display: 'block'});
            }
            else {
+26 −9
Original line number Diff line number Diff line
@@ -76,6 +76,14 @@ Ext.define('Docs.view.cls.Toolbar', {
            this.items.push(this.createClassListButton("Mixed Into", this.docClass.mixedInto));
        }

        this.checkItems = {
            publics: this.createCb("Public", "publics"),
            protecteds: this.createCb("Protected", "protecteds"),
            privates: this.createCb("Private", "privates"),
            inherited: this.createCb("Inherited", "inherited"),
            accessors: this.createCb("Accessors", "accessors")
        };

        var self = this;
        this.items = this.items.concat([
            { xtype: 'tbspacer', width: 10 },
@@ -110,9 +118,12 @@ Ext.define('Docs.view.cls.Toolbar', {
                xtype: 'button',
                text: 'Show',
                menu: [
                    this.hideInherited = this.createCb("Inherited", "inherited"),
                    this.hideAccessors = this.createCb("Accessors", "accessors"),
                    this.hidePrivates  = this.createCb("Private", "privates")
                    this.checkItems.publics,
                    this.checkItems.protecteds,
                    this.checkItems.privates,
                    '-',
                    this.checkItems.inherited,
                    this.checkItems.accessors
                ]
            },
            {
@@ -132,11 +143,11 @@ Ext.define('Docs.view.cls.Toolbar', {
    },

    getHideFlags: function() {
        return {
            inherited: !this.hideInherited.checked,
            accessors: !this.hideAccessors.checked,
            privates: !this.hidePrivates.checked
        };
        var flags = {};
        for (var i in this.checkItems) {
            flags[i] = !this.checkItems[i].checked;
        }
        return flags;
    },

    createCb: function(text, type) {
@@ -215,7 +226,13 @@ Ext.define('Docs.view.cls.Toolbar', {
                var store = this.memberButtons[type].getStore();
                if (hide.inherited || hide.accessors || hide.privates) {
                    store.filterBy(function(m) {
                        return !(hide.inherited && m.get("inherited") || hide.accessors && m.get("accessor") || hide.privates && m.get("meta")["private"]);
                        return !(
                            hide.publics && !(m.get("meta")["private"] || m.get("meta")["protected"]) ||
                            hide.protecteds && m.get("meta")["protected"] ||
                            hide.privates && m.get("meta")["private"] ||
                            hide.inherited && m.get("inherited") ||
                            hide.accessors && m.get("accessor")
                        );
                    });
                }
                else {