Skip to content

Commit

Permalink
Merge branch 'main' into FCL-316/change-button-wording
Browse files Browse the repository at this point in the history
  • Loading branch information
jlhdxw authored Oct 3, 2024
2 parents 0b3e9b6 + 9b9ef21 commit deab931
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
16 changes: 4 additions & 12 deletions ds_caselaw_editor_ui/templates/judgment/downloads.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@
<div class="container">
<h1 class="judgment-component__confirmation-title">Download documents for:</h1>
<h2 class="judgment-component__confirmation-subtitle">{{ document.name }}</h2>
{% if document.docx_url %}
<p>
<a href="{{ document.docx_url }}" download>Download .DOCX</a>
</p>
{% endif %}
{% if document.pdf_url %}
<p>
<a href="{{ document.pdf_url }}">Download PDF</a>
</p>
{% endif %}
<p>
<div class="judgment-component__button-actions">
{% if document.docx_url %}<a href="{{ document.docx_url }}" download>Download .DOCX</a>{% endif %}
{% if document.pdf_url %}<a href="{{ document.pdf_url }}">Download PDF</a>{% endif %}
<a href="{% url 'full-text-xml' document.uri %}">Download XML</a>
</p>
</div>
</div>
{% endblock content %}
11 changes: 8 additions & 3 deletions judgments/templatetags/navigation_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ def get_document_url(view, document):


def get_hold_navigation_item(view, document):
if document.is_published:
return None

identifier = "take-off-hold" if document.is_held else "put-on-hold"
label = "Take off hold" if document.is_held else "Put on hold"
selected = view in ("hold_judgment", "unhold_judgment")
path = None if document.is_published else "unhold-document" if document.is_held else "hold-document"
path = "unhold-document" if document.is_held else "hold-document"

return {
"id": identifier,
Expand Down Expand Up @@ -91,10 +94,12 @@ def get_navigation_items(context):
get_download_navigation_item(view, document),
]

filtered_navigation = [item for item in base_navigation if item is not None]

if linked_document_uri:
return [*base_navigation, get_associated_documents_navigation_item(view, document)]
return [*filtered_navigation, get_associated_documents_navigation_item(view, document)]

return base_navigation
return filtered_navigation


@register.simple_tag(takes_context=True)
Expand Down
5 changes: 2 additions & 3 deletions judgments/tests/test_navigation_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def test_get_navigation_items_published(self):

navigation_items = get_navigation_items(context)

for item in navigation_items:
if item["id"] == "take-off-hold":
assert item["url"] is None
assert not any(item["id"] == "take-off-hold" for item in navigation_items)
assert not any(item["id"] == "put-on-hold" for item in navigation_items)

def test_get_navigation_items_selected_pages(self):
judgment = JudgmentFactory.build(is_published=False)
Expand Down

0 comments on commit deab931

Please sign in to comment.