Skip to content

Commit

Permalink
Merge pull request #1712 from dchiller/i1703-global-search-bar-results
Browse files Browse the repository at this point in the history
fix(global search bar): display result data with embedded search bar
  • Loading branch information
dchiller authored Dec 2, 2024
2 parents 0083170 + 0561179 commit e4dddb8
Show file tree
Hide file tree
Showing 25 changed files with 374 additions and 378 deletions.
31 changes: 16 additions & 15 deletions django/cantusdb_project/main_app/templates/century_detail.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{% extends "base.html" %}
{% extends "single_column_with_search_bar.html" %}

{% block title %}
<title>{{ century.name }} | Cantus Database</title>
{% endblock %}

{% block content %}
<div class="mr-3 p-3 mx-auto bg-white rounded">
<object align="right" class="search-bar">
{% include "global_search_bar.html" %}
</object>
{% block header %}
<h3>{{ century.name }}</h3>
<ul>
{% for source in sources %}
<li>
<a href="{% url 'source-detail' source.id %}" title="{{ source.short_heading }}">
{{ source.heading }}
</a>
</li>
{% endfor %}
</ul>
{% endblock %}
{% block maincontent %}
<div class="row">
<div class="col">
<ul>
{% for source in sources %}
<li>
<a href="{% url 'source-detail' source.id %}" title="{{ source.short_heading }}">
{{ source.heading }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
76 changes: 31 additions & 45 deletions django/cantusdb_project/main_app/templates/chant_search.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% extends "single_column_with_search_bar.html" %}
{% load humanize %}

{% block title %}
<title>Search Chants | Cantus Database</title>
Expand All @@ -8,87 +9,78 @@
<script src="/static/js/chant_search.js"></script>
{% endblock %}

{% block content %}
<div class="mr-3 p-3 col-md-12 mx-auto bg-white rounded">
<object align="right" class="search-bar">
{% include "global_search_bar.html" %}
</object>
{% block header %}
<h3>Search Chants</h3>
{% endblock %}
{% block maincontent %}
{% if source %}
<p>
<b>Searching in source: <a href="{% url 'source-detail' source.id %}" target="_blank">{{ source.short_heading }}</a></b>
</p>
{% elif keyword %}
<p>
<small>
<p class="small">
» <a href="https://cantusindex.org/search?t={{ keyword }}" title="Search {{ keyword }} on CantusIndex.org" target="_blank">
Search <b>{{ keyword }}</b> on CantusIndex.org
</a>
</small>
</p>
{% endif %}

{% if chants.all %}
<p>
<small>Displaying {{ page_obj.start_index }}-{{ page_obj.end_index }} of <b>{{ page_obj.paginator.count }}
chant{{ page_obj.paginator.count|pluralize }}</b></small>
<p class="small">
Displaying {{ page_obj.start_index }}-{{ page_obj.end_index }} of <b>{{ page_obj.paginator.count|intcomma }}</b>
chant{{ page_obj.paginator.count|pluralize }}.
</p>
{% endif %}

<form method="get">
<div class="form-row align-items-end">
<div class="form-group m-1 col-12">
<label for="keywordSearch"><small>Keyword search</small></label>
</div>
</div>
<div class="form-row align-items-end">
<div class="form-group m-1 col-lg-3 col-sm-3 col-3">
<div class="form-group col-sm-3 col-12">
<label for="keywordSearch" class="small">Keyword search</label>
<select class="form-control custom-select custom-select-sm" id="opFilter" name="op">
<option selected value="contains">Contains</option>
<option value="starts_with">Starts with</option>
</select>
</div>
<div class="form-group m-1 col-lg col-sm col-">
<div class="form-group col-sm-9 col-12">
<input type="text" class="form-control form-control-sm" name="keyword" id="keywordSearch" value="{{ request.GET.keyword }}" />
</div>
</div>
<div class="form-row align-items-end">
<div class="form-group m-1 col-lg-3 col-sm-6">
<label for="serviceFilter"><small>Service</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="serviceFilter" class="small">Service</label>
<select id="serviceFilter" name="service" class="form-control custom-select custom-select-sm">
<option value="">- Any -</option>
{% for service in services %}
<option value="{{ service.id }}">{{ service.name }}</option>
{% endfor %}
</select>
</div>
<div class="form-group m-1 col-lg-3 col-sm">
<label for="genreFilter"><small>Genre</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="genreFilter" class="small">Genre</label>
<select id="genreFilter" name="genre" class="form-control custom-select custom-select-sm">
<option value="">- Any -</option>
{% for genre in genres %}
<option value="{{ genre.id }}">{{ genre.name }}</option>
{% endfor %}
</select>
</div>
<div class="form-group m-1 col-lg-3 col-sm-6">
<label for="cantus_id"><small>Cantus ID</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="cantus_id" class="small">Cantus ID</label>
<input type="text" class="form-control form-control-sm" name="cantus_id" id="cantus_id" value="{{ request.GET.cantus_id }}" />
</div>
<div class="form-group m-1 col-lg col-sm">
<label for="mode"><small>Mode</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="mode" class="small">Mode</label>
<input type="text" class="form-control form-control-sm" name="mode" id="mode" value="{{ request.GET.mode }}" />
</div>
<div class="form-group m-1 col-lg-3 col-sm-6">
<label for="feast"><small>Feast</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="feast" class="small">Feast</label>
<input type="text" class="form-control form-control-sm" name="feast" id="feast" value="{{ request.GET.feast }}" />
</div>
<div class="form-group m-1 col-lg-3 col-sm">
<label for="position"><small>Position</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="position" class="small">Position</label>
<input type="text" class="form-control form-control-sm" name="position" id="position" value="{{ request.GET.position }}" />
</div>
<div class="form-group m-1 col-lg-3 col-sm-6">
<label for="melodiesFilter"><small>Melodies</small></label>
<div class="form-group col-lg-3 col-sm-6 col-12">
<label for="melodiesFilter" class="small">Melodies</label>
<select class="form-control custom-select custom-select-sm" id="melodiesFilter" name="melodies">
<option value="">- Any -</option>
<option value="true">Chants with melodies</option>
Expand All @@ -97,25 +89,21 @@ <h3>Search Chants</h3>
</div>
{% if source %}
<div class="form-row align-items-end">
<div class="form-group m-1 col-12">
<label for="indexingNotesSearch"><small>Indexing notes search</small></label>
</div>
</div>
<div class="form-row align-items-end">
<div class="form-group m-1 col-lg-3 col-sm-3 col-3">
<div class="form-group col-sm-3 col-12">
<label for="indexingNotesSearch" class="small">Indexing notes search</label>
<select class="form-control custom-select custom-select-sm" id="indexingNotesOp" name="indexing_notes_op">
<option selected value="contains">Contains</option>
<option value="starts_with">Starts with</option>
</select>
</div>
<div class="form-group m-1 col-lg col-sm col-">
<div class="form-group col-sm-9 col-12">
<input type="text" class="form-control form-control-sm" id="indexingNotesSearch" name="indexing_notes" value="{{ request.GET.indexing_notes }}" />
</div>
</div>
{% endif %}

<div class="form-row align-items-end">
<div class="form-group m-2 col-lg">
<div class="form-group col-lg">
<button type="submit" class="btn btn-dark btn-sm" id="btn-submit"> Apply </button>
</div>
</div>
Expand Down Expand Up @@ -315,12 +303,10 @@ <h3>Search Chants</h3>
</tbody>
</table>
</div>

{% include "pagination.html" %}
{% else %}
{% if request.GET %}
No chants found.
<p class="text-center">No chants found.</p>
{% endif %}
{% endif %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{% extends "base.html" %}
{% extends "filterable_table_with_search_bar.html" %}

{% block title %}
<title>Chants by Cantus ID: {{ cantus_id }} | Cantus Database</title>
{% endblock %}

{% block content %}
<div class="mr-3 p-3 col-md-12 mx-auto bg-white rounded">
<!-- global search bar-->
<object align="right" class="search-bar">
{% include "global_search_bar.html" %}
</object>
{% block header %}
<h3>
Chants by Cantus ID: <a href="https://cantusindex.org/id/{{ cantus_id }}" target="_blank">
{{ cantus_id }}
</a>
</h3>
<small>Displaying {{ page_obj.start_index }}-{{ page_obj.end_index }} of <b>{{ page_obj.paginator.count }}</b> chants</small>
{% endblock %}
{% block list_table %}
<div class="table-responsive">
<table class="table table-bordered table-sm small">
<thead>
Expand Down Expand Up @@ -78,9 +74,9 @@ <h3>
<td class="text-wrap">
{{ chant.mode|default:"" }}
</td>
<td class="text-wrap" style="font-family: volpiano; font-size:30px">
<td class="text-wrap text-center">
{% if chant.volpiano %}
<a href="{% url 'chant-detail' chant.id %}" style="text-decoration: none" title="Chant has volpiano melody">1</a>
<a href="{% url 'chant-detail' chant.id %}" style="text-decoration: none" title="Chant has volpiano melody"></a>
{% endif %}
</td>
<td class="text-wrap">
Expand All @@ -93,6 +89,4 @@ <h3>
</tbody>
</table>
</div>
{% include "pagination.html" %}
</div>
{% endblock %}
20 changes: 9 additions & 11 deletions django/cantusdb_project/main_app/templates/contact.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{% extends "base.html" %}
{% extends "single_column_with_search_bar.html" %}

{% block title %}
<title>Contact | Cantus Database</title>
{% endblock %}

{% block content %}
<div class="mr-3 p-3 mx-auto bg-white rounded">
<!-- global search bar-->
<object align="right" class="search-bar">
{% include "global_search_bar.html" %}
</object>

{% block header %}
<h3>Contact</h3>
<p style="padding-top: 25px;">Please direct questions or comments about Cantus Database to Debra Lacoste at <a href="mailto:[email protected]">[email protected]</a>.</p>

</div>
{% endblock %}
{% block maincontent %}
<div class="row">
<div class="col">
<p class="pt-4">Please direct questions or comments about Cantus Database to Debra Lacoste at <a href="mailto:[email protected]">[email protected]</a>.</p>
</div>
</div>
{% endblock %}
19 changes: 7 additions & 12 deletions django/cantusdb_project/main_app/templates/feast_detail.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{% extends "base.html" %}
{% extends "single_column_with_search_bar.html" %}
{% load helper_tags %} {# for month_to_string #}

{% block title %}
<title>{{ feast.name }} | Cantus Database</title>
{% endblock %}

{% block content %}
<div class="mr-3 p-3 mx-auto bg-white rounded">
<object align="right" class="search-bar">
{% include "global_search_bar.html" %}
</object>
{% block header %}
<h3>{{ feast.name }}</h3>
<p>{{ feast.description }}</p>

<br>
{% endblock %}
{% block maincontent %}
<div class="row px-3">
<p>{{ feast.description }}</p>
</div>
<div class="row">
{% if feast.feast_code %}
<div class="col">
Expand Down Expand Up @@ -42,8 +40,6 @@ <h3>{{ feast.name }}</h3>
</div>
{% endif %}
</div>

<br>
<div class="row">
{% if frequent_chants %}
<div class="col">
Expand Down Expand Up @@ -104,5 +100,4 @@ <h4>Sources containing the feast</h4>
</div>
{% endif %}
</div>
</div>
{% endblock %}
32 changes: 13 additions & 19 deletions django/cantusdb_project/main_app/templates/feast_list.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "filterable_table_with_search_bar.html" %}
{% load helper_tags %} {# for month_to_string #}

{% block title %}
Expand All @@ -9,29 +9,25 @@
<script src="/static/js/feast_list.js"></script>
{% endblock %}

{% block content %}
<div class="mr-3 p-3 col-md-12 mx-auto bg-white rounded">
<object align="right" class="search-bar">
{% include "global_search_bar.html" %}
</object>

{% block header %}
<h3>List of Feasts</h3>
<small>Displaying {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }}</small>
{% endblock %}
{% block list_filter_form %}
<form method="get">
<div class="form-row align-items-end">
<div class="form-group m-1 col-lg-5">
<div class="form-group mr-1 col-lg-5">
<label for="feastSearch"><small>Search feasts/feast codes</small></label>
<input id="feastSearch" name="q" type="text" class="form-control form-control-sm" placeholder="Type any part of a word or feast code" value="{{ request.GET.q }}" />
</div>
<div class="form-group m-1 col-lg">
<div class="form-group mr-1 col-lg">
<label for="dateFilter"><small>Temp/Sanc</small></label>
<select id="dateFilter" name="date" class="form-control custom-select custom-select-sm">
<option value="">- Any -</option>
<option value="temp">Temporale</option>
<option value="sanc">Sanctorale</option>
</select>
</div>
<div class="form-group m-1 col-lg">
<div class="form-group mr-1 col-lg">
<label for="monthFilter"><small>Month</small></label>
<select id="monthFilter" name="month" class="form-control custom-select custom-select-sm">
<option value="">- Any -</option>
Expand All @@ -49,18 +45,20 @@ <h3>List of Feasts</h3>
<option value="10">October</option>
</select>
</div>
<div class="form-group m-1 col-lg-2">
<label for="sortBy"><small>Sort By</small></label>
<div class="form-group mr-1 col-lg-2">
<label for="sortBy"><small>Sort by</small></label>
<select class="form-control custom-select custom-select-sm" id="sortBy" name="sort_by">
<option value="name">Feast Name</option>
<option value="feast_code">Feast Code (Date)</option>
</select>
</div>
<div class="form-group m-1 col-lg">
<div class="form-group col-lg">
<button type="submit" class="btn btn-dark btn-sm"> Apply </button>
</div>
</div>
</form>
{% endblock %}
{% block list_table %}
{% if feasts %}
<table class="table table-bordered table-sm small">
<thead>
Expand Down Expand Up @@ -89,10 +87,6 @@ <h3>List of Feasts</h3>
</tr>
{% endfor %}
</tbody>
</table>
{% include "pagination.html" %}
{% else %}
No feasts found.
</table>
{% endif %}
</div>
{% endblock %}
Loading

0 comments on commit e4dddb8

Please sign in to comment.