* More if else fixes in collection and favorites widgets

* More if/else fixes

* Really fix #5846, make sure render_with comes after the register call.

Forward condensed again too.
This commit is contained in:
Christopher Grebs 2017-07-06 16:42:27 +02:00 коммит произвёл GitHub
Родитель 0a5cb06e91
Коммит a1672545bc
4 изменённых файлов: 9 добавлений и 12 удалений

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

@ -4,8 +4,8 @@
data-removeurl="{{ url('collections.ajax_remove') }}"
data-newurl="{{ url('collections.ajax_new') }}"
data-addonid="{{ addon.id }}"
title="{{ _('Add to collection') if condensed }}"
title="{{ _('Add to collection') if condensed else '' }}"
href="#"
>
{{ _('Add to collection') if not condensed }}
{{ _('Add to collection') if not condensed else '' }}
</a>

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

@ -4,14 +4,11 @@
{% set is_watching = c.id in request.user.watching %}
{% set watch_msg = _('Stop Following') if is_watching else
_('Follow this Collection') %}
<a title="{{ (_('Stop Following') if is_watching else _('Follow this Collection')) if condensed }}"
class="widget tooltip watch{{ ' watching' if is_watching }}{{ ' condensed' if condensed }}"
href="{{ c.watch_url() }}">{{ watch_msg if not condensed }}</a>
<a title="{% if condensed %}{{ (_('Stop Following') if is_watching else _('Follow this Collection')) }}{% endif %}"
class="widget tooltip watch{{ ' watching' if is_watching else '' }}{{ ' condensed' if condensed else '' }}"
href="{{ c.watch_url() }}">{{ watch_msg if not condensed else '' }}</a>
{% endif %}
{% if authenticated %}
{#
<a title="{{ _('Copy this Collection') }}" class="copy" href="#"></a>
#}
{% if request.check_ownership(c, require_owner=False) and condensed %}
<a title="{{ _('Edit this Collection') }}"
class="widget edit tooltip condensed" href="{{ c.edit_url() }}"></a>

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

@ -6,8 +6,8 @@
data-removeurl="{{ remove_url }}"
data-favedtext="{{ faved_text }}"
data-unfavedtext="{{ unfaved_text }}"
title="{{ title if condensed }}"
title="{{ title if condensed else '' }}"
href="#"
>
{{ text if not condensed }}
{{ text if not condensed else '' }}
</a>

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

@ -97,11 +97,11 @@ def barometer(context, collection):
return c
@library.render_with('addons/includes/collection_add_widget.html')
@library.global_function
@library.render_with('addons/includes/collection_add_widget.html')
def collection_add_widget(addon, condensed=False):
"""Displays 'Add to Collection' widget"""
return {'addon': addon}
return {'addon': addon, 'condensed': condensed}
@library.filter