Skip to content

Commit

Permalink
Merge pull request #11 from nationalarchives/feature/record-serialisa…
Browse files Browse the repository at this point in the history
…tion

Update records to use new serialisation
  • Loading branch information
ahosgood authored Sep 10, 2024
2 parents 49c1a65 + a30f724 commit d6e5711
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
6 changes: 3 additions & 3 deletions app/templates/explore-the-collection/highlight-gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ <h2 class="tna-heading-l tna-!--padding-top-s" itemprop="name" id="gallery-image
<dl class="tna-dl tna-dl--plain tna-dl--stacked">
<dt>Date</dt>
<dd>{{ highlight.image.record_dates }}</dd>
{%- if highlight.record_data and highlight.record_data.hierarchy | length %}
{% with parent = highlight.record_data.hierarchy | last %}
{%- if highlight.record %}
{% with parent = highlight.record.reference_number %}
<dt>Catalogue reference</dt>
<dd>
<a href="{{ url_for('search.catalogue_item', id=parent.id) }}">{{ parent.identifier }}</a>
Expand All @@ -71,7 +71,7 @@ <h2 class="tna-heading-l tna-!--padding-top-s" itemprop="name" id="gallery-image
{{ highlight.image.description | safe }}
</div>
<div class="tna-button-group tna-button-group--small">
<a href="{{ url_for('search.catalogue_item', id=highlight.image.record) }}" class="tna-button" itemprop="url">View record details</a>
<a href="{{ url_for('search.catalogue_item', id=highlight.image.record.iaid) }}" class="tna-button" itemprop="url">View record details</a>
</div>
</div>
</div>
Expand Down
9 changes: 3 additions & 6 deletions app/templates/explore-the-collection/record-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,18 @@ <h2 class="tna-heading-l">Why this record matters</h2>
<dl class="tna-dl tna-dl--plain">
<dt>Date</dt>
<dd>{{ page_data.date_text }}</dd>
{# TODO: get record_data from CMS #}
{%- if page_data.record_data and page_data.record_data.hierarchy | length %}
{% with parent = page_data.record_data.hierarchy | last %}
{%- if page_data.record %}
<dt>Catalogue reference</dt>
<dd>
<a href="{{ url_for('search.catalogue_item', id=parent.id) }}">{{ parent.identifier }}</a>
<a href="{{ url_for('search.catalogue_item', id=page_data.record.reference_number) }}">{{ page_data.record.reference_number }}</a>
</dd>
{% endwith %}
{%- endif %}
</dl>
{{ page_data.about | tna_html | safe }}
<div class="tna-button-group tna-button-group--full">
{{ tnaButton({
'text': 'View record details',
'href': url_for('search.catalogue_item', id=page_data.record),
'href': url_for('search.catalogue_item', id=page_data.record.iaid),
'accent': True
}) }}
{%- if page_data.image_library_link %}
Expand Down
6 changes: 2 additions & 4 deletions app/templates/macros/wagtail_blocks/record_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@
{% macro wagtailRecordLinks(block_value) %}
{% set items = [] %}
{%- for i in block_value['items'] %}
{# {% with parent = i.record_data.hierarchy | last %} #}
{# TODO: Get parent.identifier from CMS #}
{%- if i.thumbnail_image %}
{{ items.append({
'imageSrc': i.thumbnail_image.jpeg.full_url,
'width': i.thumbnail_image.jpeg.width,
'height': i.thumbnail_image.jpeg.height,
'collection': 'parent.identifier',
'title': i.descriptive_title,
'href': url_for('search.catalogue_item', id=i.record),
'href': url_for('search.catalogue_item', id=i.record.iaid),
'date': i.record_dates
}) or '' }}
{%- else %}
{{ items.append({
'collection': 'parent.identifier',
'title': i.descriptive_title,
'href': url_for('search.catalogue_item', id=i.record),
'href': url_for('search.catalogue_item', id=i.record.iaid),
'date': i.record_dates
}) or '' }}
{%- endif %}
Expand Down
3 changes: 0 additions & 3 deletions app/wagtail/pages/highlight_gallery_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ def highlight_gallery_page(page_data):
topics = pages_to_index_grid_items(page_data["topics"])
time_periods = pages_to_index_grid_items(page_data["time_periods"])
categories = pick_top_two(topics, time_periods)
for highlight in page_data["highlights"]:
# TODO: Remove once coming from the CMS
highlight["record_data"] = {}
return render_template(
"explore-the-collection/highlight-gallery.html",
breadcrumbs=breadcrumbs(page_data["id"]),
Expand Down
2 changes: 0 additions & 2 deletions app/wagtail/pages/record_article_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ def record_article_page(page_data):
topics = pages_to_index_grid_items(page_data["topics"])
time_periods = pages_to_index_grid_items(page_data["time_periods"])
categories = pick_top_two(topics, time_periods)
# TODO: Remove once coming from the CMS
page_data["record_data"] = {}
return render_template(
"explore-the-collection/record-article.html",
breadcrumbs=breadcrumbs(page_data["id"]),
Expand Down

0 comments on commit d6e5711

Please sign in to comment.