Sha256: 092836d8597f7adbd52fc3f088474135327460633ec48b9c0de81bd56618413d

Contents?: true

Size: 1.54 KB

Versions: 236

Compression:

Stored size: 1.54 KB

Contents

/**
 * @ngdoc directive
 * @name Bastion.components.directive:title
 *
 * @requires PageTitle
 *
 * @description
 *   Provides a way to set the title of the page.
 */
angular.module('Bastion.components').directive('pageTitle', ['PageTitle', function (PageTitle) {
    return {
        templateUrl: '',
        replace: true,
        transclude: true,
        require: '?ngModel',
        scope: {
            modelName: '@ngModel'
        },
        compile: function (element, attrs, transclude) {
            var title;

            return function (scope, iElem, iAttrs, ngModel) {
                var unbind;

                transclude(scope, function (clone) {
                    title = clone.text();
                });

                if (ngModel) {
                    unbind = scope.$watch(function () {
                        return ngModel.$viewValue;
                    }, function (model) {
                        unbind();
                        if (model.hasOwnProperty('$promise')) {
                            model.$promise.then(function (data) {
                                scope[scope.modelName] = data;
                                PageTitle.setTitle(title, scope);
                            });
                        } else {
                            scope[scope.modelName] = model;
                            PageTitle.setTitle(title, scope);
                        }
                    });
                } else {
                    PageTitle.setTitle(title, scope);
                }
            };
        }
    };
}]);

Version data entries

236 entries across 236 versions & 2 rubygems

Version Path
katello-4.14.2 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.15.0 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.15.0.rc2 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.15.0.rc1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.14.1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.14.0 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.14.0.rc3 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.14.0.rc2 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.14.0.rc1.1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.14.0.rc1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.13.1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.13.0 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.12.1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.13.0.rc1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.12.0 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.12.0.rc3 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.12.0.rc2 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.12.0.rc1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.11.1 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js
katello-4.11.0 engines/bastion/app/assets/javascripts/bastion/components/page-title.directive.js