Sha256: a9377df111b266d9c8c440f603516c73b50a88c7e3953642bed3ec15424242ad

Contents?: true

Size: 1.5 KB

Versions: 69

Compression:

Stored size: 1.5 KB

Contents

/**
 *@ngdoc service
 *@name Bastion.organizations.service:FencedPages
 *
 *@descriptions
 * Service that keeps track of pages that require an organization to be selected
 */

angular.module('Bastion.organizations').service('FencedPages', ['$state',
    function ($state) {
        var fencedPages = [
            'activation-keys',
            'content-hosts',
            'content-views',
            'docker-tags',
            'errata',
            'content-credentials',
            'host-collections',
            'lifecycle-environments',
            'packages',
            'products',
            'subscriptions',
            'sync-plans',
            'files',
            'debs'
        ];

        function getRootPath(path) {
            var rootPath = null;

            if (path && angular.isString(path)) {
                rootPath = path.replace('_', '-').split('/')[1];
            }
            return rootPath;
        }

        this.addPages = function (pages) {
            fencedPages = _.uniq(fencedPages.concat(pages));
        };

        this.list = function () {
            return fencedPages;
        };

        this.isFenced = function (toState) {
            var stateUrl = $state.href(toState);
            var rootPath;
            if (_.isEmpty(stateUrl)) {
                rootPath = toState.templateUrl.replace('_', '-').split('/')[0];
            } else {
                rootPath = getRootPath(stateUrl);
            }
            return fencedPages.indexOf(rootPath) !== -1;
        };
    }
]);

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
katello-4.10.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.9.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.10.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.10.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.9.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.9.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.7.6 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.9.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.9.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.7.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.7.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.8.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.7.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js
katello-4.7.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js