Sha256: 68f6dd31ed387abe2d61a0cc6922f88becebb9b030601fabe3d8d24f14569e51

Contents?: true

Size: 1.93 KB

Versions: 228

Compression:

Stored size: 1.93 KB

Contents

/**
* @ngdoc directive
* @name Bastion.components.directive:bookmark
*
* @requires BstBookmark
*
* @description
* Provides the bookmarked items for a dropdown menu
*/
angular.module('Bastion.components').directive('bstBookmark', ['BstBookmark', function (BstBookmark) {
    return {
        scope: {
            controllerName: '=',
            query: '='
        },
        templateUrl: 'components/views/bst-bookmark.html',
        controller: ['$scope', 'translate', function ($scope, translate) {
            $scope.newBookmark = {};

            $scope.load = function () {
                BstBookmark.queryPaged({search: 'controller=' + $scope.controllerName}, function (response) {
                    $scope.bookmarks = response.results;
                });
            };

            $scope.add = function () {
                if (angular.isDefined($scope.query)) {
                    $scope.newBookmark.query = $scope.query.trim();
                }
                $scope.openModal();
            };

            $scope.save = function () {
                var params, success, error;

                params = {
                    name: $scope.newBookmark.name,
                    query: $scope.newBookmark.query,
                    public: $scope.newBookmark.public,
                    controller: $scope.controllerName
                };

                success = function () {
                    $scope.bookmarks = $scope.load();
                    $scope.$parent.successMessages = [translate('Bookmark was successfully created.')];
                };

                error = function (response) {
                    $scope.$parent.errorMessages = [response.data.error.full_messages];
                };

                BstBookmark.create(params, success, error);
            };

            $scope.setQuery = function (bookmark) {
                $scope.query = bookmark.query;
            };

            $scope.load();
        }]
    };
}]);

Version data entries

228 entries across 228 versions & 2 rubygems

Version Path
katello-4.3.1 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.4.0 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.4.0.rc2 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.4.0.rc1 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.2.2 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.3.0 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.3.0.rc4 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.3.0.rc3 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.3.0.rc2.1 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.3.0.rc2 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.3.0.rc1 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.2.1 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.2.0.1 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.1.4 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.0.3 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.2.0.1.rc3 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-3.18.5 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.2.0.1.rc2 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.2.0.rc2 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js
katello-4.1.3 engines/bastion/app/assets/javascripts/bastion/components/bst-bookmark.directive.js