Skip to content

Commit 31e4f1f

Browse files
committed
Made the revision list at the top of document pages take up less room. Added a warning above the document meta-information for old revisions. Made the background in the cell of the revision being shown have warning colour when showing old revisions. Gave the document meta-information tables the same sectioned look as the WG meta-information tables, as requested by a reviewer.
- Legacy-Id: 9421
1 parent cde9dfd commit 31e4f1f

8 files changed

Lines changed: 777 additions & 566 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def document_main(request, name, rev=None):
107107
revisions.append(h.rev)
108108
if not doc.rev in revisions:
109109
revisions.append(doc.rev)
110+
latest_rev = doc.rev
110111

111112
snapshot = False
112113

@@ -340,6 +341,27 @@ def document_main(request, name, rev=None):
340341
except ObjectDoesNotExist:
341342
pass
342343

344+
replaces = [d.name for d in doc.related_that_doc("replaces")]
345+
replaced_by = [d.name for d in doc.related_that("replaces")]
346+
published = doc.latest_event(type="published_rfc")
347+
started_iesg_process = doc.latest_event(type="started_iesg_process")
348+
349+
# We'd like to group rows in the document information table, with a first row giving the
350+
# group label. This would be easy if all browsers supported the rowspan="0" (zero)
351+
# semantics of the html standard, but only Firefox and Opera do, so we have to count
352+
# how many entries there will be in each section here, instead. Bah!
353+
table_rows = dict(doc=5, stream=3, iesg=5, iana=3, rfced=2)
354+
table_rows['doc'] += 1 if replaces or can_edit_stream_info else 0
355+
table_rows['doc'] += 1 if replaced_by else 0
356+
table_rows['doc'] += 1 if doc.get_state_slug != "rfc" else 0
357+
table_rows['doc'] += 1 if conflict_reviews else 0
358+
359+
table_rows['stream'] += 1 if consensus else 0
360+
table_rows['stream'] += 1 if shepherd_writeup or can_edit_shepherd_writeup else 0
361+
table_rows['stream'] += 1 if published and started_iesg_process and published.time < started_iesg_process.time else 0
362+
363+
table_rows['iesg'] += 1 if iesg_state and (doc.note or can_edit) else 0
364+
343365
return render_to_response("doc/document_draft.html",
344366
dict(doc=doc,
345367
group=group,
@@ -350,6 +372,9 @@ def document_main(request, name, rev=None):
350372
revisions=revisions,
351373
snapshot=snapshot,
352374
latest_revision=latest_revision,
375+
latest_rev=latest_rev,
376+
377+
table_rows=table_rows,
353378

354379
can_edit=can_edit,
355380
can_change_stream=can_change_stream,
@@ -367,8 +392,8 @@ def document_main(request, name, rev=None):
367392
submission=submission,
368393
resurrected_by=resurrected_by,
369394

370-
replaces=[d.name for d in doc.related_that_doc("replaces")],
371-
replaced_by=[d.name for d in doc.related_that("replaces")],
395+
replaces=replaces,
396+
replaced_by=replaced_by,
372397
updates=[prettify_std_name(d.name) for d in doc.related_that_doc("updates")],
373398
updated_by=[prettify_std_name(d.document.canonical_name()) for d in doc.related_that("updates")],
374399
obsoletes=[prettify_std_name(d.name) for d in doc.related_that_doc("obs")],
@@ -378,7 +403,7 @@ def document_main(request, name, rev=None):
378403
proposed_status_changes=proposed_status_changes,
379404
rfc_aliases=rfc_aliases,
380405
has_errata=doc.tags.filter(slug="errata"),
381-
published=doc.latest_event(type="published_rfc"),
406+
published=published,
382407
file_urls=file_urls,
383408
stream_state_type_slug=stream_state_type_slug,
384409
stream_state=stream_state,
@@ -390,7 +415,7 @@ def document_main(request, name, rev=None):
390415
rfc_editor_state=doc.get_state("draft-rfceditor"),
391416
iana_review_state=doc.get_state("draft-iana-review"),
392417
iana_action_state=doc.get_state("draft-iana-action"),
393-
started_iesg_process=doc.latest_event(type="started_iesg_process"),
418+
started_iesg_process=started_iesg_process,
394419
shepherd_writeup=shepherd_writeup,
395420
search_archive=search_archive,
396421
actions=actions,
@@ -420,19 +445,23 @@ def document_main(request, name, rev=None):
420445

421446
can_manage = can_manage_group_type(request.user, doc.group.type_id)
422447

448+
table_rows = dict(doc=5, wg=2, iesg=3)
449+
423450
return render_to_response("doc/document_charter.html",
424451
dict(doc=doc,
425452
top=top,
426453
chartering=chartering,
427454
content=content,
428455
txt_url=doc.href(),
429456
revisions=revisions,
457+
latest_rev=latest_rev,
430458
snapshot=snapshot,
431459
telechat=telechat,
432460
ballot_summary=ballot_summary,
433461
group=group,
434462
milestones=milestones,
435463
can_manage=can_manage,
464+
table_rows=table_rows,
436465
),
437466
context_instance=RequestContext(request))
438467

@@ -450,16 +479,21 @@ def document_main(request, name, rev=None):
450479
if doc.get_state_slug() in ("iesgeval"):
451480
ballot_summary = needed_ballot_positions(doc, doc.active_ballot().active_ad_positions().values())
452481

482+
table_rows = dict(doc=4, wg=2, iesg=3)
483+
table_rows['iesg'] += 1 if not snapshot else 0
484+
453485
return render_to_response("doc/document_conflict_review.html",
454486
dict(doc=doc,
455487
top=top,
456488
content=content,
457489
revisions=revisions,
490+
latest_rev=latest_rev,
458491
snapshot=snapshot,
459492
telechat=telechat,
460493
conflictdoc=conflictdoc,
461494
ballot_summary=ballot_summary,
462-
approved_states=('appr-reqnopub-pend','appr-reqnopub-sent','appr-noprob-pend','appr-noprob-sent')
495+
approved_states=('appr-reqnopub-pend','appr-reqnopub-sent','appr-noprob-pend','appr-noprob-sent'),
496+
table_rows=table_rows,
463497
),
464498
context_instance=RequestContext(request))
465499

@@ -484,16 +518,21 @@ def document_main(request, name, rev=None):
484518
else:
485519
sorted_relations=None
486520

521+
table_rows = dict(doc=5, wg=2, iesg=3)
522+
table_rows['iesg'] += sorted_relations.count() if sorted_relations else 0
523+
487524
return render_to_response("doc/document_status_change.html",
488525
dict(doc=doc,
489526
top=top,
490527
content=content,
491528
revisions=revisions,
529+
latest_rev=latest_rev,
492530
snapshot=snapshot,
493531
telechat=telechat,
494532
ballot_summary=ballot_summary,
495533
approved_states=('appr-pend','appr-sent'),
496534
sorted_relations=sorted_relations,
535+
table_rows=table_rows,
497536
),
498537
context_instance=RequestContext(request))
499538

@@ -536,6 +575,7 @@ def document_main(request, name, rev=None):
536575
top=top,
537576
content=content,
538577
revisions=revisions,
578+
latest_rev=latest_rev,
539579
snapshot=snapshot,
540580
can_manage_material=can_manage_material,
541581
other_types=other_types,
@@ -546,6 +586,11 @@ def document_main(request, name, rev=None):
546586
raise Http404
547587

548588

589+
590+
591+
592+
593+
549594
def document_history(request, name):
550595
doc = get_object_or_404(Document, docalias__name=name)
551596
top = render_document_top(request, doc, "history", name)

0 commit comments

Comments
 (0)