Allow override of navbar-end element in falafel theme header

This commit is contained in:
Lance Edgar 2022-02-13 21:51:42 -06:00
parent 753daa55e8
commit 6093be43c9

View file

@ -236,34 +236,7 @@
% endfor % endfor
</div><!-- navbar-start --> </div><!-- navbar-start -->
<div class="navbar-end"> ${self.render_navbar_end()}
## User Menu
% if request.user:
<div class="navbar-item has-dropdown is-hoverable">
% if messaging_enabled:
<a class="navbar-link ${'root-user' if request.is_root else ''}">${request.user}${" ({})".format(inbox_count) if inbox_count else ''}</a>
% else:
<a class="navbar-link ${'root-user' if request.is_root else ''}">${request.user}</a>
% endif
<div class="navbar-dropdown">
% if request.is_root:
${h.link_to("Stop being root", url('stop_root'), class_='navbar-item root-user')}
% elif request.is_admin:
${h.link_to("Become root", url('become_root'), class_='navbar-item root-user')}
% endif
% if messaging_enabled:
${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'), class_='navbar-item')}
% endif
${h.link_to("Change Password", url('change_password'), class_='navbar-item')}
${h.link_to("Logout", url('logout'), class_='navbar-item')}
</div>
</div>
% else:
${h.link_to("Login", url('login'), class_='navbar-item')}
% endif
</div><!-- navbar-end -->
</div> </div>
</nav> </nav>
@ -552,6 +525,38 @@
${tailbone_autocomplete_template()} ${tailbone_autocomplete_template()}
</%def> </%def>
<%def name="render_navbar_end()">
<div class="navbar-end">
${self.render_user_menu()}
</div>
</%def>
<%def name="render_user_menu()">
% if request.user:
<div class="navbar-item has-dropdown is-hoverable">
% if messaging_enabled:
<a class="navbar-link ${'root-user' if request.is_root else ''}">${request.user}${" ({})".format(inbox_count) if inbox_count else ''}</a>
% else:
<a class="navbar-link ${'root-user' if request.is_root else ''}">${request.user}</a>
% endif
<div class="navbar-dropdown">
% if request.is_root:
${h.link_to("Stop being root", url('stop_root'), class_='navbar-item root-user')}
% elif request.is_admin:
${h.link_to("Become root", url('become_root'), class_='navbar-item root-user')}
% endif
% if messaging_enabled:
${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'), class_='navbar-item')}
% endif
${h.link_to("Change Password", url('change_password'), class_='navbar-item')}
${h.link_to("Logout", url('logout'), class_='navbar-item')}
</div>
</div>
% else:
${h.link_to("Login", url('login'), class_='navbar-item')}
% endif
</%def>
<%def name="render_instance_header_buttons()"> <%def name="render_instance_header_buttons()">
${self.render_crud_header_buttons()} ${self.render_crud_header_buttons()}
${self.render_prevnext_header_buttons()} ${self.render_prevnext_header_buttons()}
@ -665,6 +670,7 @@
let WholePage = { let WholePage = {
template: '#whole-page-template', template: '#whole-page-template',
computed: {},
methods: { methods: {
changeContentTitle(newTitle) { changeContentTitle(newTitle) {