Permalink
Browse files

[enhance] plugins: simplified bootstrap-modal plugin

  • Loading branch information...
1 parent a344bbf commit 361c585c847cc986d2fb51a0c40c605681346be3 @Aqua-Ye Aqua-Ye committed Jan 11, 2013
Showing with 9 additions and 11 deletions.
  1. +8 −10 lib/plugins/bootstrap-modal/modal.js
  2. +1 −1 lib/stdlib/widgets/bootstrap/modal/modal.opa
@@ -10,43 +10,41 @@
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;
}
/**
* @register {string -> void}
*/
function toggle(sel) {
$(sel).modal('toggle');
- return js_void;
}
/**
* @register {string -> void}
*/
function show(sel) {
$(sel).modal('show');
- return js_void;
}
/**
* @register {string -> void}
*/
function hide(sel) {
$(sel).modal('hide');
- return js_void;
}
@@ -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.