aboutsummaryrefslogtreecommitdiffstats
path: root/old/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js
blob: de6965d03de79fe2e1f22c9b7272e83ee6c179bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(function() {

    'use strict';

    angular
        .module('moon')
        .controller('MetaRulesEditController', MetaRulesEditController);

    MetaRulesEditController.$inject = ['$scope', '$rootScope'];

    function MetaRulesEditController($scope, $rootScope) {

        var edit = this;

        edit.metaRule = $scope.metaRule;

        activate();

        function activate(){
        }


        /*
         * ---- events
         */
        var rootListeners = {

            'event:metaRuleBasicUpdatedSuccess': $rootScope.$on('event:metaRuleBasicUpdatedSuccess', metaRuleUpdatedSuccess)

        };

        for (var unbind in rootListeners) {
            $scope.$on('$destroy', rootListeners[unbind]);
        }

        /**
         * When the MetaRule is updated, this function refresh the current metaRule with the new changes
         * @param event
         * @param metaRule
         */
        function metaRuleUpdatedSuccess(event, metaRule){

            angular.copy(metaRule, edit.metaRule);

        }

    }

})();