Sha256: 36c63744d16cb2e12a1759fceeb15291b2c134586fa56b432e2b64cb8c537051

Contents?: true

Size: 1.59 KB

Versions: 36

Compression:

Stored size: 1.59 KB

Contents

/**
 * @ngdoc object
 * @name  Bastion.content-views.controller:NewContentViewController
 *
 * @requires $scope
 * @requires ContentView
 * @requires FormUtils
 * @requires CurrentOrganization
 *
 * @description
 */
angular.module('Bastion.content-views').controller('NewContentViewController',
    ['$scope', 'ContentView', 'FormUtils', 'CurrentOrganization',
    function ($scope, ContentView, FormUtils, CurrentOrganization) {

        function success(response) {
            var successState = 'content-view.repositories.yum.available';

            if (response.composite) {
                successState = 'content-view.components.composite-content-views.available';
            }

            $scope.transitionTo(successState, {contentViewId: response.id});
        }

        function error(response) {
            $scope.working = false;
            angular.forEach(response.data.errors, function (errors, field) {
                $scope.contentViewForm[field].$setValidity('server', false);
                $scope.contentViewForm[field].$error.messages = errors;
            });
        }

        $scope.contentView = new ContentView({'organization_id': CurrentOrganization});
        $scope.createOption = 'new';
        $scope.table = {};

        $scope.save = function (contentView) {
            contentView.$save(success, error);
        };

        $scope.$watch('contentView.name', function () {
            if ($scope.contentViewForm.name) {
                $scope.contentViewForm.name.$setValidity('server', true);
                FormUtils.labelize($scope.contentView);
            }
        });

    }]
);

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
katello-3.5.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.0.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.3.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.4.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.3.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.3.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.3.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js
katello-3.3.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js