forked from ethereum/meteor-package-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ethelements.js
60 lines (52 loc) · 1.38 KB
/
ethelements.js
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
50
51
52
53
54
55
56
57
58
59
60
/**
Template Controllers
@module Packages
*/
/**
Helper elements for ethereum dapps
@class [packages] ethereum:elements
@constructor
*/
EthElements = {
Modal: {
_current: new ReactiveVar(),
/**
Shows the modal template
@method show
@param {String|Object} template the template name or an object with `{template: 'name', data: {data: 'context'}}`
@param {Object} options the options for the modal like `{closeable: true, closePath: '/dashboard'}`
*/
show: function(template, options) {
options = options || {};
if (_.isObject(template)) {
options = _.extend(options, template);
this._current.set(options);
} else if (_.isString(template)) {
options.template = template;
this._current.set(options);
}
},
/**
Hide the modal template
@method hide
*/
hide: function() {
this._current.set(false);
},
/**
Show the question modal
@method question.show
@param {Object} data the data for the modal question template
@param {Object} options the options for the modal like `{closeable: true, closePath: '/dahsboard'}`
*/
question: function(data, options) {
EthElements.Modal.show(
{
template: "dapp_modal_question",
data: data
},
options
);
}
}
};