diff options
author | citrons <citrons> | 2021-08-05 21:47:30 +0000 |
---|---|---|
committer | citrons <citrons> | 2021-08-05 21:47:30 +0000 |
commit | 6d7246a9496015a00538c00689d43fad241fbcca (patch) | |
tree | d106d8dbc4429386963df6fb9a1a145c52377801 /apioforum/templates | |
parent | 76cb3a6be912e55ffe7f6e7c221000f57cff6d4a (diff) |
fix role assignment UI
Diffstat (limited to 'apioforum/templates')
-rw-r--r-- | apioforum/templates/role_assignment.html | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/apioforum/templates/role_assignment.html b/apioforum/templates/role_assignment.html index d56c060..b212606 100644 --- a/apioforum/templates/role_assignment.html +++ b/apioforum/templates/role_assignment.html @@ -18,36 +18,35 @@ <input type="submit" value="view"/> </form> +{% set can_change = not invalid_user and user %} {% if invalid_user %} <p>requested user does not exist.</p> - <p> - <a href="{{url_for('forum.view_forum',forum_id=forum.id)}}">cancel</a> - </p> {% elif user %} <hr/> -<form method="post"> +<form method="post" id="role-form"> <p>{{user}}'s role in this forum is "{{role}}"</p> - {% if role == "other" or is_bureaucrat(forum.id, g.user) %} - <label for="role">assign role: </label> - <select name="role" id="role" value=""> + {% set can_change = role == "other" or is_bureaucrat(forum.id, g.user) %} + {% if can_change %} + <label for="role">assigned role: </label> + <select name="role" id="role" autocomplete="off"> <option value="">(no assigned role)</option> {% for role in forum_roles %} - <option value="{{role}}">{{role}}</option> + <option value="{{role}}" + {% if role == assigned_role %}selected{% endif %}> + {{role}} + </option> {% endfor %} </select> {% else %} <p>you do not have permission to change the role of this user</p> {% endif %} - <p>confirm changes?</p> - <p> - <input type="submit" value="confirm"> - <a href="{{url_for('forum.view_forum',forum_id=forum.id)}}">cancel</a> - </p> </form> -{% else %} +{% endif %} + +{% if can_change %}<p>confirm changes?</p>{% endif %} <p> +{% if can_change %}<input type="submit" value="confirm" form="role-form">{% endif %} <a href="{{url_for('forum.view_forum',forum_id=forum.id)}}">cancel</a> </p> -{% endif %} {% endblock %} |