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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -225,7 +225,7 @@ pandora.ui.textHTML = function(text) {
editable: text.editable, editable: text.editable,
height: 32, height: 32,
placeholder: text.editable ? 'Doubleclick to edit title' : 'Untitled', placeholder: text.editable ? 'Doubleclick to edit title' : 'Untitled',
tooltip: text.editable ? 'Doubleclick to edit title' : '', tooltip: text.editable ? pandora.getEditTooltip('title') : '',
value: text.name, value: text.name,
width: width width: width
}) })
@ -275,7 +275,7 @@ pandora.ui.textHTML = function(text) {
}, },
maxHeight: height - 1, maxHeight: height - 1,
placeholder: text.editable ? 'Doubleclick to edit text' : '', placeholder: text.editable ? 'Doubleclick to edit text' : '',
tooltip: text.editable ? 'Doubleclick to edit text' : '', tooltip: text.editable ? pandora.getEditTooltip('text') : '',
type: 'textarea', type: 'textarea',
width: width, width: width,
value: text.text 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() { pandora.getFilterSizes = function() {
return Ox.splitInt( return Ox.splitInt(
window.innerWidth window.innerWidth