cleanup, rafatoring and minor fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-11-26 19:42:08 +04:00
parent 5f7e89409c
commit b51448a78c
2 changed files with 24 additions and 22 deletions

View File

@ -579,31 +579,27 @@ var FIELD_TYPES = {
t = t == '' ? Math.random()+'' : t t = t == '' ? Math.random()+'' : t
var item = field.find('.item').last() var item = field.find('.item').last()
for(var i=0; i < value.length; i++){ for(var i=0; i < value.length; i++){
var txt = value[i]
// get options... // get options...
var opts = txt.split(/\|/g) var opts = value[i]
txt = opts[0].trim() .split(/\|/g)
opts = opts
.slice(1)
.map(function(e){ return e.trim() }) .map(function(e){ return e.trim() })
var val = item.find('.value') var val = item.find('.value')
val.val(txt) val.val(opts[0])
// set checked state... // set checked state...
if(opts.indexOf('default') >= 0){ if(opts.slice(1).indexOf('default') >= 0){
val.prop('checked', true) val.prop('checked', true)
opts.splice(opts.indexOf('default'), 1) opts.splice(opts.indexOf('default'), 1)
} else { } else {
val.prop('checked', false) val.prop('checked', false)
} }
txt = item.find('.item-text') var txt = item.find('.item-text')
.html(txt) .html(opts[0])
// tooltip... // tooltip...
if(opts.length > 0){ if(opts.length > 1){
$('<span class="tooltip-icon tooltip-right"> *</span>') $('<span class="tooltip-icon tooltip-right"> *</span>')
.attr('tooltip', opts.pop()) .attr('tooltip', opts.pop())
.appendTo(txt) .appendTo(txt)
@ -834,16 +830,20 @@ function formDialog(root, message, config, btn, cls){
// NOTE: if first element is a radio button set, focus the checked // NOTE: if first element is a radio button set, focus the checked
// element, else focus the first input... // element, else focus the first input...
form.ready(function(){ form.ready(function(){
var elem = form.find('.field input').first() // NOTE: we are using a timeout to avoid the user input that opened
if(elem.attr('type') == 'radio'){ // the dialog to end up in the first field...
form.find('.field input:checked') setTimeout(function(){
.focus() var elem = form.find('.field input').first()
.select() if(elem.attr('type') == 'radio'){
} else { form.find('.field input:checked')
elem .focus()
.focus() .select()
.select() } else {
} elem
.focus()
.select()
}
}, 100)
}) })
return res return res

View File

@ -137,7 +137,9 @@ function recentlyOpenedDialog(){
updateStatus('Recently opened...').show() updateStatus('Recently opened...').show()
var dict = {} var dict = {}
var title = '<b>Recently opened:</b>' var title = '<b>Recently opened:</b> | '+
'Shortcuts ctrl-shift-Left and ctrl-shift-Right can be used\n'+
'to move through this list from ribbon view.'
var cfg = {} var cfg = {}
cfg[title] = BASE_URL_HISTORY.map(function(e){ cfg[title] = BASE_URL_HISTORY.map(function(e){