Skip to content

Commit

Permalink
refactor: Display record in single view and table
Browse files Browse the repository at this point in the history
  • Loading branch information
hepplerj committed Jul 15, 2024
1 parent 41a9469 commit 5a4017a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion material/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class TextileRecord(models.Model):
updated_at = models.DateTimeField(auto_now=True)

def __str__(self) -> str:
return f"{self.year}"
return f"Item ID {self.id}"

class Meta:
# default sort by year
Expand Down
1 change: 1 addition & 0 deletions material/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class Meta:
"year",
"source_type",
"circulation",
"source_reference",
"from_area",
"to_area",
# "keywords",
Expand Down
26 changes: 16 additions & 10 deletions templates/database/textile_records_single.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ <h1 class="text-3xl mb-4">{{ item.year }}</h1>

<h2 class="text-xl mb-4">Summary</h2>
<div class="font-serif text-lg mb-4">
<p class="mb-2">{{ item.summary }}</p>
{% if item.summary %}
<p class="mb-2">{{ item.summary }}</p>
{% else %}
<p class="mb-2">No summary is available for this item.</p>
{% endif %}
</div>

<h2 class="text-xl mb-4">Record Excerpt</h2>
<div class="font-serif text-lg mb-4">
<blockquote class="pl-4 border-l-2 border-red-200 italic">{{ item.transcription }}</blockquote>
<p class="text-sm text-right">Source: {{ item.source_reference }}</p>
</div>

{# if images are attached, display them all #}
Expand All @@ -31,18 +36,19 @@ <h2 class="text-xl mb-4">Images</h2>

<hr class="my-8">

<div class="bg-amber-50 p-3">
<div class="bg-gray-50 p-3">
<h3 class="text-lg mb-4">Item Data</h3>
<div>
<p class="text-xs">Textile type: {{ item.textile_type }}</p>
<p class="text-xs">Textile sub-type: {{ item.textile_subtype }}</p>
<p class="text-xs">Subject type: {{ item.subject_type }}</p>
<p class="text-xs">Subject sub-type: {{ item.subject_subtype }}</p>
<p class="text-base">Textile type: {{ item.textile_type }}</p>
<p class="text-base">Textile sub-type: {{ item.textile_subtype }}</p>
<p class="text-base">Subject type: {{ item.subject_type }}</p>
<p class="text-base">Subject sub-type: {{ item.subject_subtype }}</p>
</div>
<div>
<p class="text-xs">Circulation: {{ item.circulation }}</p>
<p class="text-xs">Source type: {{ item.source_type }}</p>
<p class="text-xs">Year: {{ item.year }}</p>
<p class="text-base">Circulation: {{ item.circulation }}</p>
<p class="text-base">Source type: {{ item.source_type }}</p>
<p class="text-base">Year: {{ item.year }}</p>
<p class="text-base">Reference: {{ item.source_reference }}</p>
</div>
</div>
{% endblock content %}
{% endblock content %}

0 comments on commit 5a4017a

Please sign in to comment.