Sha256: 48c2cbf12c80c8a3e17afb773d85e0337b102bc1dfb9ad705cd661c7f0a0e37e

Contents?: true

Size: 1.95 KB

Versions: 9

Compression:

Stored size: 1.95 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.successMessages = [];
        $scope.errorMessages = [];

        $scope.rule = {
            errataType: 'all',
            'start_date': null,
            'end_date': null
        };

        $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

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-2.4.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js