From a1672545bc778415966664b3079318d077040a9e Mon Sep 17 00:00:00 2001 From: Christopher Grebs Date: Thu, 6 Jul 2017 16:42:27 +0200 Subject: [PATCH] Fix Collection add widget (#5849) * 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. --- .../templates/addons/includes/collection_add_widget.html | 4 ++-- .../templates/bandwagon/collection_widgets.html | 9 +++------ .../bandwagon/templates/bandwagon/favorites_widget.html | 4 ++-- src/olympia/bandwagon/templatetags/jinja_helpers.py | 4 ++-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/olympia/addons/templates/addons/includes/collection_add_widget.html b/src/olympia/addons/templates/addons/includes/collection_add_widget.html index f2360a1ed5..04c51c6196 100644 --- a/src/olympia/addons/templates/addons/includes/collection_add_widget.html +++ b/src/olympia/addons/templates/addons/includes/collection_add_widget.html @@ -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 '' }} diff --git a/src/olympia/bandwagon/templates/bandwagon/collection_widgets.html b/src/olympia/bandwagon/templates/bandwagon/collection_widgets.html index 26daf149d9..16221ae8bb 100644 --- a/src/olympia/bandwagon/templates/bandwagon/collection_widgets.html +++ b/src/olympia/bandwagon/templates/bandwagon/collection_widgets.html @@ -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') %} - {{ watch_msg if not condensed }} + {{ watch_msg if not condensed else '' }} {% endif %} {% if authenticated %} - {# - - #} {% if request.check_ownership(c, require_owner=False) and condensed %} diff --git a/src/olympia/bandwagon/templates/bandwagon/favorites_widget.html b/src/olympia/bandwagon/templates/bandwagon/favorites_widget.html index 06ccd0f09a..23a02d2e14 100644 --- a/src/olympia/bandwagon/templates/bandwagon/favorites_widget.html +++ b/src/olympia/bandwagon/templates/bandwagon/favorites_widget.html @@ -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 '' }} diff --git a/src/olympia/bandwagon/templatetags/jinja_helpers.py b/src/olympia/bandwagon/templatetags/jinja_helpers.py index 689c4e05e1..9b8a9b144b 100644 --- a/src/olympia/bandwagon/templatetags/jinja_helpers.py +++ b/src/olympia/bandwagon/templatetags/jinja_helpers.py @@ -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