refactor: Clean up timerender.render_date_span().

This commit is contained in:
Steve Howell 2017-06-02 08:50:23 -06:00 committed by Tim Abbott
parent 0aaa182fbe
commit dc2be44daf
1 changed files with 11 additions and 5 deletions

View File

@ -89,12 +89,18 @@ function maybe_add_update_list_entry(needs_update, id, time, time_above) {
function render_date_span(elem, rendered_time, rendered_time_above) { function render_date_span(elem, rendered_time, rendered_time_above) {
elem.text(""); elem.text("");
if (rendered_time_above !== undefined) { if (rendered_time_above !== undefined) {
return elem.append('<i class="date-direction icon-vector-caret-up"></i>' + var pieces = [
rendered_time_above.time_str).append($('<hr class="date-line">')).append( '<i class="date-direction icon-vector-caret-up"></i>',
'<i class="date-direction icon-vector-caret-down"></i>' rendered_time_above.time_str,
+ rendered_time.time_str); '<hr class="date-line">',
'<i class="date-direction icon-vector-caret-down"></i>',
rendered_time.time_str,
];
elem.append(pieces);
return elem;
} }
return elem.append(rendered_time.time_str).attr('title', rendered_time.formal_time_str); elem.append(rendered_time.time_str);
return elem.attr('title', rendered_time.formal_time_str);
} }
// Given an XDate object 'time', return a DOM node that initially // Given an XDate object 'time', return a DOM node that initially