Port IESG discusses to new schema
- Legacy-Id: 6418
This commit is contained in:
parent
d11f2331fe
commit
1975ff27d0
|
@ -43,19 +43,17 @@ from django.template import RequestContext, Context, loader
|
|||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.conf import settings
|
||||
from django.utils import simplejson as json
|
||||
from django.db import models
|
||||
from django import forms
|
||||
|
||||
from ietf.idtracker.models import IDInternal, InternetDraft, AreaGroup, Position, IESGLogin, Acronym
|
||||
from ietf.idrfc.idrfc_wrapper import IdWrapper, RfcWrapper
|
||||
|
||||
from ietf.iesg.models import TelechatDate, TelechatAgendaItem
|
||||
from ietf.ipr.models import IprDocAlias
|
||||
from ietf.doc.models import Document, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent
|
||||
from ietf.doc.models import Document, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES
|
||||
from ietf.group.models import Group, GroupMilestone
|
||||
from ietf.person.models import Person
|
||||
|
||||
from ietf.doc.utils import update_telechat
|
||||
from ietf.ietfauth.utils import has_role, role_required
|
||||
from ietf.doc.utils import update_telechat, augment_events_with_revision
|
||||
from ietf.ietfauth.utils import has_role, role_required, user_is_person
|
||||
from ietf.iesg.agenda import *
|
||||
|
||||
def review_decisions(request, year=None):
|
||||
|
@ -387,31 +385,39 @@ def telechat_docs_tarfile(request, date):
|
|||
return response
|
||||
|
||||
def discusses(request):
|
||||
res = []
|
||||
possible_docs = Document.objects.filter(models.Q(states__type="draft-iesg",
|
||||
states__slug__in=IESG_BALLOT_ACTIVE_STATES) |
|
||||
models.Q(states__type="charter",
|
||||
states__slug__in=("intrev", "iesgrev")) |
|
||||
models.Q(states__type__in=("statchg", "conflrev"),
|
||||
states__slug__in=("iesgeval", "defer")),
|
||||
docevent__ballotpositiondocevent__pos__blocking=True)
|
||||
possible_docs = possible_docs.select_related("stream", "group", "ad").distinct()[:10]
|
||||
|
||||
for d in IDInternal.objects.filter(states__type="draft-iesg", states__slug__in=("pub-req", "ad-eval", "review-e", "lc-req", "lc", "writeupw", "goaheadw", "iesg-eva", "defer", "watching"), docevent__ballotpositiondocevent__pos="discuss").distinct():
|
||||
found = False
|
||||
for p in d.positions.all():
|
||||
if p.discuss:
|
||||
found = True
|
||||
break
|
||||
|
||||
if not found:
|
||||
docs = []
|
||||
for doc in possible_docs:
|
||||
ballot = doc.active_ballot()
|
||||
if not ballot:
|
||||
continue
|
||||
|
||||
if d.rfc_flag:
|
||||
doc = RfcWrapper(d)
|
||||
else:
|
||||
doc = IdWrapper(draft=d)
|
||||
blocking_positions = [p for p in ballot.all_positions() if p.pos.blocking]
|
||||
|
||||
if doc.in_ietf_process() and doc.ietf_process.has_active_iesg_ballot():
|
||||
# quick hack - to be removed when the proxy code is removed
|
||||
doc.underlying = doc.underlying_document()
|
||||
doc.underlying.milestones = d.groupmilestone_set.filter(state="active").order_by("time").select_related("group")
|
||||
if not blocking_positions:
|
||||
continue
|
||||
|
||||
res.append(doc)
|
||||
augment_events_with_revision(doc, blocking_positions)
|
||||
|
||||
return direct_to_template(request, 'iesg/discusses.html', {'docs':res})
|
||||
doc.by_me = bool([p for p in blocking_positions if user_is_person(request.user, p.ad)])
|
||||
doc.for_me = user_is_person(request.user, doc.ad)
|
||||
doc.milestones = doc.groupmilestone_set.filter(state="active").order_by("time").select_related("group")
|
||||
doc.blocking_positions = blocking_positions
|
||||
|
||||
docs.append(doc)
|
||||
|
||||
# latest first
|
||||
docs.sort(key=lambda d: min(p.time for p in d.blocking_positions), reverse=True)
|
||||
|
||||
return direct_to_template(request, 'iesg/discusses.html', { 'docs': docs })
|
||||
|
||||
@role_required('Area Director', 'Secretariat')
|
||||
def milestones_needing_review(request):
|
||||
|
|
|
@ -39,81 +39,49 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% block title %}IESG Discuss Positions{% endblock %}
|
||||
|
||||
{% block morecss %}
|
||||
.discuss_hidden {display:none;}
|
||||
.discusses-chooser label { display: inline-block; margin-right: 0.5em; }
|
||||
.discusses-chooser input { vertical-align: middle; margin: 0; padding: 0; margin-right: 0.3em; }
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>IESG Discuss Positions</h1>
|
||||
|
||||
{% if user|in_group:"Area_Director" %}
|
||||
<div style="padding:4px 0;">
|
||||
Show: <input type="radio" name="discuss_show" checked="checked" value="all" id="discusses_all" onclick="radio_changed();"/>All
|
||||
<input type="radio" name="discuss_show" value="byme" id="discusses_byme" onclick="radio_changed();"/>By me
|
||||
<input type="radio" name="discuss_show" value="forme" id="discusses_forme" onclick="radio_changed();"/>For me
|
||||
</div>
|
||||
{% if user|has_role:"Area Director" %}
|
||||
<p class="discusses-chooser">
|
||||
Show:
|
||||
<label><input type="radio" name="discusses" checked="checked" value="all"/>All</label>
|
||||
<label><input type="radio" name="discusses" value="byme"/>By me</label>
|
||||
<label><input type="radio" name="discusses" value="forme"/>For me</label>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<table class="ietf-table ietf-doctable">
|
||||
<tr><th class="doc">Document</th><th class="status" colspan="2">Status</th><th class="ad">Area Director</th><th>Discusses</th></tr>
|
||||
{% for doc in docs %}
|
||||
<tr class="discuss_row {% cycle oddrow,evenrow %} {% if user|in_group:"Area_Director" %}{% if doc|my_position:user|equal:"Discuss" %}discuss_byme{% else %}discuss_notbyme{% endif %} {% ifequal user.get_profile.person|lower doc.ad_name|lower %}discuss_forme{%else%}discuss_notforme{%endifequal%}{% endif %}">
|
||||
<td class="doc">{{ doc.displayname_with_link|safe }}</td>
|
||||
{% with doc.underlying as doc %}{% include "doc/search/status_columns.html" %}{% endwith %}
|
||||
<td class="ad">{{ doc.ad_name|default:"" }}</td>
|
||||
<td>
|
||||
{% for po in doc.ietf_process.iesg_ballot.get_discuss|dictsort:"is_old_ad" %}
|
||||
{%if po.is_old_ad %}[{%endif%}{{po.ad_name}}{%if po.is_old_ad %}]{%endif%} ({% if po.discuss_date %}{{po.discuss_date|timesince_days}}{%endif%} days ago{% if doc.is_id_wrapper %}{% ifnotequal po.discuss_revision doc.latest_revision %} for -{{po.discuss_revision}}{% endifnotequal %}{% endif %})<br/>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<th class="doc">Document</th>
|
||||
<th class="status" colspan="2">Status</th>
|
||||
<th class="ad">Area Director</th>
|
||||
<th>Discusses</th>
|
||||
</tr>
|
||||
|
||||
{% for doc in docs %}
|
||||
<tr class="discuss-row {{ forloop.counter|divisibleby:2|yesno:"evenrow,oddrow" }} {% if doc.by_me %}byme{% endif %} {% if doc.for_me %}forme{% endif %}">
|
||||
<td class="doc">{{ doc.displayname_with_link }}</td>
|
||||
|
||||
{% include "doc/search/status_columns.html" %}
|
||||
|
||||
<td class="ad">{{ doc.ad|default:"" }}</td>
|
||||
<td>
|
||||
{% for p in doc.blocking_positions %}
|
||||
{% if p.old_ad %}[{% endif %}{{ p.ad }}{% if p.old_ad %}]{% endif %} ({% if p.discuss_time %}{{ p.discuss_time|timesince_days }}{% endif %} days ago{% if doc.get_state_url != "rfc" and p.rev != doc.rev %} for -{{ p.rev }}{% endif %})<br/>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock content %}
|
||||
|
||||
{% block scripts %}
|
||||
{% if user|in_group:"Area_Director" %}
|
||||
function update_even_odd() {
|
||||
var els = YAHOO.util.Dom.getElementsByClassName("discuss_row","tr");
|
||||
var j = 1;
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
if (!YAHOO.util.Dom.hasClass(els[i], "discuss_hidden")) {
|
||||
if ((j % 2) == 1) {
|
||||
YAHOO.util.Dom.replaceClass(els[i], "evenrow", "oddrow");
|
||||
} else {
|
||||
YAHOO.util.Dom.replaceClass(els[i], "oddrow", "evenrow");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
function radio_changed() {
|
||||
var els1 = YAHOO.util.Dom.getElementsByClassName("discuss_notbyme","tr");
|
||||
YAHOO.util.Dom.removeClass(els1, "discuss_hidden");
|
||||
var els2 = YAHOO.util.Dom.getElementsByClassName("discuss_notforme","tr");
|
||||
YAHOO.util.Dom.removeClass(els2, "discuss_hidden");
|
||||
if (document.getElementById("discusses_byme").checked) {
|
||||
YAHOO.util.Dom.addClass(els1, "discuss_hidden");
|
||||
location.hash = "#byme";
|
||||
} else if (document.getElementById("discusses_forme").checked) {
|
||||
YAHOO.util.Dom.addClass(els2, "discuss_hidden");
|
||||
location.hash = "#forme";
|
||||
} else {
|
||||
location.hash = "#";
|
||||
}
|
||||
update_even_odd();
|
||||
}
|
||||
var url = location.href.split('#');
|
||||
if (url[1] == 'byme') {
|
||||
document.getElementById("discusses_byme").checked = true;
|
||||
radio_changed();
|
||||
} else if (url[1] == 'forme') {
|
||||
document.getElementById("discusses_forme").checked = true;
|
||||
radio_changed();
|
||||
}
|
||||
{% endif %}{# user in_group #}
|
||||
{% endblock scripts %}
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript" src="/js/utils.js"></script>
|
||||
<script type="text/javascript" src="/js/doc-search.js"></script>
|
||||
<script type="text/javascript" src="/js/iesg-discusses.js"></script>
|
||||
{% endblock %}
|
||||
|
|
33
static/js/iesg-discusses.js
Normal file
33
static/js/iesg-discusses.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
jQuery(function () {
|
||||
var radioButtons = jQuery('input[name="discusses"]');
|
||||
|
||||
var url = window.location.hash.replace("#", "");
|
||||
if (url == "byme" || url == "forme")
|
||||
radioButtons.filter("[value=" + url + "]").click();
|
||||
|
||||
function updateDisplayedRows() {
|
||||
var rows = jQuery(".discuss-row");
|
||||
|
||||
var val = radioButtons.filter(":checked").val();
|
||||
|
||||
if (val == "all") {
|
||||
rows.show();
|
||||
if (window.location.hash)
|
||||
window.location.hash = "";
|
||||
}
|
||||
else if (val == "forme" || val == "byme") {
|
||||
console.log(rows.filter("." + val))
|
||||
rows.filter("." + val).show();
|
||||
rows.not("." + val).hide();
|
||||
window.location.hash = val;
|
||||
}
|
||||
|
||||
// odd/even are swapped because the jQuery filter is 0-indexed
|
||||
rows.filter(":visible").filter(":even").removeClass("even").addClass("odd");
|
||||
rows.filter(":visible").filter(":odd").removeClass("odd").addClass("even");
|
||||
}
|
||||
|
||||
radioButtons.click(updateDisplayedRows);
|
||||
|
||||
updateDisplayedRows();
|
||||
});
|
Loading…
Reference in a new issue