Add mobile support for "become/stop root" feature

This commit is contained in:
Lance Edgar 2016-12-11 19:16:24 -06:00
parent ee0bdc4b74
commit 024d3c1975
2 changed files with 18 additions and 3 deletions

View file

@ -3,6 +3,15 @@
* Global styles for mobile templates
****************************************/
[data-role="header"] a.root-user,
[data-role="header"] a.root-user:hover {
background-color: red;
}
#usermenu .root-user a {
background-color: red;
}
.replacement-header {
display: none;
}

View file

@ -53,12 +53,13 @@
</%def>
<%def name="mobile_header_link()">
<% classes = 'ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ' %>
% if request.user:
${h.link_to(request.user.get_short_name(), '#usermenu', class_='ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-user')}
${h.link_to(request.user.get_short_name(), '#usermenu', class_=classes + 'ui-icon-user' + (' root-user' if request.is_root else ''))}
% elif request.matched_route.name in ('mobile.login', 'mobile.about'):
${h.link_to("Home", url('mobile.home'), class_='ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-home')}
${h.link_to("Home", url('mobile.home'), class_=classes + 'ui-icon-home')}
% else:
${h.link_to("Login", url('mobile.login'), class_='ui-btn-left ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-user')}
${h.link_to("Login", url('mobile.login'), class_=classes + 'ui-icon-user')}
% endif
</%def>
@ -66,6 +67,11 @@
<div id="usermenu" data-role="panel" data-display="overlay">
<ul data-role="listview">
<li data-icon="home">${h.link_to("Home", url('mobile.home'))}</li>
% if request.is_root:
<li class="root-user" data-icon="user">${h.link_to("Stop being root", url('stop_root'), **{'data-ajax': 'false'})}</li>
% elif request.is_admin:
<li class="root-user" data-icon="user">${h.link_to("Become root", url('become_root'), **{'data-ajax': 'false'})}</li>
% endif
<li data-icon="user">${h.link_to("Logout", url('logout'), **{'data-ajax': 'false'})}</li>
<li data-icon="info">${h.link_to("About {}".format(capture(self.app_title)), url('mobile.about'))}</li>
</ul>