Sha256: 81d5889301711e35a51e64e7e7026f818aeb8208801c828c869b608f3268274c

Contents?: true

Size: 1.58 KB

Versions: 9

Compression:

Stored size: 1.58 KB

Contents

/**
 * @ngdoc object
 * @name  Bastion.products.controller:ProductDetailsController
 *
 * @requires $scope
 * @requires $state
 * @requires Product
 *
 * @description
 *   Provides the functionality for the product details action pane.
 */
angular.module('Bastion.products').controller('ProductDetailsController',
    ['$scope', '$state', 'Product', function ($scope, $state, Product) {
        $scope.successMessages = [];
        $scope.errorMessages = [];

        if ($scope.product) {
            $scope.panel = {loading: false};
        } else {
            $scope.panel = {loading: true};
        }

        $scope.product = Product.get({id: $scope.$stateParams.productId}, function () {
            $scope.panel.loading = false;
        });

        $scope.removeProduct = function (product) {
            var id = product.id;

            product.$delete(function (data) {
                $scope.removeRow(id);
                $scope.$emit('productDelete', data.id);
                $scope.transitionTo('products.index');
            });
        };

        $scope.getReadOnlyReason = function (product) {
            var readOnlyReason = null;

            if (product.$resolved) {
                if ($scope.denied('destroy_products', product)) {
                    readOnlyReason = 'permissions';
                } else if (product['published_content_view_ids'].length > 0) {
                    readOnlyReason = 'published';
                } else if (product.redhat) {
                    readOnlyReason = 'redhat';
                }
            }

            return readOnlyReason;
        };
    }]
);

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js
katello-2.4.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js