Switch from macros to blocks for navigation menus
For more informations see a7693aa78dcf0a0a77e113f34afa63fb4f615441 in pillar.git
This commit is contained in:
@@ -218,9 +218,8 @@ html(lang="en")
|
||||
|
||||
| {% block navigation_user %}
|
||||
|
||||
| {% from '_macros/_menu.html' import navigation_menu_notifications, navigation_menu_user %}
|
||||
| {{ navigation_menu_notifications(current_user) }}
|
||||
| {{ navigation_menu_user(current_user) }}
|
||||
| {% include 'menus/notifications.html' %}
|
||||
| {% include 'menus/user.html' %}
|
||||
|
||||
| {% endblock navigation_user %}
|
||||
|
||||
|
64
src/templates/menus/user.pug
Normal file
64
src/templates/menus/user.pug
Normal file
@@ -0,0 +1,64 @@
|
||||
| {% extends 'menus/user_base.html' %}
|
||||
|
||||
| {% if current_user.has_role('demo') %}
|
||||
| {% set subscription = 'demo' %}
|
||||
| {% elif current_user.has_cap('subscriber') %}
|
||||
| {% set subscription = 'subscriber' %}
|
||||
| {% else %}
|
||||
| {% set subscription = 'none' %}
|
||||
| {% endif %}
|
||||
|
||||
| {% block menu_avatar %}
|
||||
a.navbar-item.dropdown-toggle(href="#", data-toggle="dropdown", title="{{ current_user.email }}")
|
||||
img.gravatar(
|
||||
src="{{ current_user.gravatar }}",
|
||||
class="{{ subscription }}",
|
||||
alt="Avatar")
|
||||
.special(class="{{ subscription }}")
|
||||
| {% if subscription == 'subscriber' %}
|
||||
i.pi-check
|
||||
| {% elif subscription == 'demo' %}
|
||||
i.pi-heart-filled
|
||||
| {% else %}
|
||||
i.pi-attention
|
||||
| {% endif %}
|
||||
| {% endblock menu_avatar %}
|
||||
|
||||
|
||||
| {% block menu_list %}
|
||||
li.subscription-status(class="{{ subscription }}")
|
||||
| {% if subscription == 'subscriber' %}
|
||||
a.navbar-item(
|
||||
href="{{url_for('settings.billing')}}"
|
||||
title="View subscription info")
|
||||
i.pi-grin
|
||||
span Your subscription is active!
|
||||
| {% elif subscription == 'demo' %}
|
||||
a.navbar-item(
|
||||
href="{{url_for('settings.billing')}}"
|
||||
title="View subscription info")
|
||||
i.pi-heart-filled
|
||||
span You have a free account.
|
||||
| {% elif current_user.has_cap('can-renew-subscription') %}
|
||||
a.navbar-item(target='_blank', href="/renew", title="Renew subscription")
|
||||
i.pi-heart
|
||||
span.info Your subscription is not active.
|
||||
span.renew Click here to renew.
|
||||
| {% else %}
|
||||
a.navbar-item(
|
||||
href="https://store.blender.org/product/membership/"
|
||||
title="Renew subscription")
|
||||
i.pi-unhappy
|
||||
span.info Your subscription is not active.
|
||||
span.renew Click here to renew.
|
||||
| {% endif %}
|
||||
|
||||
| {{ super() }}
|
||||
|
||||
li
|
||||
a.navbar-item(
|
||||
href="{{ url_for('settings.billing') }}"
|
||||
title="Billing")
|
||||
i.pi-credit-card
|
||||
| Subscription
|
||||
| {% endblock menu_list %}
|
Reference in New Issue
Block a user