widget tooltips (bug 593068) + string fix for bug 592689
This commit is contained in:
Родитель
69b1a6c315
Коммит
edf74caf6d
|
@ -6,20 +6,18 @@
|
|||
data-addonid="{{ addon.id }}"
|
||||
>
|
||||
{% if condensed %}
|
||||
<a href="#"><span></span></a>
|
||||
<a href="#" title="{{ _('Add to collection') }}"><span></span></a>
|
||||
{% else %}
|
||||
<span><a href="#">Add to collection</a></span>
|
||||
<span><a href="#" title="{{ _('Add to collection') }}">
|
||||
{{ _('Add to collection') }}</a></span>
|
||||
{% endif %}
|
||||
<div class="popup-shim">
|
||||
<div class="collection-add-dropdown popup{{ ' left' if condensed else '' }}">
|
||||
{% if user.is_anonymous() %}
|
||||
<div class="collection-add-login">
|
||||
<p>
|
||||
{% trans %}
|
||||
To create your own collections, you must have an add-ons
|
||||
account.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
<p>{% trans %}
|
||||
To create your own collections, you must have an Mozilla Add-ons account.
|
||||
{% endtrans %}</p>
|
||||
<p class="register-button">
|
||||
<a class="button" href="{{ remora_url('users/register') }}">{{ _('Create an Add-ons Account') }}</a>
|
||||
</p>
|
||||
|
|
|
@ -119,11 +119,11 @@ def collection_add_widget(context, addon, condensed=False):
|
|||
@register.function
|
||||
@jinja2.contextfunction
|
||||
def favorites_widget(context, addon, condensed=False):
|
||||
"""Displays 'Add to Favorites' widget"""
|
||||
"""Displays 'Add to Favorites' widget."""
|
||||
c = dict(context.items())
|
||||
request = c['request']
|
||||
if request.user.is_authenticated():
|
||||
is_favorite = bool(addon.id in request.amo_user.favorite_addons)
|
||||
is_favorite = addon.id in request.amo_user.favorite_addons
|
||||
faved_class = 'faved' if is_favorite else ''
|
||||
|
||||
unfaved_text = '' if condensed else _('Add to favorites')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% set text = faved_text if is_favorite else unfaved_text %}
|
||||
{% set title = _('Remove from favorites') if is_favorite else _('Add to favorites') %}
|
||||
<div class="addon-favorite {{ faved_class }}{{ ' condensed' if condensed else '' }}"
|
||||
data-addonid="{{ addon.id }}"
|
||||
data-addurl="{{ add_url }}"
|
||||
|
@ -6,20 +8,9 @@
|
|||
data-unfavedtext="{{ unfaved_text }}"
|
||||
>
|
||||
{% if condensed %}
|
||||
<span class="msg">
|
||||
{% if is_favorite %}
|
||||
{{ faved_text }}
|
||||
{% else %}
|
||||
{{ unfaved_text }}
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="msg" title="{{ title }}">{{ text }}</span>
|
||||
{% else %}
|
||||
<span><a class="msg" href="#">
|
||||
{% if is_favorite %}
|
||||
{{ faved_text }}
|
||||
{% else %}
|
||||
{{ unfaved_text }}
|
||||
{% endif %}
|
||||
</a></span>
|
||||
<span><a class="msg" href="#" title="{{ title }}">
|
||||
{{ text }}</a></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="share widget"
|
||||
data-share-counts="{{ counts|json }}"
|
||||
data-base-url="{{ obj.share_url() }}?service=">
|
||||
<a title="{{ sharemsg if condensed }}" class="share" href="#"><span>{{ sharemsg }}</span></a>
|
||||
<a title="{{ sharemsg }}" class="share" href="#"><span>{{ sharemsg }}</span></a>
|
||||
<div class="share-me popup-shim{{ ' left' if condensed }}{{ email_class }}"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -688,9 +688,11 @@ $(document).ready(function () {
|
|||
if (faved) {
|
||||
widget.removeClass("faved");
|
||||
msg.text(widget.attr('data-unfavedtext'));
|
||||
msg.attr('title', gettext('Add to favorites'));
|
||||
} else {
|
||||
widget.addClass("faved");
|
||||
msg.text(widget.attr('data-favedtext'));
|
||||
msg.attr('title', gettext('Remove from favorites'));
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче