From e463273901b3eaf4c40bbe76c9df53fee460e783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bartelme=C3=9F?= Date: Sun, 25 Mar 2012 15:48:31 +0200 Subject: [PATCH] added UI to for unnamed authors --- src/static/css/timeslider.css | 5 +++++ src/static/js/broadcast_slider.js | 27 +++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/static/css/timeslider.css b/src/static/css/timeslider.css index 4dfff42e..2179c940 100644 --- a/src/static/css/timeslider.css +++ b/src/static/css/timeslider.css @@ -116,6 +116,11 @@ padding-right: 0.4em; } +#authorsList .author-anonymous { + padding-left: 0.6em; + padding-right: 0.6em; +} + #padeditor { position: static; } diff --git a/src/static/js/broadcast_slider.js b/src/static/js/broadcast_slider.js index 9aceb733..a2a15773 100644 --- a/src/static/js/broadcast_slider.js +++ b/src/static/js/broadcast_slider.js @@ -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 = $('').text(author.name || "unnamed").css('background-color', authorColor).addClass('author'); - authorsList.append(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(' '); + $(' ') + .css('background-color', color) + .addClass('author author-anonymous') + .appendTo(authorsList); + }); + authorsList.append(')'); + } + } if (authors.length == 0) {