added UI to for unnamed authors

pull/591/head
Matthias Bartelmeß 2012-03-25 15:48:31 +02:00
parent 94a9795a04
commit e463273901
2 changed files with 28 additions and 4 deletions

View File

@ -116,6 +116,11 @@
padding-right: 0.4em;
}
#authorsList .author-anonymous {
padding-left: 0.6em;
padding-right: 0.6em;
}
#padeditor {
position: static;
}

View File

@ -181,20 +181,26 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
authorsList.empty();
var numAnonymous = 0;
var numNamed = 0;
var colorsAnonymous = [];
_.each(authors, function(author)
{
var authorColor = clientVars.colorPalette[author.colorId] || author.colorId;
if (author.name)
{
if (numNamed !== 0) authorsList.append(', ');
var authorColor = clientVars.colorPalette[author.colorId] || author.colorId;
var span = $('<span />').text(author.name || "unnamed").css('background-color', authorColor).addClass('author');
authorsList.append(span);
$('<span />')
.text(author.name || "unnamed")
.css('background-color', authorColor)
.addClass('author')
.appendTo(authorsList);
numNamed++;
}
else
{
numAnonymous++;
if(authorColor) colorsAnonymous.push(authorColor);
}
});
if (numAnonymous > 0)
@ -205,6 +211,19 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
} else {
authorsList.append(anonymousAuthorString);
}
if(colorsAnonymous.length > 0){
authorsList.append(' (');
_.each(colorsAnonymous, function(color, i){
if( i > 0 ) authorsList.append(' ');
$('<span /> ')
.css('background-color', color)
.addClass('author author-anonymous')
.appendTo(authorsList);
});
authorsList.append(')');
}
}
if (authors.length == 0)
{