uses es6 shorthands

This commit is contained in:
Joffrey JAFFEUX 2017-07-19 12:17:03 +02:00
parent 0b98bfe1dc
commit 9956a58df0
1 changed files with 7 additions and 19 deletions

View File

@ -58,14 +58,10 @@ export default Ember.Component.extend({
selectedDiversityChanged() { selectedDiversityChanged() {
keyValueStore.setObject({key: EMOJI_SELECTED_DIVERSITY, value: this.get("selectedDiversity")}); keyValueStore.setObject({key: EMOJI_SELECTED_DIVERSITY, value: this.get("selectedDiversity")});
$.each($list.find(".emoji.diversity[src!='']"), (_, icon) => { $.each($list.find(".emoji.diversity[src!='']"), (_, icon) => this._setIconSrc(icon, true) );
this._updateIconSrc(icon, true);
});
if(this.get("filter") !== "") { if(this.get("filter") !== "") {
$.each($results.find(".emoji.diversity"), (_, icon) => { $.each($results.find(".emoji.diversity"), (_, icon) => this._setIconSrc(icon, true) );
this._updateIconSrc(icon, true);
});
} }
}, },
@ -139,9 +135,7 @@ export default Ember.Component.extend({
}, },
_bindModalClick() { _bindModalClick() {
$modal.on("click", () => { $modal.on("click", () => this.set("active", false));
this.set("active", false);
});
}, },
_unbindEvents() { _unbindEvents() {
@ -204,9 +198,7 @@ export default Ember.Component.extend({
}, },
_bindHover($hoverables) { _bindHover($hoverables) {
const replaceInfoContent = (html) => { const replaceInfoContent = (html) => $picker.find(".footer .info").html(html || "");
$picker.find(".footer .info").html(html || "");
};
($hoverables || $list.find(".section-group")).on({ ($hoverables || $list.find(".section-group")).on({
mouseover: (event) => { mouseover: (event) => {
@ -214,9 +206,7 @@ export default Ember.Component.extend({
const html = `<img src="${emojiUrlFor(code)}" class="emoji"> <span>:${code}:<span>`; const html = `<img src="${emojiUrlFor(code)}" class="emoji"> <span>:${code}:<span>`;
replaceInfoContent(html); replaceInfoContent(html);
}, },
mouseleave: () => { mouseleave: () => replaceInfoContent()
replaceInfoContent();
}
}, "a"); }, "a");
}, },
@ -371,9 +361,7 @@ export default Ember.Component.extend({
}, },
_loadVisibleEmojis($visibleEmojis) { _loadVisibleEmojis($visibleEmojis) {
$.each($visibleEmojis, (_, icon) => { $.each($visibleEmojis, (_, icon) => this._setIconSrc(icon) );
this._updateIconSrc(icon);
});
}, },
_codeWithDiversity(code, diversity) { _codeWithDiversity(code, diversity) {
@ -430,7 +418,7 @@ export default Ember.Component.extend({
return this._codeWithDiversity(title, $img.hasClass("diversity")); return this._codeWithDiversity(title, $img.hasClass("diversity"));
}, },
_updateIconSrc(icon, diversity) { _setIconSrc(icon, diversity) {
const $icon = $(icon); const $icon = $(icon);
const code = this._codeWithDiversity( const code = this._codeWithDiversity(
$icon.parent().attr("title"), $icon.parent().attr("title"),