Merge pull request #825 from ZogStriP/do-not-show-clic-count-in-category-tag

do not show the clic count in category tag
This commit is contained in:
Jeff Atwood 2013-05-06 21:56:04 -07:00
commit 3bfd3c9723
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>");
}
}
}
});