mirror of
https://github.com/discourse/discourse.git
synced 2025-06-09 06:18:14 +08:00
UX: Allow for customization of the heart icon
This commit is contained in:
@ -9,6 +9,8 @@ const REPLACEMENTS = {
|
|||||||
'd-watching-first': 'dot-circle-o',
|
'd-watching-first': 'dot-circle-o',
|
||||||
'd-drop-expanded': 'caret-down',
|
'd-drop-expanded': 'caret-down',
|
||||||
'd-drop-collapsed': 'caret-right',
|
'd-drop-collapsed': 'caret-right',
|
||||||
|
'd-unliked': 'heart',
|
||||||
|
'd-liked': 'heart',
|
||||||
'notification.mentioned': "at",
|
'notification.mentioned': "at",
|
||||||
'notification.group_mentioned': "at",
|
'notification.group_mentioned': "at",
|
||||||
'notification.quoted': "quote-right",
|
'notification.quoted': "quote-right",
|
||||||
|
@ -35,10 +35,11 @@ registerButton('like', attrs => {
|
|||||||
|
|
||||||
const button = {
|
const button = {
|
||||||
action: 'like',
|
action: 'like',
|
||||||
icon: 'heart',
|
icon: attrs.liked ? 'd-liked' : 'd-unliked',
|
||||||
className
|
className
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (attrs.canToggleLike) {
|
if (attrs.canToggleLike) {
|
||||||
button.title = attrs.liked ? 'post.controls.undo_like' : 'post.controls.like';
|
button.title = attrs.liked ? 'post.controls.undo_like' : 'post.controls.like';
|
||||||
} else if (attrs.liked) {
|
} else if (attrs.liked) {
|
||||||
@ -368,7 +369,7 @@ export default createWidget('post-menu', {
|
|||||||
return this.sendWidgetAction('toggleLike');
|
return this.sendWidgetAction('toggleLike');
|
||||||
}
|
}
|
||||||
|
|
||||||
const $heart = $(`[data-post-id=${attrs.id}] .d-icon-heart`);
|
const $heart = $(`[data-post-id=${attrs.id}] .toggle-like .d-icon`);
|
||||||
$heart.closest('button').addClass('has-like');
|
$heart.closest('button').addClass('has-like');
|
||||||
|
|
||||||
if (!Ember.testing) {
|
if (!Ember.testing) {
|
||||||
|
Reference in New Issue
Block a user