From 80a191ee8f8be9ef44d77e0f993a3b5b66d73274 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Date: Mon, 16 Oct 2023 14:30:23 +0530 Subject: [PATCH] Update typography of rendered rich text answers (#3601) Fixes: #3594 - Update headings and paragraph to use tailwind/typrography. - Add border bottom for questions rendering to distinguish it with headings in the rendered answers [1] - Add styled table [2] --- .../determinations/determination_detail.html | 2 +- .../funds/includes/rendered_answers.html | 16 +++--- .../templates/review/review_detail.html | 4 +- .../templates/stream_forms/render_field.html | 6 +-- .../src/sass/apply/components/_rich-text.scss | 52 ++++++++++++------- 5 files changed, 49 insertions(+), 31 deletions(-) diff --git a/hypha/apply/determinations/templates/determinations/determination_detail.html b/hypha/apply/determinations/templates/determinations/determination_detail.html index 68f9e11322..a6cef47d48 100644 --- a/hypha/apply/determinations/templates/determinations/determination_detail.html +++ b/hypha/apply/determinations/templates/determinations/determination_detail.html @@ -30,7 +30,7 @@
{% endif %} -
+

{% trans "Determination message" %}

{{ determination.message|bleach }} {% for group in determination.detailed_data.values %} diff --git a/hypha/apply/funds/templates/funds/includes/rendered_answers.html b/hypha/apply/funds/templates/funds/includes/rendered_answers.html index f6127bd817..1f28aab99c 100644 --- a/hypha/apply/funds/templates/funds/includes/rendered_answers.html +++ b/hypha/apply/funds/templates/funds/includes/rendered_answers.html @@ -1,38 +1,38 @@ {% load i18n wagtailusers_tags workflow_tags %} -

{% trans "Proposal Information" %}

+

{% trans "Proposal Information" %}

{% if object.get_value_display != "-" %}
-
{% trans "Requested Funding" %}
+
{% trans "Requested Funding" %}
{{ object.get_value_display }}
{% endif %} {% if object.get_duration_display != "-" %}
-
{% trans "Project Duration" %}
+
{% trans "Project Duration" %}
{{ object.get_duration_display }}
{% endif %}
-
{% trans "Legal Name" %}
- {{ object.get_full_name_display }}{% if request.user.is_apply_staff %} ({% trans "Edit account" %}){% endif %} +
{% trans "Legal Name" %}
{% if request.user.is_apply_staff %} ({% trans "Edit" %}){% endif %} + {{ object.get_full_name_display }}
-
{% trans "E-mail" %}
+
{% trans "E-mail" %}
{{ object.get_email_display }}
{% if object.get_address_display != "-" %}
-
{% trans "Address" %}
+
{% trans "Address" %}
{{ object.get_address_display }}
{% endif %} {% if object.get_organization_name_display != "-" %}
-
{% trans "Organization name" %}
+
{% trans "Organization name" %}
{{ object.get_organization_name_display }}
{% endif %} diff --git a/hypha/apply/review/templates/review/review_detail.html b/hypha/apply/review/templates/review/review_detail.html index c9b55b755d..5295084938 100644 --- a/hypha/apply/review/templates/review/review_detail.html +++ b/hypha/apply/review/templates/review/review_detail.html @@ -60,7 +60,9 @@
{% trans "Review was not against the latest version" %}:
{{ object.get_comments_display|submission_links }} - {{ object.output_answers|submission_links }} +
+ {{ object.output_answers|submission_links }} +
{% if form %} diff --git a/hypha/apply/stream_forms/templates/stream_forms/render_field.html b/hypha/apply/stream_forms/templates/stream_forms/render_field.html index a6bb449491..89c950364e 100644 --- a/hypha/apply/stream_forms/templates/stream_forms/render_field.html +++ b/hypha/apply/stream_forms/templates/stream_forms/render_field.html @@ -1,9 +1,9 @@ {% if include_question %} -
-

{{ value.field_label }}

+
+

{{ value.field_label }}

{% endif %} -
+
{% block data_display %}

{{ data }}

{% endblock %}
diff --git a/hypha/static_src/src/sass/apply/components/_rich-text.scss b/hypha/static_src/src/sass/apply/components/_rich-text.scss index 8b6e35aa7e..313ff3b329 100644 --- a/hypha/static_src/src/sass/apply/components/_rich-text.scss +++ b/hypha/static_src/src/sass/apply/components/_rich-text.scss @@ -18,25 +18,38 @@ } h1 { - font-size: 20px; - font-family: $font--primary; + font-size: 1.296rem; + margin-bottom: 1em; + font-weight: 600; + line-height: 1.3333; + } + + h1:not(:first-child) { + margin-top: 2em; } h2 { - font-size: 18px; - font-family: $font--primary; + font-size: 1.215rem; + margin-top: 1.6em; + margin-bottom: 0.6em; + line-height: 1.6; + font-weight: 600; } h3, - h4:not(.question), - h5, - h6 { - font-size: 16px; - font-family: $font--primary; + h4:not(.question) { + font-size: 1.138rem; + margin-top: 1.5em; + margin-bottom: 0.5em; + line-height: 1.5; } - .question { - margin: 0; + h5, + h6 { + font-size: 1.067rem; + margin-top: 1.4em; + margin-bottom: 0.4em; + line-height: 1.4; } &--hidden { @@ -47,23 +60,26 @@ } } + // This is a hack to make sure a copy pasted table with width property on it + // doesn't break the layout. The margin from the table is removed and transferred + // to the parent element, because the table is wrapped in a div with overflow: auto &__table { overflow: auto; + margin-top: 1.25em; + margin-bottom: 1.25em; + + > table { + margin-top: 0; + margin-bottom: 0; + } } ul { - padding-left: 20px; - list-style: outside disc; - &.remove-list-style { padding: 0; list-style: none; } } - - ol { - list-style: inside decimal; - } } .tox-statusbar {