From 163a7a47f9bb5a4ec8c939f9e3ed67d4c0123d0f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 9 May 2014 17:09:06 +0200 Subject: Add prompt dialog to OC.dialogs --- core/js/oc-dialogs.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'core') diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 11833f12e2d..3e45e3789d2 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -61,6 +61,65 @@ var OCdialogs = { confirm:function(text, title, callback, modal) { this.message(text, title, 'notice', OCdialogs.YES_NO_BUTTONS, callback, modal); }, + /** + * displays prompt dialog + * @param text content of dialog + * @param title dialog title + * @param callback which will be triggered when user presses YES or NO + * (true or false would be passed to callback respectively) + * @param modal make the dialog modal + * @param name name of the input field + * @param password wether the input should be a password input + */ + prompt: function (text, title, callback, modal, name, password) { + $.when(this._getMessageTemplate()).then(function ($tmpl) { + var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content'; + var dialogId = '#' + dialogName; + var $dlg = $tmpl.octemplate({ + dialog_name: dialogName, + title : title, + message : text, + type : 'notice' + }); + var input = $(''); + input.attr('type', password ? 'password' : 'text').attr('id', dialogName + '-input'); + var label = $('