Sha256: e51525ec9ae18dd2ab40b93866a11fb8c476d4233a87b8b9a440766c1b5a5cae

Contents?: true

Size: 1.91 KB

Versions: 165

Compression:

Stored size: 1.91 KB

Contents

/**
 * @ngdoc object
 * @name  Bastion.content-views.controller:ErrataFilterController
 *
 * @requires $scope
 *
 * @description
 *   Provides common functionality on the $scope for Errata filters.
 */
angular.module('Bastion.content-views').controller('ErrataFilterController',
    ['$scope', function ($scope) {
        $scope.rule = {
            errataType: 'all',
            'start_date': null,
            'end_date': null,
            'date_type': "updated"
        };

        $scope.date = {
            startOpen: false,
            endOpen: false
        };

        $scope.types = {
            enhancement: true,
            bugfix: true,
            security: true
        };

        $scope.errataFilter = function (errata) {
            var include = false,
                issued = new Date(errata.issued);

            if ($scope.types[errata.type]) {
                include = true;
            }

            if ($scope.rule['start_date']) {
                include = include && (issued.getTime() >= $scope.rule['start_date'].getTime());
            }

            if ($scope.rule['end_date']) {
                include = include && (issued.getTime() <= $scope.rule['end_date'].getTime());
            }

            return include;
        };

        $scope.openEndDate = function ($event) {
            $event.preventDefault();
            $event.stopPropagation();

            $scope.date.endOpen = true;
            $scope.date.startOpen = false;
        };

        $scope.openStartDate = function ($event) {
            $event.preventDefault();
            $event.stopPropagation();

            $scope.date.startOpen = true;
            $scope.date.endOpen = false;
        };

        $scope.onlySelected = function (object, type) {
            var selected = _.filter(object, function (value) {
                return value;
            });

            return object[type] && (selected.length === 1);
        };

    }]
);

Version data entries

165 entries across 165 versions & 1 rubygems

Version Path
katello-3.17.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.18.0.rc2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.18.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.17.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.18.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.17.0.rc2.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.17.0.rc2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.1.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.17.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.17.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.0.rc5.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.0.rc5 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.0.rc4.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.15.3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.15.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.16.0.rc4 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js