impala EULA, Privacy Policy, License pages

This commit is contained in:
Chris Van 2011-07-22 14:31:31 -07:00
Родитель 892a7acf77
Коммит 4f7711a78d
15 изменённых файлов: 195 добавлений и 31 удалений

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

@ -367,9 +367,9 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
def reviews_url(self):
return reverse('reviews.list', args=[self.slug])
def type_url(self):
def type_url(self, impala=False):
"""The url for this add-on's AddonType."""
return AddonType(self.type).get_url_path()
return AddonType(self.type).get_url_path(impala)
def share_url(self):
return reverse('addons.share', args=[self.slug])
@ -1162,12 +1162,13 @@ class AddonType(amo.models.ModelBase):
def __unicode__(self):
return unicode(self.name)
def get_url_path(self):
def get_url_path(self, impala=False):
try:
type = amo.ADDON_SLUGS[self.id]
except KeyError:
return None
return reverse('browse.%s' % type)
u = 'i_browse.%s' if impala else 'browse.%s'
return reverse(u % type)
class AddonUser(caching.CachingMixin, models.Model):

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

@ -67,7 +67,7 @@
{% if b.detailed %}
{% if addon.privacy_policy %}
<a class="privacy-policy badge" href="{{ url('addons.privacy', addon.slug) }}">
<a class="privacy-policy badge" href="{{ url('addons.i_privacy', addon.slug) }}">
<strong>{{ _('Privacy Policy') }}</strong>
</a>
{% endif %}

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

@ -157,7 +157,7 @@
<li>{{ version.created|datetime }}</li>
<li>
{% if version.license %}
{% trans url = version.license_url(),
{% trans url = version.license_url(impala=True),
name = version.license if version.license.builtin else _('Custom License') %}
Released under <a href="{{ url }}">{{ name }}</a>
{% endtrans %}

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

@ -0,0 +1,38 @@
{% extends "impala/base_side_categories.html" %}
{% from "addons/macros.html" import addon_heading %}
{% block title %}
{# L10n: {0} is the name of the add-on. #}
{{ page_title(_('End-User License Agreement for {0}')|f(addon.name)) }}
{% endblock %}
{% block primary %}
<section class="primary">
<hgroup class="hero">
{# L10n: EULA stand for End User License Agreement #}
{{ impala_breadcrumbs([(addon.type_url(impala=True), amo.ADDON_TYPES[addon.type]),
(url('addons.i_detail', addon.slug), addon.name),
(None, _('EULA'))]) }}
{{ addon_heading(addon, version) }}
</hgroup>
<div class="prose">
<h3>{{ _('End-User License Agreement') }}</h3>
<p>
{% trans addon_name = addon.name %}
{{ addon_name }} requires that you accept the following
End-User License Agreement before installation can proceed:
{% endtrans %}
</p>
<div class="policy-statement">{{ addon.eula|nl2br }}</div>
{{ install_button(addon, version=version, show_contrib=False,
show_eula=False, show_warning=False, impala=True) }}
<p class="policy-cancel">
<a href="{{ url('addons.i_detail', addon.slug) }}">
{{ _('Cancel Installation')|f(addon.name) }}</a>
</p>
<p class="policy-back">
&#x25C2; <a href="{{ url('addons.i_detail', addon.slug) }}">{{ _('Back to {0}...')|f(addon.name) }}</a>
</p>
</div>
</section>
{% endblock %}

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

@ -0,0 +1,29 @@
{% extends "impala/base_side_categories.html" %}
{% from "addons/macros.html" import addon_heading %}
{% block title %}
{{ page_title(_('Source Code License for {addon}'))|f(addon=addon.name) }}
{% endblock %}
{% set license = version.license %}
{% block primary %}
<section class="primary">
<hgroup class="hero">
{# L10n: The License for this add-on. #}
{{ impala_breadcrumbs([(addon.type_url(impala=True), amo.ADDON_TYPES[addon.type]),
(url('addons.i_detail', addon.slug), addon.name),
(None, _('License'))]) }}
{{ addon_heading(addon, version) }}
</hgroup>
<div class="prose">
<h3>{{ _('Source Code License') }}</h3>
{% if license.url %}
<p><a href="{{ license.url }}">{{ license.name }}</a><//p>
{% else %}
<h4>{{ license.name }}</h4>
<pre class="license" width="100%">{{ license.text|nl2br }}</pre>
{% endif %}
</div>
</section>
{% endblock %}

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

@ -0,0 +1,28 @@
{% extends "impala/base_side_categories.html" %}
{% from "addons/macros.html" import addon_heading %}
{% block title %}
{# L10n: {0} is the name of the add-on. #}
{{ page_title(_('Privacy Policy for {0}')|f(addon.name)) }}
{% endblock %}
{% set version = addon.current_version %}
{% block primary %}
<section class="primary">
<hgroup class="hero">
{# L10n: The Privacy Policy for this add-on. #}
{{ impala_breadcrumbs([(addon.type_url(impala=True), amo.ADDON_TYPES[addon.type]),
(url('addons.i_detail', addon.slug), addon.name),
(None, _('Privacy Policy'))]) }}
{{ addon_heading(addon, version) }}
</hgroup>
<div class="prose">
<h3>{{ _('Privacy Policy') }}</h3>
<div class="policy-statement">{{ addon.privacy_policy|nl2br }}</div>
<p class="policy-back">
&#x25C2; <a href="{{ url('addons.i_detail', addon.slug) }}">{{ _('Back to {0}...')|f(addon.name) }}</a>
</p>
</div>
</section>
{% endblock %}

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

@ -14,4 +14,13 @@
</span>
{% endif %}
</div>
{% endmacro %}
{% endmacro %}
{% macro addon_heading(addon, version) %}
<h2{{ addon.name|locale_html }}>
{{ addon.name }}
{% if version and not addon.is_selfhosted() %}
<span class="version">{{ version.version }}</span>
{% endif %}
</h2>
{% endmacro %}

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

@ -41,13 +41,19 @@ detail_patterns = patterns('',
impala_detail_patterns = patterns('',
url('^$', views.impala_addon_detail, name='addons.i_detail'),
('^reviews/', include('reviews.impala_urls')),
url('^eula/(?P<file_id>\d+)?$', views.impala_eula, name='addons.i_eula'),
url('^license/(?P<version>[^/]+)?', views.impala_license,
name='addons.i_license'),
url('^privacy/', views.impala_privacy, name='addons.i_privacy'),
url('^developers$', views.impala_developers, {'page': 'developers'},
name='addons.i_meet'),
url('^contribute/roadblock/', views.impala_developers,
{'page': 'roadblock'}, name='addons.i_roadblock'),
url('^contribute/installed/', views.impala_developers,
{'page': 'installed'}, name='addons.i_installed'),
('^reviews/', include('reviews.impala_urls')),
)

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

@ -516,6 +516,18 @@ def eula(request, addon, file_id=None):
return jingo.render(request, 'addons/eula.html',
{'addon': addon, 'version': version})
@addon_view
def impala_eula(request, addon, file_id=None):
if not addon.eula:
return http.HttpResponseRedirect(addon.get_url_path(impala=True))
if file_id is not None:
version = get_object_or_404(addon.versions, files__id=file_id)
else:
version = addon.current_version
return jingo.render(request, 'addons/impala/eula.html',
{'addon': addon, 'version': version})
@addon_view
def privacy(request, addon):
@ -525,6 +537,14 @@ def privacy(request, addon):
return jingo.render(request, 'addons/privacy.html', {'addon': addon})
@addon_view
def impala_privacy(request, addon):
if not addon.privacy_policy:
return http.HttpResponseRedirect(addon.get_url_path(impala=True))
return jingo.render(request, 'addons/impala/privacy.html',
{'addon': addon})
def _developers(request, addon, page, template=None):
if 'version' in request.GET:
qs = addon.versions.filter(files__status__in=amo.VALID_STATUSES)
@ -742,8 +762,7 @@ def share(request, addon):
description=truncate(addon.summary, length=250))
@addon_view
def license(request, addon, version=None):
def _license(request, addon, version=None, template=None):
if version is not None:
qs = addon.versions.filter(files__status__in=amo.VALID_STATUSES)
version = get_list_or_404(qs, version=version)[0]
@ -751,8 +770,17 @@ def license(request, addon, version=None):
version = addon.current_version
if not (version and version.license):
raise http.Http404()
return jingo.render(request, 'addons/license.html',
dict(addon=addon, version=version))
return jingo.render(request, template, dict(addon=addon, version=version))
@addon_view
def license(request, addon, version=None):
return _license(request, addon, version, 'addons/license.html')
@addon_view
def impala_license(request, addon, version=None):
return _license(request, addon, version, 'addons/impala/license.html')
def license_redirect(request, version):

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

@ -1,4 +1,4 @@
{% extends "impala/base.html" %}
{% extends "impala/base_side_categories.html" %}
{% block title %}
{{ page_title(category.name if category else _('Extensions')) }}
@ -38,10 +38,3 @@
<link rel="alternate" type="application/rss+xml" title="RSS"
href="{{ feed_url }}">
{% endblock %}
{% block content %}
<section class="secondary">
{{ side_nav(amo.ADDON_EXTENSION, category=category, impala=True) }}
</section>
{% block primary %}{% endblock %}
{% endblock %}

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

@ -138,8 +138,9 @@ class Version(amo.models.ModelBase):
def mirror_path_prefix(self):
return os.path.join(settings.MIRROR_STAGE_PATH, str(self.addon_id))
def license_url(self):
return reverse('addons.license', args=[self.addon.slug, self.version])
def license_url(self, impala=False):
u = 'addons.i_license' if impala else 'addons.license'
return reverse(u, args=[self.addon.slug, self.version])
def flush_urls(self):
return self.addon.flush_urls()

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

@ -130,7 +130,7 @@
b {
color: #333;
}
color: #666;
color: @medium-gray;
background: url("../../img/impala/stats.png") no-repeat right top;
&:hover {
color: @link;
@ -140,7 +140,7 @@
}
.gutter aside {
color: #666;
color: @medium-gray;
padding-top: 1em;
}
@ -469,11 +469,6 @@ table.person-info {
ol {
list-style: decimal;
margin: 0 0 0 1.5em;
+ a {
color: #666;
display: block;
margin: .5em 0 0 1.5em;
}
}
}
@ -525,3 +520,26 @@ img.icon {
.html-rtl.meet .island > section {
padding: 0 0 0 14px;
}
.policy-statement {
background-color: #fff;
border: 1px solid @border-black;
color: @medium-gray;
line-height: 1.4;
margin: 1.5em 0;
max-height: 300px;
overflow: auto;
padding: 2px 5px;
}
p.policy-cancel {
margin: 0;
}
p.policy-back a {
color: @dark-gray;
}
pre.license {
margin-top: 1em;
}

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

@ -1,8 +1,9 @@
// Colors
@link: #447BC4;
@note-gray: #999;
@dark-gray: #333;
@light-gray: #ccc;
@note-gray: #999;
@medium-gray: #666;
@dark-gray: #333;
@red: #C63717;
@error-red: #C00000;
@orange: #D16B00;

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

@ -51,6 +51,10 @@ pre, code, kbd, tt, samp, tt {
font-family: @mono-stack;
}
pre {
line-height: 1.4;
}
.primary, .modal {
h2 {
color: @dark-gray;

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

@ -0,0 +1,8 @@
{% extends "impala/base.html" %}
{% block content %}
<section class="secondary">
{{ side_nav(amo.ADDON_EXTENSION, category=category, impala=True) }}
</section>
{% block primary %}{% endblock %}
{% endblock %}