Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[enhance] plugins: simplified bootstrap-modal plugin

  • Loading branch information...
commit 361c585c847cc986d2fb51a0c40c605681346be3 1 parent a344bbf
@Aqua-Ye Aqua-Ye authored
View
18 lib/plugins/bootstrap-modal/modal.js
@@ -10,20 +10,21 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/** @opaType Modal.options */
+
/**
- * @register {string, bool, bool, bool, bool -> void}
+ * @register {string, Modal.options -> void}
*/
-function init(sel, backdrop, static_bd, keyboard, show) {
- var bd = backdrop;
- if (static_bd) {
+function init(sel, options) {
+ var bd = options.backdrop;
+ if (options.static_bd) {
bd = 'static';
}
$(sel).modal({
"backdrop": bd,
- "keyboard": keyboard,
- "show": show
+ "keyboard": options.keyboard,
+ "show": options.show
});
- return js_void;
}
/**
@@ -31,7 +32,6 @@ function init(sel, backdrop, static_bd, keyboard, show) {
*/
function toggle(sel) {
$(sel).modal('toggle');
- return js_void;
}
/**
@@ -39,7 +39,6 @@ function toggle(sel) {
*/
function show(sel) {
$(sel).modal('show');
- return js_void;
}
/**
@@ -47,6 +46,5 @@ function show(sel) {
*/
function hide(sel) {
$(sel).modal('hide');
- return js_void;
}
View
2  lib/stdlib/widgets/bootstrap/modal/modal.opa
@@ -65,7 +65,7 @@ Modal = {{
</div>
init(dom:dom, options:Modal.options) =
- (%%modal.init%%)(Dom.to_string(dom), options.backdrop, options.static, options.keyboard, options.show)
+ (%%modal.init%%)(Dom.to_string(dom), options)
toggle(dom:dom) =
(%%modal.toggle%%)(Dom.to_string(dom))

0 comments on commit 361c585

Please sign in to comment.
Something went wrong with that request. Please try again.