Skip to content

Commit

Permalink
grunted
Browse files Browse the repository at this point in the history
  • Loading branch information
adamschwartz committed Sep 22, 2013
1 parent a5b507a commit db4b5ce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
16 changes: 16 additions & 0 deletions js/vex.dialog.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
(function() {
var $formToObject, dialog;

if (!window.vex) {
return $.error('Vex is required to use vex.dialog');
}

$formToObject = function($form) {
var object;
object = {};
Expand All @@ -18,7 +20,9 @@
});
return object;
};

dialog = {};

dialog.buttons = {
YES: {
text: 'OK',
Expand All @@ -35,6 +39,7 @@
}
}
};

dialog.defaultOptions = {
callback: function(value) {
if (console && console.log) {
Expand All @@ -58,13 +63,16 @@
},
focusFirstInput: true
};

dialog.defaultAlertOptions = {
message: 'Alert',
buttons: [dialog.buttons.YES]
};

dialog.defaultConfirmOptions = {
message: 'Confirm'
};

dialog.open = function(options) {
var $vexContent;
options = $.extend({}, vex.defaultOptions, dialog.defaultOptions, options);
Expand All @@ -78,6 +86,7 @@
}
return $vexContent;
};

dialog.alert = function(options) {
if (typeof options === 'string') {
options = {
Expand All @@ -87,13 +96,15 @@
options = $.extend({}, vex.dialog.defaultAlertOptions, options);
return vex.dialog.open(options);
};

dialog.confirm = function(options) {
if (typeof options === 'string') {
return $.error('vex.dialog.confirm(options) requires options.callback.');
}
options = $.extend({}, vex.dialog.defaultConfirmOptions, options);
return vex.dialog.open(options);
};

dialog.prompt = function(options) {
var defaultPromptOptions;
if (typeof options === 'string') {
Expand All @@ -106,6 +117,7 @@
options = $.extend({}, defaultPromptOptions, options);
return vex.dialog.open(options);
};

dialog.buildDialogForm = function(options) {
var $form, $input, $message;
$form = $('<form class="vex-dialog-form" />');
Expand All @@ -114,6 +126,7 @@
$form.append($message.append(options.message)).append($input.append(options.input)).append(dialog.buttonsToDOM(options.buttons)).bind('submit.vex', options.onSubmit);
return $form;
};

dialog.getFormValueOnSubmit = function(formData) {
if (formData.vex) {
if (formData.vex === '_vex-empty-value') {
Expand All @@ -124,6 +137,7 @@
return formData;
}
};

dialog.buttonsToDOM = function(buttons) {
var $buttons;
$buttons = $('<div class="vex-dialog-buttons" />');
Expand All @@ -136,5 +150,7 @@
});
return $buttons;
};

window.vex.dialog = dialog;

}).call(this);
2 changes: 1 addition & 1 deletion js/vex.dialog.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions js/vex.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
(function() {
var $, animationEndSupport, vex;

$ = jQuery;

animationEndSupport = false;

$(function() {
var s;
s = (document.body || document.documentElement).style;
Expand All @@ -12,6 +15,7 @@
}
});
});

vex = {
globalID: 1,
animationEndEvent: 'animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend',
Expand Down Expand Up @@ -163,5 +167,7 @@
return $('body').append("<div class=\"vex-loading-spinner " + vex.defaultOptions.className + "\"></div>");
}
};

window.vex = vex;

}).call(this);
4 changes: 2 additions & 2 deletions js/vex.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit db4b5ce

Please sign in to comment.