summaryrefslogtreecommitdiffstats
path: root/install/ui/src/freeipa/facets/ActionMixin.js
blob: 4944c927cac8467bc86d334d96f016515cfe1d4f (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
//
// Copyright (C) 2015  FreeIPA Contributors see COPYING for license
//

define(['dojo/_base/declare',
        '../builder',
        '../facet'
       ],
       function(declare, builder, mod_facet) {


/**
 * Header Mixin
 *
 * Extension of facet - actions
 *
 * @class facets.ActionMixin
 */
var ActionMixin = declare([], {

    /**
     * State object for actions
     * @property {facet.state}
     */
    action_state: null,

    /**
     * Collection of facet actions
     * @property {facet.action_holder}
     */
    actions: null,

    show: function() {
        this.inherited(arguments);
        this.actions.on_load();
    },

    /** Constructor */
    constructor: function(spec) {

        this.action_state = builder.build('', spec.state || {}, {}, { $factory: mod_facet.state });
        this.actions = builder.build('', { actions: spec.actions }, {}, { $factory: mod_facet.action_holder } );
        this.action_state.init(this);
        this.actions.init(this);
    }
});

return ActionMixin;
});