better author formatting in info panel

This commit is contained in:
rlx 2016-01-14 14:55:14 +05:30
parent d3de45766d
commit 2ad1e64208
2 changed files with 12 additions and 1 deletions

View file

@ -51,7 +51,7 @@ oml.ui.info = function() {
$('<div>') $('<div>')
.addClass('OxSelectable') .addClass('OxSelectable')
.css({fontWeight: 'bold'}) .css({fontWeight: 'bold'})
.text((data.author || []).join(', ')) .text(oml.formatAuthor(data.author))
.appendTo(that); .appendTo(that);
$('<div>') $('<div>')
.addClass('OxSelectable') .addClass('OxSelectable')

View file

@ -582,6 +582,17 @@ oml.enableDragAndDrop = function($list, canMove) {
}; };
oml.formatAuthor = function(author) {
var isEditor = false;
return (author || []).map(function(value) {
if (Ox.endsWith(value, ' (Ed.)')) {
isEditor = true;
value = value.slice(0, -6);
}
return value;
}).join(', ') + (isEditor ? ' (Ed.)' : '');
};
oml.getEditTooltip = function(title) { oml.getEditTooltip = function(title) {
return function(e) { return function(e) {
var $target = $(e.target); var $target = $(e.target);