From: rabuzarus <> Date: Mon, 17 Oct 2016 20:51:51 +0000 (+0200) Subject: frio: events - don't show author name if there is no author name X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=967c3b3deb89a88275e55f7f972516a07ab07391;p=friendica.git frio: events - don't show author name if there is no author name --- diff --git a/view/theme/frio/js/mod_events.js b/view/theme/frio/js/mod_events.js index 7b06990fad..4e900d06ca 100644 --- a/view/theme/frio/js/mod_events.js +++ b/view/theme/frio/js/mod_events.js @@ -131,16 +131,14 @@ function eventHoverBodyTemplate() {
\
\ \ - {6}\ - {7}\ + {5}\ + {6}\ \
\
\ -
{3}
\ -
{5}{4}\ -
\ - {2}\ -
\ +
{2}
\ +
{4}{3}\ + {1}\
\
\
\ @@ -156,9 +154,17 @@ function eventHoverLocationTemplate() { return template; } +function eventHoverProfileNameTemplate() { + var template = '\ +
\ + {1}\ +
'; + return template; +} // transform the event data to html so we can use it in the event hover-card function eventHoverHtmlContent(event) { var eventLocation = ''; + var eventProfileName = ''; // Get the Browser language var locale = window.navigator.userLanguage || window.navigator.language; var data = ''; @@ -176,7 +182,7 @@ function eventHoverHtmlContent(event) { var endTime = moment(event.item.finish).format('HH:mm'); var monthNumber; - var formattedDate = startDate + var formattedDate = startDate; // We only need the to format the end date if the event does have // a finish date. @@ -195,8 +201,8 @@ function eventHoverHtmlContent(event) { // Get the html template data = eventHoverBodyTemplate(); - // Get only template data if there exist location data - if (event.item.location != '') { + // Get only template data if there exists location data + if (event.item.location) { var eventLocationText = formatEventLocationText(event.item.location); // Get the the html template for formatting the location var eventLocationTemplate = eventHoverLocationTemplate(); @@ -207,11 +213,21 @@ function eventHoverHtmlContent(event) { ); } + // Get only template data if there exists a profile name + if (event.item['author-name']) { + // Get the template + var eventProfileNameTemplate = eventHoverProfileNameTemplate(); + // Insert the data into the template + eventProfileName = eventProfileNameTemplate.format( + event.item['author-link'], + event.item['author-name'] + ); + } + // Format the event data according to the event hover template var formatted = data.format( event.item['author-avatar'], // this isn't used at the present time - event.item['author-link'], - event.item['author-name'], + eventProfileName, event.title, eventLocation, formattedDate,