Skip to content

Commit 2d902e2

Browse files
committed
Add stream edit page for setting delegates instead of page in
ietfworkflows, add streams_menu template tag for outputting the streams menu instead of the one in ietfworkflows, move base_wgmenu.html and base_leftmenu.html templates to base/ (together with base/streams_menu.html), get rid of "first" madness in base/left_menu.html which is now obsolete anyway because we have a Settings headline which is always first - Legacy-Id: 6255
1 parent 5f6f966 commit 2d902e2

7 files changed

Lines changed: 50 additions & 20 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from django import template
2+
from django.conf import settings
3+
from django.core.urlresolvers import reverse as urlreverse
4+
5+
from ietf.ietfauth.utils import has_role
6+
from ietf.group.models import Group
7+
from ietf.name.models import StreamName
8+
9+
register = template.Library()
10+
11+
@register.inclusion_tag('base/streams_menu.html', takes_context=True)
12+
def streams_menu(context):
13+
user = context["request"].user
14+
15+
editable_streams = []
16+
17+
if user.is_authenticated():
18+
streams = StreamName.objects.exclude(slug="legacy")
19+
20+
if has_role(user, "Secretariat"):
21+
editable_stream = streams
22+
else:
23+
acronyms = Group.objects.filter(acronym__in=(s.slug for s in streams),
24+
role__name="chair",
25+
role__person__user=user).distinct().values_list("acronym", flat=True)
26+
27+
for s in streams:
28+
if s.slug in acronyms:
29+
editable_streams.append(s)
30+
31+
return { 'editable_streams': streams }

ietf/doc/templatetags/wg_menu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def render(self, context):
6161

6262
areas = [a for a in areas if a.active_groups]
6363

64-
res = loader.render_to_string('base_wgmenu.html', {'areas':areas})
64+
res = loader.render_to_string('base/wg_menu.html', {'areas':areas})
6565
cache.set('base_left_wgmenu', x, 30*60)
6666
return res
6767

ietf/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<tr valign="top">
7070
<td style="width:130px;padding-right:8px;" class="noprint">
7171
<div class="ietf-navbar">
72-
{% include "base_leftmenu.html" %}
72+
{% include "base/left_menu.html" %}
7373
</div>
7474
<div style="width: 100%; text-align: center; padding-top:4px;font-size:69%;">
7575
{% if version_num %}
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3333
-->
3434
{% endcomment %}
35-
{% load wg_menu %}
36-
{% load ietf_filters ietf_streams community_tags %}
35+
{% load wg_menu %}
36+
{% load streams_menu %}
3737
{% load ietf_filters community_tags %}
3838
<ul>
3939
<li class="sect first">Settings</li>
4040
<li><a href="{% url account_index %}">{% if request.user.is_authenticated %}Manage Account{% else %}New Account{% endif %}</a></li>
4141
<li><a href="{%url ietf.cookies.views.settings %}" rel="nofollow">Options</a></li>
4242
{% if user|has_role:"Area Director" %}
43-
<li class="sect first">AD Dashboard</li>
43+
<li class="sect">AD Dashboard</li>
4444
<li><a href="{% url docs_for_ad name=user.get_profile.full_name_as_key %}">My Documents</a></li>
4545
<li><a href="{% url ietf.iesg.views.agenda_documents %}">Next Telechat</a></li>
4646
<li><a href="{% url ietf.iesg.views.discusses %}">Discusses</a></li>
@@ -49,32 +49,24 @@
4949
<li><a href="{% url ietf.iesg.views.working_group_actions %}">Working Groups</a></li>
5050
{% endif %}
5151
{% if user|has_role:"Secretariat" %}
52-
<li class="sect first">Secretariat</li>
52+
<li class="sect">Secretariat</li>
5353
<li><a href="/admin/iesg/telechatdate/">Telechat Dates</a></li>
5454
<li><a href="/admin/iesg/telechatagendaitem/">Management Items</a></li>
5555
<li><a href="{% url ietf.iesg.views.milestones_needing_review %}">Milestones</a></li>
5656
{# FIXME: this link should be removed when the old WG Actions are completely dead #}
5757
<li><a href="{% url ietf.iesg.views.working_group_actions %}">Working Groups</a></li>
5858
<li><a href="{% url ietf.sync.views.discrepancies %}">Sync discrepancies</a>
5959
{% endif %}
60-
{% if user %}
61-
{% get_user_managed_streams user as stream_list %}
62-
{% if stream_list %}
63-
<li class="sect{% if not user|in_group:"Area_Director,Secretariat" %} first{% endif %}">Streams</li>
64-
{% for stream in stream_list %}
65-
<li{% if forloop.last %} style="margin-bottom: 2px;"{% endif %}><a href="{% url stream_delegates stream.name %}">{{ stream.name }} stream</a></li>
66-
{% endfor %}
67-
{% endif %}
68-
{% endif %}
60+
{% streams_menu %}
6961
{% if user|has_role:"IANA" %}
70-
<li class="sect first">IANA</li>
62+
<li class="sect">IANA</li>
7163
<li><a href="{% url ietf.sync.views.discrepancies %}">Sync discrepancies</a></li>
7264
{% endif %}
7365
{% if user|has_role:"RFC Editor" %}
74-
<li class="sect first">RFC Editor</li>
66+
<li class="sect">RFC Editor</li>
7567
<li><a href="{% url ietf.sync.views.discrepancies %}">Sync discrepancies</a></li>
7668
{% endif %}
77-
<li class="sect{% if not user|has_role:"Area Director,Secretariat" %} first{% endif %}">Working Groups</li>
69+
<li class="sect">Working Groups</li>
7870

7971
<li style="padding-bottom:0;"><div id="wgs" class="yuimenu"><div class="bd" style="border:0;">
8072
<ul class="first-of-type" style="padding:0;">
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% load ietf_filters %}
2+
{% if editable_streams %}
3+
<li class="sect">Streams</li>
4+
{% for stream in editable_streams %}
5+
<li{% if forloop.last %} style="margin-bottom: 2px;"{% endif %}><a href="{% url ietf.group.views.stream_edit stream.slug %}">{{ stream.name }} stream</a></li>
6+
{% endfor %}
7+
{% endif %}

ietf/templates/group/stream_edit.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<h1>Manage {{ group.name }} stream</h1>
1616

1717
<p>
18-
<b>Chair{{ chairs|pluralize }}:</b>
18+
<b>Chair{{ chairs|pluralize }}:
1919
{% for chair in chairs %}
2020
{{ chair.person.plain_name }} &lt;{{ chair.address }}&gt;{% if not forloop.last %}, {% endif %}
21-
{% endfor %}
21+
{% endfor %}</b>
2222
</p>
2323

2424
<p>Delegates can be assigned with permission to do the tasks of the

0 commit comments

Comments
 (0)