Skip to content

Commit

Permalink
fix(schedule): replace flag unicode values by images (#139)
Browse files Browse the repository at this point in the history
* ugly fix(schedule): replace flag unicode values by images
- only works for "en" language
- if the event contains a language property different than "en", the flag will be shown
* refactor(schedule): prevent displaying lang image if event.language is different than "en"

#136
  • Loading branch information
kcmr authored and jorgecasar committed Oct 15, 2016
1 parent bc2b45c commit 5fb6d18
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Binary file added src/images/flag-en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 21 additions & 7 deletions src/views/polymerday-schedule/polymerday-schedule-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@

.title {
margin: 0 0 9px;
display: -ms-flexbox;
display: flex;
-ms-flex-align: baseline;
align-items: baseline;
}

.title__image {
margin-right: 10px;
}

.subtitle {
Expand Down Expand Up @@ -102,7 +110,12 @@

<div class="header">
<header class="header__title">
<h2 class="title item-title">[[_getLanguageIcon(event.language)]][[event.name]]</h2>
<h2 class="title item-title">
<template is="dom-if" if="[[_getForeignLanguage(event.language)]]">
<img class="title__image" src$="[[_getLanguageFlag(event.language)]]" width="24" alt$="[[_getForeignLanguage(event.language)]]">
</template>
<span>[[event.name]]</span>
</h2>
<p class="subtitle item-subtitle">[[event.speaker]]</p>
</header>

Expand Down Expand Up @@ -178,15 +191,16 @@ <h2 class="title item-title">[[_getLanguageIcon(event.language)]][[event.name]]<
return this._parseTimeToCEST(dateStart) + ' - ' + this._parseTimeToCEST(dateEnd);
},

_getLanguageIcon: function(language) {
_getForeignLanguage: function(language) {
return language === 'en' ? language : undefined;
},

_getLanguageFlag: function(language) {
if (language === 'en') {
return '🇺🇸 ';
} else if (language === 'es') {
return '🇪🇸 ';
} else {
return undefined;
return this.resolveUrl('../../images/flag-en.png');
}
}

});
</script>
</dom-module>

0 comments on commit 5fb6d18

Please sign in to comment.