From 3ca6cc783588072703d49c2c7acf58e3a2eba9c9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 12 Jun 2013 14:45:48 +0400 Subject: [PATCH] started work on a generic dialog... Signed-off-by: Alex A. Naanou --- ui/ui.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/ui/ui.js b/ui/ui.js index 9980c6a4..94503f6d 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -441,6 +441,80 @@ function confirm(){ */ +var FIELD_TYPES = { + text: { + type: 'text', + text: null, + default: '', + html: '
'+ + ''+ + ''+ + '
', + setter: function(field){ + $(field).find('.value').attr('value', this.default) + }, + getter: function(field){ + return $(field).find('.value').attr('value') + }, + }, + bool: { + type: 'text', + text: null, + default: false, + html: '
'+ + ''+ + ''+ + '
', + setter: function(field){ + if(this.default){ + $(field).find('.value').attr('checked', '') + } else { + $(field).find('.value').removeAttr('checked') + } + }, + getter: function(field){ + return $(field).find('.value').attr('value') + }, + }, +} + +// Show a complex dialog +// +// config format: +// { +// // simple field... +// : , +// +// : { +// type: , +// text: , +// default: , +// +// // field code... +// // NOTE: class names "text" and "value" get their text +// // replaced with values set in text and default fields +// // respectively... +// html: , +// +// // used on dialog creation to init default value... +// setter: , +// +// // used on dialog submit to get the field value... +// getter: , +// }, +// ... +// } +// +// field's default value determines it's type: +// bool - checkbox +// string - textarea +// array - dropdown +// +// XXX find a better name... +function promptPlus(message, config, btn){ +} + + /************************************************ Specific dialogs ***/ function showImageInfo(){