-
Notifications
You must be signed in to change notification settings - Fork 0
/
underkick_modalComponent.js
29 lines (27 loc) · 1.48 KB
/
underkick_modalComponent.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
//////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017 Polydojo, Inc. //
// //
// This Source Code Form is subject to the terms of the Mozilla Public //
// License, v. 2.0. If a copy of the MPL was not distributed with this //
// file, You can obtain one at http://mozilla.org/MPL/2.0/. //
// //
//////////////////////////////////////////////////////////////////////////////
// TODO: Add UMD support.
var underkick_modalComponent = function (uk, $, _) {
"use strict";
uk.modalComponent = function (id, submodel, bootboxConfig) {
var bootbox;
if (! uk.config.bootbox) {
throw new Error("underkick_modalComponent: Bootbox not found. Should be supplied via underkick({.. 'bootbox': bootbox, ...})");
}
bootbox = uk.config.bootbox;
// ==> `bootbox` is available.
bootboxConfig = bootboxConfig || {};
return bootbox.dialog(_.extend({}, {
"message": uk.component(id, submodel),
"onEscape": true, // 'esc' key => close.
"backdrop": true, // Click outside => close. (This depends on 'onEscape' being truthy. See docs for more.)
}, bootboxConfig));
};
};