bug 565493 Port post-install contributions page

This commit is contained in:
Sam Keen 2010-06-04 11:36:11 -07:00
Родитель e019c47328
Коммит 5830c23e2f
7 изменённых файлов: 254 добавлений и 4 удалений

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

@ -0,0 +1,29 @@
<div class="highlight">
{% if author_addons %}
<div class="other-author-addons">
<h4>
{% trans count = addon.listed_authors|length,
author = users_list(addon.listed_authors) %}
Other add-ons by {{ author }}
{% pluralize %}
Other add-ons by these authors
{% endtrans %}
</h4>
<ul>
{% for other in author_addons %}
{% with id=other.id, title=other.name,
name=other.name|string|truncate(25) %}
{%- if id == addon.id %}{% continue %}{% endif %}
<li>
<a href="{{ other.get_url_path() }}" title="{{ title }}"
class="addonitem">{{ name }}</a>
</li>
{% endwith %}
{% endfor %}
</ul>
</div>{# /other-author-addons #}
{% endif %}
</div>{# /highlight #}

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

@ -0,0 +1,101 @@
{% extends "base.html" %}
{% block title %}{{ page_title( _('Thank you for installing {0}')|f(addon.name)) }}{% endblock %}
{% set authors = addon.listed_authors %}
{% block bodyclass %}
{% if authors|length > 1 %}
inverse
{% endif %}
{% endblock bodyclass %}
{% block content %}
{{ breadcrumbs([(addon.type_url(), amo.ADDON_TYPES[addon.type]), (None, addon.name)]) }}
{% set version = addon.current_version %}
{% set previews = addon.previews.all() %}
<h2 class="addon"{{ addon.name|locale_html }}>
<img src="{{ addon.icon_url }}" class="icon"/>
<span>
{{ _('Thank you for installing {0}')|f(addon.name) }}
</span>
{% if version and not addon.is_selfhosted() %}
<span class="version">{{ version.version }}</span>
{% endif %}
</h2>
{% if authors|length == 1 %}
{% if addon.takes_contributions %}
{{ contribution(addon=addon, src='addon-detail', show_install=True,
text=_('The developer of this add-on asks that you help '
'support its continued development by making a small '
'contribution.')) }}
{% endif %}
{% set user = addon.listed_authors[0] %}
<div class="secondary" role="complementary">
<div class="vcard">
<img class="avatar photo photo-large" alt="" src="{{ user.picture_url }}"/>
{% with profile = user, about_addons = True, table_class = 'person-info' %}
{% include "users/vcard.html" %}
{% endwith %}
</div>
</div>
<div id="addon" class="primary" role="main">
<div class="primary prose">
{% if user.bio %}
<h3>{{ _('Who is {0}')|f(user.display_name) }}</h3>
<p class="intro">{{ user.bio }}</p>
{% endif %}
{% if addon.the_reason %}
<h3>{{ _("Why was {0} created")|f(addon.name) }}</h3>
<p>{{ addon.the_reason }}</p>
{% endif %}
{% if addon.the_future %}
<h3>{{ _("What's next for {0}")|f(addon.name) }}</h3>
<p>{{ addon.the_future }}</p>
{% endif %}
</div>
<div class="secondary" role="navigation">
{% include "addons/author_other_addons.html" %}
</div>
</div>{# /#addon primary #}
{% else %}{# more than one author #}
<div class="primary featured section-teaser">
<div class="featured-inner inverse">
<div class="teaser-header">
<ol>
{% for author in authors %}
<li><a href="#t-author-{{ author.id }}">{{ author.display_name }}</a></li>
{% endfor %}
</ol>
</div>
<ol class="teaser-items no-autorotate">
{% for author in authors %}
<li class="vcard" id="t-author-{{ author.id }}">
<div class="secondary">
<img class="avatar photo-large photo" alt="" src="{{ author.picture_url }}"/>
</div>
<div class="primary">
<h3>{{ author.display_name }}</h3>
<p class="intro">{{ author.bio }}</p>
{% with profile = author, about_addons = True, table_class = 'person-info' %}
{% include "users/vcard.html" %}
{% endwith %}
</div>
</li>
{% endfor %}
</ol>
</div>
</div>
<div class="secondary" role="navigation">
{% include "addons/author_other_addons.html" %}
</div>
{% endif %}
{% endblock content %}

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

@ -4,7 +4,90 @@
{{ page_title(_('Meet the {0} Developer')|f(addon.name)) }}
{% endblock %}
{% block bodyclass %}
{% if authors|length > 1 %}
inverse
{% endif %}
{% endblock bodyclass %}
{% set authors = addon.listed_authors %}
{% block content %}
{{ breadcrumbs([(addon.type.get_url_path(), amo.ADDON_TYPES[addon.type_id]), (None, addon.name)]) }}
<h2>{{ _('Meet the {0} Developer')|f(addon.name) }}</h2>
{{ install_button(addon, show_contrib=False, src='developers') }}
{% if authors|length == 1 %}
{% set user = addon.listed_authors[0] %}
<div class="secondary" role="complementary">
<div class="vcard">
<img class="avatar photo photo-large" alt="" src="{{ user.picture_url }}"/>
{% with profile = user, about_addons = true, table_class = 'person-info' %}
{% include "users/vcard.html" %}
{% endwith %}
</div>
</div>
<div class="primary" role="main">
{% if addon.takes_contributions %}
{{ contribution(addon=addon, src='addon-detail',
text=_('The developer of this add-on asks that you help '
'support its continued development by making a small '
'contribution.')) }}
{% endif %}
<div class="primary prose">
<h3>{{ _('Who is {0}')|f(user.display_name) }}</h3>
<p class="intro">{{ user.bio }}</p>
<h3>{{ _("Why was {0} created")|f(addon.name) }}</h3>
<p>{{ addon.the_reason }}</p>
<h3>{{ _("What's next for {0}")|f(addon.name) }}</h3>
<p>{{ addon.the_future }}</p>
</div>
<div role="complementary" class="secondary">
{% include "addons/author_other_addons.html" %}
</div>
</div>
{% else %}{# multiple authors #}
<div class="primary featured section-teaser">
<div class="featured-inner inverse">
<div class="teaser-header">
<ol>
{% for author in authors %}
<li><a href="#t-author-{{ author.id }}">{{ author.display_name }}</a></li>
{% endfor %}
</ol>
</div>
<ol class="teaser-items no-autorotate">
{% for author in authors %}
<li class="vcard" id="t-author-{{ author.id }}">
<div class="secondary">
<img class="avatar photo-large photo" alt="" src="{{ author.picture_url }}"/>
</div>
<div class="primary">
<h3>{{ author.display_name }}</h3>
<p class="intro">{{ author.bio }}</p>
{% with profile = author, about_addons = true, table_class = 'person-info' %}
{% include "users/vcard.html" %}
{% endwith %}
</div>
</li>
{% endfor %}
</ol>
</div>
</div>
<div role="complementary" class="secondary">
{% include "addons/author_other_addons.html" %}
</div>
<div class="primary prose">
<h3>{{ _("Why was {0} created")|f(addon.name) }}</h3>
<p>{{ addon.the_reason }}</p>
<h3>{{ _("What's next for {0}")|f(addon.name) }}</h3>
<p>{{ addon.the_future }}</p>
</div>
{% endif %}
{% endblock content %}

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

@ -1,4 +1,5 @@
from django.conf.urls.defaults import patterns, url, include
from django.shortcuts import redirect
from . import views
@ -9,6 +10,10 @@ detail_patterns = patterns('',
url('^eula/(?P<file_id>\d+)$', views.eula, name='addons.eula'),
url('^developers(?:/(?P<extra>.+))?$', views.meet_the_developer,
name='addons.meet'),
url('^contribute/installed/', views.contribute_installed, name='contribute.installed'),
('^about$',
lambda r, addon_id: redirect('contribute.installed', addon_id, permanent=True)),
('^reviews/', include('reviews.urls')),
('^statistics/', include('stats.urls')),

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

@ -59,6 +59,21 @@ def addon_detail(request, addon_id):
'addons.detail', args=[addon.id]))
def contribute_installed(request, addon_id):
"""Add-ons details page dispatcher."""
addon = get_object_or_404(Addon.objects.valid(), id=addon_id)
# other add-ons from the same author(s)
author_addons = (Addon.objects.valid().only_translations()
.exclude(id=addon.id)
.filter(addonuser__listed=True,
authors__in=addon.listed_authors).distinct())
data = {
'addon': addon,
'author_addons': author_addons,
}
return jingo.render(request, 'addons/contribute_installed.html', data)
def extension_detail(request, addon):
"""Extensions details page."""
@ -347,5 +362,14 @@ def eula(request, addon_id, file_id):
def meet_the_developer(request, addon_id, extra=None):
addon = get_object_or_404(Addon.objects.valid(), id=addon_id)
return jingo.render(request, 'addons/meet_the_developer.html',
{'addon': addon})
# other add-ons from the same author(s)
author_addons = (Addon.objects.valid().only_translations()
.exclude(id=addon.id)
.filter(addonuser__listed=True,
authors__in=addon.listed_authors).distinct())
data = {
'addon': addon,
'author_addons': author_addons,
}
return jingo.render(request, 'addons/meet_the_developer.html',data)

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

@ -23,7 +23,12 @@ class TestRedirects(test.TestCase):
"""`/persona/\d+` should go to `/addon/\d+`."""
r = self.client.get(u'persona/4', follow=True)
assert r.redirect_chain[-1][0].endswith('/en-US/firefox/addon/4/')
def test_contribute_installed(self):
"""`/addon/\d+/about` should go to `/addon/\d+/contribute/installed`."""
r = self.client.get(u'addon/5326/about', follow=True)
assert r.redirect_chain[-1][0].endswith('/en-US/firefox/addon/5326/contribute/installed/')
def test_utf8(self):
"""Without proper unicode handling this will fail."""
response = self.client.get(u'/api/1.5/search/ツールバー',

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

@ -191,6 +191,9 @@
* First one to refactor it gets a cookie.
*/
function HeaderSlideshow() {
if($('.teaser-items').hasClass('no-autorotate')) {
Slideshow.prototype.autoRotate = function(){}
}
Slideshow.call(this);
}
HeaderSlideshow.prototype = new Slideshow();