From 2e29298d0cf3f3292ea609f94f9e47e5071b5d65 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Fri, 20 Sep 2013 14:09:30 +0000 Subject: [PATCH] Move group charter actions from box and button next to header up to an edit menu under the ordinary group menu - Legacy-Id: 6219 --- ietf/templates/wginfo/group_base.html | 10 ++++++++ ietf/templates/wginfo/group_charter.html | 16 +----------- ietf/wginfo/views.py | 32 +++++++++++++----------- static/css/base2.css | 1 + 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/ietf/templates/wginfo/group_base.html b/ietf/templates/wginfo/group_base.html index 1496a7e57..6e1f7907e 100644 --- a/ietf/templates/wginfo/group_base.html +++ b/ietf/templates/wginfo/group_base.html @@ -70,6 +70,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
Documents | Charter | @@ -78,6 +79,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. List Archive » | {% endif %} Tools WG Page » +
+ + {% if menu_actions %} +
+ {% for name, url in menu_actions %} + {{ name }} + {% endfor %} +
+ {% endif %}
{% block group_content %} diff --git a/ietf/templates/wginfo/group_charter.html b/ietf/templates/wginfo/group_charter.html index b29f6a918..8148bc035 100644 --- a/ietf/templates/wginfo/group_charter.html +++ b/ietf/templates/wginfo/group_charter.html @@ -138,13 +138,6 @@ is occasionally incorrect. -{% if user|has_role:"Area Director,Secretariat" %} -
- {% for name, url in actions %} - {{ name }} {% if not forloop.last %} | {% endif %} - {% endfor %} -
-{% endif %} {% with group.groupurl_set.all as urls %} @@ -161,14 +154,7 @@ is occasionally incorrect.

{{ group.charter_text|escape|format_charter|safe }}

-

{% if group.state_id == "proposed" %}Proposed{% endif %} Milestones - -{% if group.state_id != "proposed" %} -{% if user|has_role:"Area Director,Secretariat" or is_chair %} -Add or edit milestones -{% endif %} -{% endif %} -

+

{% if group.state_id == "proposed" %}Proposed{% endif %} Milestones

{% with group.milestones as milestones %} {% include "wginfo/milestones.html" %} diff --git a/ietf/wginfo/views.py b/ietf/wginfo/views.py index 57bc5100c..2a92ad379 100644 --- a/ietf/wginfo/views.py +++ b/ietf/wginfo/views.py @@ -173,9 +173,27 @@ def chartering_wgs(request): def construct_group_menu_context(request, group, selected, others): """Return context with info for the group menu filled in.""" + actions = [] + + is_chair = group.has_role(request.user, "chair") + is_ad_or_secretariat = has_role(request.user, ("Area Director", "Secretariat")) + + if group.state_id != "proposed" and (is_chair or is_ad_or_secretariat): + actions.append((u"Add or edit milestones", urlreverse("wg_edit_milestones", kwargs=dict(acronym=group.acronym)))) + + if group.state_id != "conclude" and is_ad_or_secretariat: + actions.append((u"Edit group", urlreverse("group_edit", kwargs=dict(acronym=group.acronym)))) + + if is_chair or is_ad_or_secretariat: + actions.append((u"Customize workflow", urlreverse("ietf.wginfo.edit.customize_workflow", kwargs=dict(acronym=group.acronym)))) + + if group.state_id in ("active", "dormant") and is_ad_or_secretariat: + actions.append((u"Request closing group", urlreverse("wg_conclude", kwargs=dict(acronym=group.acronym)))) + d = { "group": group, "selected": selected, + "menu_actions": actions, } d.update(others) @@ -259,25 +277,11 @@ def group_charter(request, acronym): fill_in_charter_info(group, include_drafts=False) group.delegates = Email.objects.filter(role__group=group, role__name="delegate") - actions = [] - if group.state_id != "conclude": - actions.append((u"Edit %s" % group.type.name, urlreverse("group_edit", kwargs=dict(acronym=group.acronym)))) - e = group.latest_event(type__in=("changed_state", "requested_close",)) requested_close = group.state_id != "conclude" and e and e.type == "requested_close" - if group.state_id in ("active", "dormant"): - actions.append((u"Request closing %s" % group.type.name, urlreverse("wg_conclude", kwargs=dict(acronym=group.acronym)))) - - is_chair = request.user.is_authenticated() and group.role_set.filter(name="chair", person__user=request.user) - - if is_chair or has_role(request.user, "Secretariat"): - actions.append((u"Customize workflow", urlreverse("ietf.wginfo.edit.customize_workflow", kwargs=dict(acronym=group.acronym)))) - return render_to_response('wginfo/group_charter.html', construct_group_menu_context(request, group, "charter", { - "actions": actions, - "is_chair": is_chair, "milestones_in_review": group.groupmilestone_set.filter(state="review"), "requested_close": requested_close, }), RequestContext(request)) diff --git a/static/css/base2.css b/static/css/base2.css index 78f1ee963..a53638b2a 100644 --- a/static/css/base2.css +++ b/static/css/base2.css @@ -76,6 +76,7 @@ a img { border: 0; } .ietf-navset .selected { font-weight:bold; padding: 0 3px; } .ietf-navset a, .ietf-navset a:visited { color: white; padding:0 3px; } +.ietf-navset .actions { margin-top: 0.5em; font-style: italic; font-size: 90%; } .ietf-ballot .left { background: #edf5ff; width:160px; padding-left: 10px; } .ietf-ballot .right { padding-left: 15px; padding-right:15px; width:610px;padding-top:0px;}