{% load i18n phoxtail_design_tags phoxtail_streams_tags static %} {# The bar appears for anyone who can use something in it. Each item then #} {# asks its own question, because they are not the same question: the chat #} {# button opens a view gated on access_chatbot, while the media picker, #} {# the page controls and the admin links each reach something only an #} {# operator may see. #} {# page controls act on the page and the admin links lead somewhere only #} {# an operator can use. A single outer check used to answer for all of #} {# them, which left the per-item checks below unreachable — they could #} {# only ever be read by a superuser, who passes them anyway. #} {# Some inner checks cannot refuse anyone while the wrapper admits only #} {# these two — an operator passes every permission, and the other way in #} {# is the permission the chat and media buttons name. They are kept #} {# because the wrapper is expected to grow: the page controls and admin #} {# links want their own answer here, and each new way in makes the checks #} {# below load-bearing one at a time. #} {% if user.is_superuser or perms.phoxtail_agent.access_chatbot %} {% url 'wagtailadmin_home' as admin_home %} {% url 'phoxtail_core:modal_level_1' as chat_history_modal_url %} {% url 'dashboard:index' as site_dashboard_url %} {% url 'phoxtail_agent:chat_history' as chat_history_url %} {% url 'phoxtail_agent:media_picker' as media_picker_url %} {% url 'phoxtail_agent:model_picker_panel' as model_picker_url %} {% if perms.phoxtail_agent.access_chatbot %} {% endif %} {% if media_picker_url and user.is_superuser %} {% endif %}