mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 17:05:51 +01:00
fixed fave stars, removed the watch button from normal posts
This commit is contained in:
@@ -538,24 +538,22 @@ define(function() {
|
||||
|
||||
socket.on('api:posts.favourite', function(data) {
|
||||
if (data.status === 'ok' && data.pid) {
|
||||
var favEl = document.querySelector('.post_rep_' + data.pid).nextSibling;
|
||||
if (favEl) {
|
||||
favEl.className = 'fa fa-star';
|
||||
$(favEl).parent()
|
||||
.addClass('btn-warning')
|
||||
.attr('data-favourited', true);
|
||||
var favBtn = $('li[data-pid="' + data.pid + '"] .favourite');
|
||||
if(favBtn.length) {
|
||||
favBtn.addClass('btn-warning')
|
||||
.attr('data-favourited', true)
|
||||
.find('i').attr('class', 'fa fa-star');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('api:posts.unfavourite', function(data) {
|
||||
if (data.status === 'ok' && data.pid) {
|
||||
var favEl = document.querySelector('.post_rep_' + data.pid).nextSibling;
|
||||
if (favEl) {
|
||||
favEl.className = 'fa fa-star-o';
|
||||
$(favEl).parent()
|
||||
.removeClass('btn-warning')
|
||||
.attr('data-favourited', false);
|
||||
var favBtn = $('li[data-pid="' + data.pid + '"] .favourite');
|
||||
if(favBtn.length) {
|
||||
favBtn.removeClass('btn-warning')
|
||||
.attr('data-favourited', false)
|
||||
.find('i').attr('class', 'fa fa-star-o');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,7 +65,9 @@
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<!-- IF @first -->
|
||||
<button class="btn btn-sm btn-default follow main-post" type="button" title="Be notified of new replies in this topic"><i class="fa fa-eye"></i></button>
|
||||
<!-- ENDIF @first -->
|
||||
<button data-favourited="{posts.favourited}" class="favourite btn btn-sm btn-default <!-- IF posts.favourited --> btn-warning <!-- ENDIF posts.favourited -->" type="button">
|
||||
<span class="favourite-text">[[topic:favourite]]</span>
|
||||
<span class="post_rep_{posts.pid}">{posts.reputation} </span>
|
||||
|
||||
Reference in New Issue
Block a user