Sha256: 65c5f4ecc12526a24aaae688d09861e0e615597dffdefdf9548e012832140c2d

Contents?: true

Size: 1.98 KB

Versions: 22

Compression:

Stored size: 1.98 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,
            '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

22 entries across 22 versions & 1 rubygems

Version Path
katello-3.3.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.3.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.2.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.1.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.1.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.1.0.rc2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.1.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.0.rc7 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.0.rc5 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.0.rc4 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js
katello-3.0.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js