bug 623780, unlink site stats.

This commit is contained in:
Dave Dash 2011-01-11 13:37:33 -08:00
Родитель c00bbbd23d
Коммит 589f88ac24
3 изменённых файлов: 25 добавлений и 10 удалений

Просмотреть файл

@ -4,19 +4,27 @@
{% block bodyclass %}home{% endblock %}
{% macro stats_text() %}
{% trans plural=downloads.count, count=downloads.count|numberfmt %}
<strong>{{ count }}</strong><span>add-on downloaded</span>
{% pluralize %}
<strong>{{ count }}</strong><span>add-ons downloaded</span>
{% endtrans %}
{% endmacro %}
{% block site_stats %}
{% if downloads %}
<div class="stats">
{% if downloads.count > 0 %}
<a href="{{ url('statistics.dashboard') }}">
{% trans plural=downloads.count, count=downloads.count|numberfmt %}
<strong>{{ count }}</strong><span>add-on downloaded</span>
{% pluralize %}
<strong>{{ count }}</strong><span>add-ons downloaded</span>
{% endtrans %}
</a>
<div class="stats">
{% if settings.UNLINK_SITE_STATS %}
{{ stats_text() }}
{% else %}
<a href="{{ url('statistics.dashboard') }}">
{{ stats_text() }}
</a>
{% endif %}
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}

Просмотреть файл

@ -13,7 +13,6 @@ from nose.tools import eq_
from pyquery import PyQuery as pq
import test_utils
from access.models import Group, GroupUser
from amo.urlresolvers import reverse
from amo.pyquery_wrapper import PyQuery
from stats.models import SubscriptionEvent
@ -35,6 +34,7 @@ def test_login_link():
assert link.endswith('?to=%2Fen-US%2Ffirefox%2Fsearch%2F%3Fq%3D%25EF'
'%25BF%25BD%2B%25EB%25B2%2588%25EF%25BF%25BDA'), "Got %s" % link
class Client(test.Client):
"""Test client that uses form-urlencoded (like browsers)."""
@ -66,6 +66,12 @@ def test_404_app_links():
class TestStuff(test_utils.TestCase):
fixtures = ('base/users', 'base/global-stats', 'base/configs',)
def test_hide_stats_link(self):
r = self.client.get('/', follow=True)
doc = pq(r.content)
assert doc('.stats')
assert not doc('.stats a')
def test_data_anonymous(self):
def check(expected):
response = self.client.get('/', follow=True)

Просмотреть файл

@ -695,3 +695,4 @@ VALIDATE_ADDONS = True
# Feature flags
SEARCH_EXCLUDE_PERSONAS = True
UNLINK_SITE_STATS = True