From 5cee181cfa757833b748745fd819fa52461353e6 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Fri, 14 Jun 2024 16:01:43 -0400 Subject: [PATCH 1/2] fix(search bar): show search bar dynamic results on all pages - removes styling from the listBox element - changes styling on its parent, the chantsDiv element --- .../cantusdb_project/main_app/templates/global_search_bar.html | 2 +- django/cantusdb_project/static/js/search_bar.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/cantusdb_project/main_app/templates/global_search_bar.html b/django/cantusdb_project/main_app/templates/global_search_bar.html index 0f82edbba..0ccd4e125 100644 --- a/django/cantusdb_project/main_app/templates/global_search_bar.html +++ b/django/cantusdb_project/main_app/templates/global_search_bar.html @@ -11,4 +11,4 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/django/cantusdb_project/static/js/search_bar.js b/django/cantusdb_project/static/js/search_bar.js index 58bc5385f..fe1fad889 100644 --- a/django/cantusdb_project/static/js/search_bar.js +++ b/django/cantusdb_project/static/js/search_bar.js @@ -31,7 +31,7 @@ function globalSearch() { xhttp.onload = function () { const data = JSON.parse(this.response); // the results are to be displayed in a list-group - chantsDiv.innerHTML = `
`; + chantsDiv.innerHTML = `
`; const listBox = document.getElementById("listBox"); // for every chant returned in the JSONResponse data.chants.map(chant => { From 58f656344069268b3b94b9ee32c98beb731281f8 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Mon, 17 Jun 2024 12:13:40 -0400 Subject: [PATCH 2/2] feat(frontend): sandwich main content with sidebar on narrow screens - create a new template "base_page_with_side_cards.html" from which other templates can inherit with styling to send some sidebar cards above main page content and some below main page content on narrow windows - adjust flatpages, article pages and main_app templates to use this template - get rid of independent, media-aware main-content margins (these are now accounted for in the template) --- .../articles/templates/article_detail.html | 61 +- .../articles/templates/article_list.html | 70 +- .../main_app/templates/browse_chants.html | 348 +++---- .../main_app/templates/chant_create.html | 552 ++++++----- .../main_app/templates/chant_detail.html | 906 +++++++++--------- .../main_app/templates/chant_edit.html | 890 +++++++++-------- .../main_app/templates/melody_search.html | 219 ++--- .../main_app/templates/source_detail.html | 620 ++++++------ .../main_app/templates/source_edit.html | 539 +++++------ .../main_app/templates/user_source_list.html | 178 ++-- django/cantusdb_project/templates/base.html | 7 - .../templates/base_page_with_side_cards.html | 27 + .../templates/flatpages/default.html | 280 +++--- 13 files changed, 2356 insertions(+), 2341 deletions(-) create mode 100644 django/cantusdb_project/templates/base_page_with_side_cards.html diff --git a/django/cantusdb_project/articles/templates/article_detail.html b/django/cantusdb_project/articles/templates/article_detail.html index 304d71427..6bf4813b7 100644 --- a/django/cantusdb_project/articles/templates/article_detail.html +++ b/django/cantusdb_project/articles/templates/article_detail.html @@ -1,40 +1,39 @@ -{% extends "base.html" %} +{% extends "base_page_with_side_cards.html" %} {% load helper_tags %} {# for recent_articles #} -{% block content %} -
- {{ article.title }} | Cantus Database +{% block title %} +{{ article.title }} | Cantus Database +{% endblock %} + +{% block uppersidebar %} + +{% endblock %} + +{% block maincontent %} +

+ {{ article.title }} +

-
-

- {{ article.title }} -

-
-
-
-
- Submitted by {{ article.author }} on {{ article.date_created|date:"D, m/d/Y - H:i" }} -
- {{ article.body.html|safe }} -
-
+
+
+
+ Submitted by {{ article.author }} on {{ article.date_created|date:"D, m/d/Y - H:i" }} +
+ {{ article.body.html|safe }}
- +{% endblock %} +{% block lowersidebar %} +
+
+ What's New +
+
+ {% recent_articles %}
- -
{% endblock %} \ No newline at end of file diff --git a/django/cantusdb_project/articles/templates/article_list.html b/django/cantusdb_project/articles/templates/article_list.html index 29233a8d3..993286b2a 100644 --- a/django/cantusdb_project/articles/templates/article_list.html +++ b/django/cantusdb_project/articles/templates/article_list.html @@ -1,43 +1,39 @@ -{% extends "base.html" %} -{% load helper_tags %} {# for recent_articles #} -{% block content %} -
- What's New | Cantus Database +{% extends "base_page_with_side_cards.html" %} +{% load helper_tags %} {# for recent_articles #}\ +{% block title %} +What's New | Cantus Database +{% endblock %} +{% block uppersidebar %} + +{% endblock %} +{% block maincontent %} +

What's New

+ {% for article in articles %}
-
-

What's New

- {% for article in articles %} -
-
- {{ article.date_created|date:"D, m/d/Y - H:i" }} -

- {{ article.title }} -

-
- - {{ article.body.html|safe|truncatechars_html:3000 }} - -
-
+
+ {{ article.date_created|date:"D, m/d/Y - H:i" }} +

+ {{ article.title }} +

+
+ + {{ article.body.html|safe|truncatechars_html:3000 }} +
- {% endfor %} - {% include "pagination.html" %} -
- + {% endfor %} + {% include "pagination.html" %} +{% endblock %} +{% block lowersidebar %} +
+
+ What's New +
+
+ {% recent_articles %}
-
{% endblock %} \ No newline at end of file diff --git a/django/cantusdb_project/main_app/templates/browse_chants.html b/django/cantusdb_project/main_app/templates/browse_chants.html index a768f9a78..eccafbb7e 100644 --- a/django/cantusdb_project/main_app/templates/browse_chants.html +++ b/django/cantusdb_project/main_app/templates/browse_chants.html @@ -1,191 +1,191 @@ -{% extends "base.html" %} -{% block content %} +{% extends "base_page_with_side_cards.html" %} +{% block title %} Browse Chants | Cantus Database - - -
-
-
-

Browse Chants

- Displaying {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }} chants - -
-
-
- - -
-
- -
-
- - -
-
+{% endblock %} -
-
- - -
+{% block script %} + +{% endblock %} -
- - -
-
+{% block uppersidebar %} + +{% endblock %} -
- {% with exists_on_cantus_ultimus=source.exists_on_cantus_ultimus %} - {% if chants %} - - - - - - - - - - - - - - - {% if user_can_edit_chant %} - - {% endif %} - - - - {% for chant in chants %} - - - - {# default_if_none: sometimes, c_sequence is 0, and should still be displayed #} - - - - - - - - - {% if user_can_edit_chant %} - - {% endif %} - - {% endfor %} - -
SiglumFolioIncipit / Full textFeastCantusIDMode
{{ source.siglum|default:"" }}{{ chant.folio|default:"" }}{{ chant.c_sequence|default_if_none:"" }} - {{ chant.incipit|default:"" }} -

{{ chant.manuscript_full_text_std_spelling|default:"" }}
- {% if chant.volpiano %} - {{ chant.volpiano|default:"" }} - {% endif %} -

-
- {% if chant.feast %} - {{ chant.feast.name|default:"" }} - {% endif %} - - {% if chant.office %} - {{ chant.office.name|default:"" }} - {% endif %} - - {% if chant.genre %} - {{ chant.genre.name|default:"" }} - {% endif %} - {{ chant.position|default:"" }} - {{ chant.cantus_id|default:"" }} - {{ chant.mode|default:"" }} - {% if exists_on_cantus_ultimus %} - - Image - - {% elif chant.image_link %} - Image - {% endif %} - - Edit -
- {% include "pagination.html" %} - {% else %} - No chants found. - {% endif %} - {% endwith %} -
+{% block maincontent %} +

Browse Chants

+ Displaying {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }} chants -