publish-deny-modal-directive.js 1.1 KB
Newer Older
L
lepdou 已提交
1 2 3 4 5 6 7 8 9
directive_module.directive('publishdenymodal', publishDenyDirective);

function publishDenyDirective(AppUtil, EventManager) {
    return {
        restrict: 'E',
        templateUrl: '../../views/component/publish-deny-modal.html',
        transclude: true,
        replace: true,
        scope: {
L
lepdou 已提交
10
            env: "="
L
lepdou 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24
        },
        link: function (scope) {
            var MODAL_ID = "#publishDenyModal";

            EventManager.subscribe(EventManager.EventType.PUBLISH_DENY, function (context) {
                scope.toReleaseNamespace = context.namespace;
                scope.mergeAndPublish = !!context.mergeAndPublish;
                AppUtil.showModal(MODAL_ID);
            });

            scope.emergencyPublish = emergencyPublish;

            function emergencyPublish() {
                AppUtil.hideModal(MODAL_ID);
L
lepdou 已提交
25 26

                EventManager.emit(EventManager.EventType.EMERGENCY_PUBLISH,
27 28 29 30
                    {
                        mergeAndPublish: scope.mergeAndPublish,
                        namespace: scope.toReleaseNamespace
                    });
L
lepdou 已提交
31 32 33 34 35 36 37

            }
        }
    }
}