Skip to content

Commit dfb51a2

Browse files
authored
Fixed incorrect pairing of revisions fields & revision CSS (#4608)
<!-- Thanks for contributing to Hypha! Please ensure your contributions pass all necessary linting/testing and that the appropriate documentation has been updated. --> <!-- Describe briefly what your pull request changes. If this is resolving an issue, please specify below via "Fixes #<Github Issue ID>" --> Fixes #I4607. Some basic improvements to the revision view, ensures that fields are always in order and makes the CSS more consistent through the revisions. This is the first of a few enhancements to the revision view. ## Test Steps <!-- If step does not require manual testing, skip/remove this section. Give a brief overview of the steps required for a user/dev to test this contribution. Important things to include: - Required user roles for where necessary (ie. "As a Staff Admin...") - Clear & validatable expected results (ie. "Confirm the submit button is now not clickable") - Language that can be understood by non-technical testers if being tested by users --> - [ ] Ensure fields in the application revision view are in order and paired correctly with their header - [ ] Ensure the "altered" yellow margin appears on all relevant elements, not just `<p>`
1 parent d0f069b commit dfb51a2

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

hypha/apply/funds/views/revisions.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ class RevisionCompareView(DetailView):
7575
template_name = "funds/revisions_compare.html"
7676
pk_url_kwarg = "submission_pk"
7777

78+
# Specified to ensure template block order always aligns
79+
named_block_order = [
80+
"title",
81+
"full_name",
82+
"email",
83+
"address",
84+
"duration",
85+
"value",
86+
"organization",
87+
]
88+
7889
def compare_revisions(self, from_data, to_data):
7990
self.object.form_data = from_data.form_data
8091
from_rendered_text_fields = self.object.render_text_blocks_answers()
@@ -99,9 +110,15 @@ def compare_revisions(self, from_data, to_data):
99110
return (required_fields, stream_fields)
100111

101112
def render_required(self):
113+
# Ensure named blocks are ordered according to the template
114+
ordered_name_blocks = [
115+
block
116+
for block in self.named_block_order
117+
if block in self.object.named_blocks
118+
]
102119
return [
103120
getattr(self.object, "get_{}_display".format(field))()
104-
for field in self.object.named_blocks
121+
for field in ordered_name_blocks
105122
]
106123

107124
def get_context_data(self, **kwargs):

hypha/static_src/tailwind/components/html-diff.css

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
.html-diff {
2-
--marker-border-width: 0.2em;
3-
--marker-ms: -0.6em;
4-
--marker-ps: 0.5em;
2+
--marker-border-width: 3px;
3+
--marker-ms: -10px;
4+
--marker-ps: 8px;
55

6+
:is(h1, h2, h3, h4, h5, h6):has(ins),
7+
:is(h1, h2, h3, h4, h5, h6):has(del),
8+
ul:has(ins),
9+
ul:has(del),
10+
ol:has(ins),
11+
ol:has(del),
612
p:has(ins),
713
p:has(del) {
814
border-inline-start: var(--marker-border-width) solid var(--color-warning);
@@ -36,7 +42,8 @@
3642
border-inline-start: var(--marker-border-width) solid var(--color-success);
3743
}
3844

39-
del {
45+
del,
46+
del * {
4047
@apply bg-error text-error-content;
4148
}
4249

0 commit comments

Comments
 (0)