diff --git a/material/filters.py b/material/filters.py index dc57cca..67c5da3 100644 --- a/material/filters.py +++ b/material/filters.py @@ -62,6 +62,26 @@ class TextileFilter(django_filters.FilterSet): keywords = django_filters.CharFilter( field_name="keywords__name", lookup_expr="icontains", label="Keywords" ) + text_search = django_filters.CharFilter( + method="search_text", + label="Text search", + ) + + def search_text(self, queryset, name, value): + return queryset.filter( + Q(year__icontains=value) + | Q(primary_textile_types__name__icontains=value) + | Q(secondary_textile_types__name__icontains=value) + | Q(source_type__icontains=value) + | Q(circulation__icontains=value) + | Q(source_reference__icontains=value) + | Q(from_area__name__icontains=value) + | Q(to_area__name__icontains=value) + | Q(from_place__city__icontains=value) + | Q(to_place__city__icontains=value) + | Q(summary_of_record__icontains=value) + | Q(transcription__icontains=value) + ) class Meta: model = TextileRecord @@ -79,5 +99,6 @@ class Meta: "summary_of_record", "transcription", "keywords", + "text_search", ] empty_text = "No results match the search criteria." diff --git a/material/tables.py b/material/tables.py index eade4ee..29679f1 100644 --- a/material/tables.py +++ b/material/tables.py @@ -10,9 +10,18 @@ class TextileTable(tables.Table): image = tables.TemplateColumn( template_name="database/image_display.html", - verbose_name="Image", + verbose_name="Preview", orderable=False, ) + id = tables.TemplateColumn( + template_code=""" +
+ View Item {{ record.id }} record +
+ """, + orderable=False, + verbose_name="Item ID", + ) year = tables.Column(verbose_name="Year", orderable=False) textile_type = tables.TemplateColumn( template_name="database/textile_type.html", @@ -46,6 +55,7 @@ class Meta: "class": "min-w-full divide-y divide-gray-200", } fields = ( + "id", "image", "year", "textile_type", diff --git a/static/img/gmu-logo.png b/static/img/gmu-logo.png index 31125fc..32bb268 100644 Binary files a/static/img/gmu-logo.png and b/static/img/gmu-logo.png differ diff --git a/static/js/database.js b/static/js/database.js index bcb3e4b..6e04808 100644 --- a/static/js/database.js +++ b/static/js/database.js @@ -122,23 +122,32 @@ function openModal(recordId, recordUrl) { // Populate the modal content with the fetched data const modalContent = document.getElementById("modal-content"); modalContent.innerHTML = ` -

To Area: ${safeData(data.to_area)}

-

From Area: ${safeData(data.from_area)}

-

To Place: ${safeData(data.to_place)}

-

From Place: ${safeData(data.from_place)}

-

Transcription:

+

Record ID: ${recordId}

+

Originating Area: ${safeData(data.from_area)}

+

Originating Place: ${safeData(data.from_place)}

+

Destination Area: ${safeData(data.to_area)}

+

Destination Place: ${safeData(data.to_place)}

+

Summary of Record: ${safeData( + data.summary_of_record, + )}

+ +

Excerpt from Record:

${safeData( data.transcription, )}

${safeData( data.source_reference, )}

-

Summary of Record: ${safeData( - data.summary_of_record, +

Source Reference: ${safeData( + data.source_reference, )}

Source Type: ${safeData(data.source_type)}

+

Description of Source: ${safeData( + data.description_of_source, + )}

+

Record Creator: ${safeData(data.record_creator)}

- View Full Record Details + View Full Record Details
`; diff --git a/templates/database/image_display.html b/templates/database/image_display.html index 10c7a89..4713e9c 100644 --- a/templates/database/image_display.html +++ b/templates/database/image_display.html @@ -1,10 +1,14 @@
- {% if record.images.exists %} - - {{ record.images.first.alt_text }} - - {% else %} -

No images attached.

- {% endif %} - View item details -
\ No newline at end of file + {% if record.images.exists %} + + {{ record.images.first.alt_text }} + + {% else %} +

No images attached.

+ {% endif %} + + diff --git a/templates/database/textile_records_single.html b/templates/database/textile_records_single.html index 32f5932..0e2ae2a 100644 --- a/templates/database/textile_records_single.html +++ b/templates/database/textile_records_single.html @@ -16,9 +16,9 @@

Summary

Record Excerpt

{% if item.transcription %} -
{{ item.transcription }}
+
{{ item.transcription }}
{% else %} -
No transcription available.
+
No transcription available.
{% endif %} {% if item.source_reference %}

Source: {{ item.source_reference }}

@@ -48,7 +48,7 @@

Map


-
+

Item Metadata

Primary Textile Types: diff --git a/templates/database/textile_table.html b/templates/database/textile_table.html index 0586fb5..0bb030b 100644 --- a/templates/database/textile_table.html +++ b/templates/database/textile_table.html @@ -63,4 +63,4 @@

-{% endblock pagination.next %} \ No newline at end of file +{% endblock pagination.next %} diff --git a/templates/database/textiles.html b/templates/database/textiles.html index 8363f73..c1bfa7a 100644 --- a/templates/database/textiles.html +++ b/templates/database/textiles.html @@ -14,7 +14,7 @@

Textiles Database

{# Search form #} -
+
Filters @@ -91,7 +91,7 @@

Textiles Database

- +
+
+ + +
- - + +
@@ -146,4 +150,4 @@