add and use pandora.getEditTooltip (fixes #1276)

This commit is contained in:
rolux 2013-03-01 09:21:39 +05:30
parent 7e0f26864b
commit 971ef8d016
10 changed files with 47 additions and 42 deletions

View File

@ -227,7 +227,7 @@ pandora.ui.listInfo = function() {
)
)
},
tooltip: editable ? 'Doubleclick to edit title' : '',
tooltip: editable ? pandora.getEditTooltip('title') : '',
value: item.name,
width: pandora.user.ui.sidebarSize - 32
})
@ -268,7 +268,7 @@ pandora.ui.listInfo = function() {
placeholder: editable
? '<div class="OxLight" style="text-align: center">No description</span>'
: '',
tooltip: editable ? 'Doubleclick to edit description' : '',
tooltip: editable ? pandora.getEditTooltip('description') : '',
type: 'textarea',
value: item.description,
width: pandora.user.ui.sidebarSize - 32

View File

@ -152,7 +152,7 @@ pandora.ui.infoView = function(data) {
format: function(value) {
return formatTitle(value);
},
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
value: data.title
})
.css({
@ -187,7 +187,7 @@ pandora.ui.infoView = function(data) {
return formatValue(value.split(', '), 'name');
},
placeholder: formatLight('Unknown Director'),
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
value: data.director ? data.director.join(', ') : ''
})
.css({
@ -225,7 +225,7 @@ pandora.ui.infoView = function(data) {
return formatValue(value.split(', '), key)
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: key == 'country'
? (data[key] ? data[key].join(', ') : [''])
: data[key] || ''
@ -286,7 +286,7 @@ pandora.ui.infoView = function(data) {
return formatValue(value.split(', '), key)
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: key == 'episodeDirector'
? (data[key] ? data[key].join(', ') : [''])
: data[key] || ''
@ -554,7 +554,7 @@ pandora.ui.infoView = function(data) {
clickLink: pandora.clickLink,
height: 128,
placeholder: formatLight('No notes'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
type: 'textarea',
value: data.notes,
width: 128

View File

@ -167,7 +167,7 @@ pandora.ui.infoView = function(data) {
format: function(value) {
return formatTitle(value);
},
tooltip: canEdit ? getTooltip : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: data.title
})
.css({
@ -201,7 +201,7 @@ pandora.ui.infoView = function(data) {
return formatLink(value.split(', '), 'name');
},
placeholder: formatLight('Unknown Director'),
tooltip: canEdit ? getTooltip : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: data.director ? data.director.join(', ') : ''
})
.css({
@ -250,7 +250,7 @@ pandora.ui.infoView = function(data) {
clickLink: pandora.clickLink,
editable: canEdit,
placeholder: formatLight('No Summary'),
tooltip: canEdit ? getTooltip : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: data.summary || ''
})
@ -386,8 +386,9 @@ pandora.ui.infoView = function(data) {
.append(formatKey('Notes', 'statistics'))
.append(
Ox.EditableContent({
clickLink: pandora.clickLink
placeholder: formatLight('No notes'),
tooltip: getTooltip,
tooltip: pandora.getEditTooltip(),
type: 'textarea',
value: data.notes,
width: 128
@ -584,12 +585,6 @@ pandora.ui.infoView = function(data) {
return studios;
}
function getTooltip(e) {
var $target = $(e.target);
return $target.is('a') || $target.parents('a').length
? 'Shift+doubleclick to edit' : 'Doubleclick to edit';
}
function getValue(key, value) {
return !value ? ''
: key == 'alternativeTitles' ? value.map(function(value) {
@ -699,7 +694,7 @@ pandora.ui.infoView = function(data) {
clickLink: pandora.clickLink,
editable: canEdit,
placeholder: formatLight('No Description'),
tooltip: canEdit ? getTooltip : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: value.description || ''
})
@ -746,7 +741,7 @@ pandora.ui.infoView = function(data) {
return formatValue(key, value);
},
placeholder: formatLight('unknown'),
tooltip: canEdit ? getTooltip : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: getValue(key, data[key])
})
.bindEvent({

View File

@ -146,7 +146,7 @@ pandora.ui.infoView = function(data) {
.append(
Ox.Editable({
editable: canEdit,
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: data.title
})
.css({
@ -183,7 +183,7 @@ pandora.ui.infoView = function(data) {
? value.split(', ') : value, key);
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
@ -223,7 +223,7 @@ pandora.ui.infoView = function(data) {
return formatValue(value.split(', '), 'name');
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
@ -262,7 +262,7 @@ pandora.ui.infoView = function(data) {
editable: canEdit,
maxHeight: Infinity,
placeholder: formatLight('No Summary'),
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: data.summary || '',
//width: 300
@ -337,7 +337,7 @@ pandora.ui.infoView = function(data) {
Ox.Editable({
placeholder: key == 'groups' ? formatLight('No Groups') : '',
editable: canEdit,
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: key == 'user' ? data[key] : data[key].join(', ')
})
.bindEvent({
@ -385,7 +385,7 @@ pandora.ui.infoView = function(data) {
Ox.Editable({
height: 128,
placeholder: formatLight('No notes'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
type: 'textarea',
value: data.notes,
width: 128

View File

@ -172,7 +172,7 @@ pandora.ui.infoView = function(data) {
},
placeholder: formatLight('unknown'),
editable: canEdit,
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
@ -192,7 +192,7 @@ pandora.ui.infoView = function(data) {
clickLink: pandora.clickLink,
placeholder: formatLight('No ' + Ox.toTitleCase(key) + ' Description'),
editable: canEdit,
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: data[key + 'description'] || ''
})
@ -220,7 +220,7 @@ pandora.ui.infoView = function(data) {
.append(
Ox.Editable({
editable: canEdit,
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: data.title
})
.css({
@ -257,7 +257,7 @@ pandora.ui.infoView = function(data) {
? value.split(', ') : value, key);
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
@ -296,7 +296,7 @@ pandora.ui.infoView = function(data) {
return formatValue(value.split(', '), 'name');
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
@ -337,7 +337,7 @@ pandora.ui.infoView = function(data) {
return formatValue(value.split(', '), key);
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
@ -365,7 +365,7 @@ pandora.ui.infoView = function(data) {
editable: canEdit,
maxHeight: Infinity,
placeholder: formatLight('No Summary'),
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: data.summary || ''
})
@ -393,7 +393,7 @@ pandora.ui.infoView = function(data) {
.appendTo($div);
Ox.Editable({
placeholder: formatLight('No License'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
value: (data.license || []).join(', ')
})
.bindEvent({
@ -471,7 +471,7 @@ pandora.ui.infoView = function(data) {
Ox.Editable({
placeholder: key == 'groups' ? formatLight('No Groups') : '',
editable: canEdit,
tooltip: canEdit ? 'Doubleclick to edit' : '',
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: key == 'user' ? data[key] : data[key].join(', ')
})
.bindEvent({
@ -519,7 +519,7 @@ pandora.ui.infoView = function(data) {
Ox.Editable({
height: 128,
placeholder: formatLight('No notes'),
tooltip: 'Doubleclick to edit',
tooltip: pandora.getEditTooltip(),
type: 'textarea',
value: data.notes,
width: 128

View File

@ -69,7 +69,7 @@ pandora.ui.news = function(width, height) {
index = Ox.getIndexById(items, selected);
$title = Ox.Editable({
editable: isEditable,
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
value: items[index].title
})
.css({
@ -91,7 +91,7 @@ pandora.ui.news = function(width, height) {
format: function(value) {
return Ox.formatDate(value, '%B %e, %Y');
},
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
value: items[index].date
})
.css({
@ -112,7 +112,7 @@ pandora.ui.news = function(width, height) {
editable: isEditable,
maxHeight: height - 96,
placeholder: 'No text',
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
type: 'textarea',
value: items[index].text,
width: width - 512

View File

@ -44,7 +44,7 @@ pandora.ui.siteDialog = function(section) {
Ox.Editable({
clickLink: pandora.clickLink,
editable: isEditable,
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
type: 'textarea',
placeholder: isEditable ? 'Doubleclick to insert text' : '',
value: result.data.text

View File

@ -43,7 +43,7 @@ pandora.ui.siteDialog = function(section) {
Ox.Editable({
clickLink: pandora.clickLink,
editable: isEditable,
tooltip: isEditable ? 'Doubleclick to edit' : '',
tooltip: isEditable ? pandora.getEditTooltip() : '',
type: 'textarea',
placeholder: isEditable ? 'Doubleclick to insert text' : '',
value: result.data.text

View File

@ -225,7 +225,7 @@ pandora.ui.textHTML = function(text) {
editable: text.editable,
height: 32,
placeholder: text.editable ? 'Doubleclick to edit title' : 'Untitled',
tooltip: text.editable ? 'Doubleclick to edit title' : '',
tooltip: text.editable ? pandora.getEditTooltip('title') : '',
value: text.name,
width: width
})
@ -275,7 +275,7 @@ pandora.ui.textHTML = function(text) {
},
maxHeight: height - 1,
placeholder: text.editable ? 'Doubleclick to edit text' : '',
tooltip: text.editable ? 'Doubleclick to edit text' : '',
tooltip: text.editable ? pandora.getEditTooltip('text') : '',
type: 'textarea',
width: width,
value: text.text

View File

@ -593,6 +593,16 @@ pandora.getClipsQuery = function() {
};
}());
pandora.getEditTooltip = function(title) {
return function(e) {
var $target = $(e.target);
return (
$target.is('a') || $target.parents('a').length
? 'Shift+doubleclick to edit' : 'Doubleclick to edit';
) + (title ? ' ' + title : '');
}
};
pandora.getFilterSizes = function() {
return Ox.splitInt(
window.innerWidth