{% load vantage i18n %} {% comment %} The saved-views strip. Rendered only when `saved_view_write_url` is in the context, so a page whose view did not opt in costs nothing. Three controls, and one rule for all of them: **Save degrades to Save as when the view is immutable to you.** `saved_view_mode` has already worked out which of the four reasons applies — not the owner, not a named editor, the view is locked, or there is no view open — and every one of them produces the same affordance, so nobody has to learn the difference before they can write their filter down. Every control is a form, not a script. A saved view is a write, and a write that only happens when JavaScript loaded is a write that sometimes does not happen. {% endcomment %} {% if saved_view_write_url %}
{% if saved_view_broken %} {% comment %} Validated on load, never on save. Fields get renamed long after a view is written, and the honest failure is to say so: dropping the predicate silently would show more rows than the view asked for and tell nobody. {% endcomment %}
{% if saved_view_widened %}

{% icon "shield" %} {% translate "Part of this view no longer applies, so the results may be broader than intended." %}

{% else %}

{% icon "shield" %}{% translate "Part of this view no longer applies." %}

{% endif %}
{% endif %}
{% comment %} The picker was a tab rail across the full width of the page. One line of chrome to say which view is open is one line the table does not get, so the rail moved inside the control that already states the answer: the summary is the current view's name, and every other view is one click below it. The nav landmark and the aria-current tab are unchanged — only their container is. {% endcomment %} {% if saved_views %}
{% if saved_view %}{{ saved_view.name }}{% else %}{% translate "All" %}{% endif %} {% if saved_view_diverged %}{% translate "Modified" context "saved view has unsaved changes" %}{% endif %}
{% elif saved_view %} {{ saved_view.name }} {% if saved_view_diverged %}{% translate "Modified" context "saved view has unsaved changes" %}{% endif %} {% endif %} {% if saved_view and saved_view_diverged %} {# Reset is a plain link back through the apply route: the view as saved. #} {% translate "Reset" %} {% endif %} {% if saved_view_mode == "save" and saved_view_diverged %}
{% csrf_token %} {# Optimistic locking: a stale number is refused rather than overwriting someone. #}
{% endif %}
{% if saved_view_mode == "save" and saved_view_diverged %}{% translate "Save as" %}{% else %}{% translate "Save view" %}{% endif %}
{% csrf_token %} {% comment %} Two questions, never one. Who can see it and who can change it are separate axes — conflating them is what forces a product to warn its users that a "personal" view is not a security feature. {% endcomment %}

{% blocktranslate trimmed %} A shared view is never saved automatically — someone else's screen should never change because you narrowed a filter. {% endblocktranslate %}

{% if saved_view %}
{% icon "sliders" %}
{% csrf_token %}
{% if saved_view_can_save or saved_view.owner_id == user.pk %}
{% csrf_token %}
{% endif %} {% if saved_view.locked %}

{% blocktranslate trimmed %} This view is locked. Locking freezes the configuration, not the data, and it binds the person who made it too. {% endblocktranslate %}

{% endif %}
{% endif %}
{% endif %}