Bug 599135, add-on performance notes
This commit is contained in:
Родитель
5a912eca2d
Коммит
970e2c2198
|
@ -47,6 +47,12 @@ def support_addon(addon):
|
|||
return jinja2.Markup(t.render(addon=addon))
|
||||
|
||||
|
||||
@register.inclusion_tag('addons/performance_note.html')
|
||||
@jinja2.contextfunction
|
||||
def performance_note(context, amount, listing=False):
|
||||
return dict(listing=listing, amount=amount)
|
||||
|
||||
|
||||
@register.inclusion_tag('addons/contribution.html')
|
||||
@jinja2.contextfunction
|
||||
def contribution(context, addon, text='', src='', show_install=False,
|
||||
|
|
|
@ -36,6 +36,10 @@
|
|||
|
||||
{{ big_install_button(addon, show_warning=False) }}
|
||||
|
||||
{% if settings.PERFORMANCE_WARNINGS %}
|
||||
{{ performance_note(amount=30) }}
|
||||
{% endif %}
|
||||
|
||||
{% if addon.takes_contributions %}
|
||||
{{ contribution(addon=addon, src='addon-detail',
|
||||
text=_('The developer of this add-on asks that you help '
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
{% endif %}
|
||||
{{ support_addon(addon) }}
|
||||
</blockquote>
|
||||
{% if settings.PERFORMANCE_WARNINGS %}
|
||||
{{ performance_note(amount=50, listing=True) }}
|
||||
{% endif %}
|
||||
{% if notes and notes[addon.id] %}
|
||||
<blockquote class="collector-note">
|
||||
<strong>{{ _("Collector's Note") }}</strong>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
{% if listing %}
|
||||
<div class="performance-note">
|
||||
{{ _('This add-on can slow down your browser.') }}
|
||||
<a href="#">{{ _('More…')|safe }}</a>
|
||||
<div class="popup warning hidden">
|
||||
<p class="msg">
|
||||
{% trans %}
|
||||
<b>Performance warning:</b> Installing this add-on can slow down
|
||||
your browser's start-up by <b>{{ amount }}%</b>.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
<p>
|
||||
{# TODO potch replace href with performance dashboard link #}
|
||||
<a href="#">{{ _('Learn More…')|safe }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="notification performance-note">
|
||||
<span></span>
|
||||
<div>
|
||||
<h3>{{ _('This add-on can slow down your browser.') }}</h3>
|
||||
{% trans %}
|
||||
Installing this add-on can slow down
|
||||
your browser's start-up by <b>{{ amount }}%</b>.
|
||||
{% endtrans %}
|
||||
{# TODO potch replace href with performance dashboard link #}
|
||||
<br/><a href="#">{{ _('Learn More…')|safe }}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
|
@ -1616,7 +1616,8 @@ form .error .note.error {
|
|||
|
||||
.listing .contribute,
|
||||
.separated-listing .contribute,
|
||||
.collector-note {
|
||||
.collector-note,
|
||||
.item .performance-note {
|
||||
background: #d3edf6;
|
||||
float: left;
|
||||
padding: 3px 10px;
|
||||
|
@ -1640,6 +1641,28 @@ form .error .note.error {
|
|||
float: right;
|
||||
}
|
||||
|
||||
.primary .performance-note h3 {
|
||||
font: normal bold 14px "helvetica neue", helvetica,arial,sans-serif;
|
||||
line-height: 1.2em;
|
||||
margin: 0;
|
||||
}
|
||||
.primary .performance-note span:first-child {
|
||||
float: left;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: url("../../img/zamboni/notifications.png") no-repeat 0px -226px;
|
||||
}
|
||||
.primary .performance-note {
|
||||
background: #fff3cc;
|
||||
}
|
||||
.primary .performance-note div {
|
||||
margin-left: 45px;
|
||||
}
|
||||
.item .performance-note {
|
||||
background: url("../../img/zamboni/notifications.png") no-repeat 7px -300px #fff3cc;
|
||||
padding-left: 28px;
|
||||
}
|
||||
|
||||
.listing .item {
|
||||
overflow: visible;
|
||||
}
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.2 KiB |
|
@ -52,6 +52,17 @@ var addons_display = {
|
|||
|
||||
/* general initialization */
|
||||
$(document).ready(function() {
|
||||
//performance warnings
|
||||
$(".performance-note .popup").each(function(i,p) {
|
||||
var $p = $(p),
|
||||
$a = $p.siblings("a").first();
|
||||
$p.removeClass("hidden")
|
||||
.popup($a, {
|
||||
width: 300,
|
||||
pointTo: $a
|
||||
});
|
||||
});
|
||||
|
||||
if ($('#addon.primary').length == 0) return;
|
||||
|
||||
addons_display.init({
|
||||
|
@ -72,7 +83,6 @@ $(document).ready(function() {
|
|||
|
||||
var etiquette_box = $("#addons-display-review-etiquette").hide();
|
||||
$("#short-review").focus(function() { etiquette_box.show("fast"); } );
|
||||
|
||||
});
|
||||
|
||||
/* get satisfaction initialization */
|
||||
|
|
|
@ -633,3 +633,6 @@ RECAPTCHA_URL = ('https://api-secure.recaptcha.net/challenge?k=%s' %
|
|||
|
||||
# Send Django signals asynchronously on a background thread.
|
||||
ASYNC_SIGNALS = True
|
||||
|
||||
# Performance notes on add-ons
|
||||
PERFORMANCE_NOTES = False
|
||||
|
|
Загрузка…
Ссылка в новой задаче