do not show the clic count in category tag

This commit is contained in:
Régis Hanol 2013-05-06 19:40:39 +02:00
parent e70526d851
commit 53a430be9d
2 changed files with 12 additions and 6 deletions

View File

@ -53,9 +53,12 @@ Discourse.ClickTrack = {
if (!ownLink) {
var $badge = $('span.badge', $link);
if ($badge.length === 1) {
// don't update counts in oneboxes (except when we force it)
if ($link.closest(".onebox-result").length === 0 || $link.hasClass("track-link")) {
$badge.html(parseInt($badge.html(), 10) + 1);
// don't update counts in category badge
if ($link.closest('.badge-category').length === 0) {
// nor in oneboxes (except when we force it)
if ($link.closest(".onebox-result").length === 0 || $link.hasClass("track-link")) {
$badge.html(parseInt($badge.html(), 10) + 1);
}
}
}
}

View File

@ -171,9 +171,12 @@ Discourse.PostView = Discourse.View.extend({
postView.$(".cooked a[href]").each(function() {
var link = $(this);
if (link.attr('href') === lc.url) {
// don't display badge counts in oneboxes (except when we force it)
if (link.closest(".onebox-result").length === 0 || link.hasClass("track-link")) {
link.append("<span class='badge badge-notification clicks' title='" + Em.String.i18n("topic_summary.clicks") + "'>" + lc.clicks + "</span>");
// don't display badge counts on category badge
if (link.closest('.badge-category').length === 0) {
// nor in oneboxes (except when we force it)
if (link.closest(".onebox-result").length === 0 || link.hasClass("track-link")) {
link.append("<span class='badge badge-notification clicks' title='" + Em.String.i18n("topic_summary.clicks") + "'>" + lc.clicks + "</span>");
}
}
}
});