mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
templates bugfix - now supports multiple conditionals of the same variable; added data-favourited button and deprecated reliance on BS3
This commit is contained in:
@@ -291,8 +291,7 @@ define(function() {
|
||||
var pid = $(this).parents('li').attr('data-pid');
|
||||
var uid = $(this).parents('li').attr('data-uid');
|
||||
|
||||
var element = $(this).find('i');
|
||||
if ($(element).hasClass('fa-star-o')) {
|
||||
if ($(this).attr('data-favourited') == 'false') {
|
||||
socket.emit('api:posts.favourite', {
|
||||
pid: pid,
|
||||
room_id: app.currentRoom
|
||||
@@ -542,7 +541,9 @@ define(function() {
|
||||
var favEl = document.querySelector('.post_rep_' + data.pid).nextSibling;
|
||||
if (favEl) {
|
||||
favEl.className = 'fa fa-star';
|
||||
$(favEl).parent().addClass('btn-warning');
|
||||
$(favEl).parent()
|
||||
.addClass('btn-warning')
|
||||
.attr('data-favourited', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -552,7 +553,9 @@ define(function() {
|
||||
var favEl = document.querySelector('.post_rep_' + data.pid).nextSibling;
|
||||
if (favEl) {
|
||||
favEl.className = 'fa fa-star-o';
|
||||
$(favEl).parent().removeClass('btn-warning');
|
||||
$(favEl).parent()
|
||||
.removeClass('btn-warning')
|
||||
.attr('data-favourited', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user