Skip to content

Commit e363c1e

Browse files
frjogmurtaza00bickelj
authored
Submission data on determination and review form page (#4142)
Fixes #3971 Co-authored-by: Ghulam Murtaza <[email protected]> Co-authored-by: Jesse Bickel <[email protected]>
1 parent b3de17d commit e363c1e

File tree

7 files changed

+135
-39
lines changed

7 files changed

+135
-39
lines changed

hypha/apply/determinations/templates/determinations/base_determination_form.html

+41-7
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,33 @@
33
{% block title %}{% if object %}{% trans "Edit a Determination" %} {% if object.is_draft %}{% trans "draft" %}{% endif %}{% else %}{% trans "Create a Determination" %}{% endif %}{% endblock %}
44
{% block content %}
55

6-
{% adminbar %}
7-
{% slot header %}{% if object %}{% trans "Update Determination draft" %}{% else %}{% trans "Create Determination" %}{% endif %}{% endslot %}
8-
{% slot sub_heading %}{% if submission %}{% trans "For" %} <a class="text-blue-300 hover:underline" href="{% url "funds:submissions:detail" submission.id %}">{{ submission.title_text_display }}</a>{% endif %}{% endslot %}
9-
{% endadminbar %}
6+
{% block adminbar %}
7+
{% adminbar %}
8+
{% slot header %}{% if object %}{% trans "Update Determination draft" %}{% else %}{% trans "Create Determination" %}{% endif %}{% endslot %}
9+
{% slot sub_heading %}{% if submission %}{% trans "For" %} <a class="text-blue-300 hover:underline" href="{% url "funds:submissions:detail" submission.id %}">{{ submission.title_text_display }}</a>{% endif %}{% endslot %}
10+
{% slot buttons %}
11+
<button
12+
class="tab__item ms-auto block pb-4"
13+
x-data
14+
@click="showSubmission = !showSubmission"
15+
>
16+
<span x-show="!showSubmission">{% trans "Show application" %}</span>
17+
<span x-show="showSubmission">{% trans "Hide application" %}</span>
18+
</button>
19+
</a>
20+
{% endslot %}
21+
{% endadminbar %}
22+
{% endblock %}
1023

1124
{% block form %}
12-
<section class="my-8">
25+
<section class="my-8 flex justify-between" :class="showSubmission ? '' : 'flex-col'">
1326
{% include "forms/includes/form_errors.html" with form=form %}
1427
{% block determination_information %}
1528
{% endblock %}
16-
<form class="form max-w-3xl" action="" method="post" x-data="{ isFormSubmitting: false }" x-on:submit="isFormSubmitting = true">
29+
<form class="form max-w-3xl flex-1"
30+
action="" method="post"
31+
x-data="{ isFormSubmitting: false }"
32+
x-on:submit="isFormSubmitting = true">
1733
{{ form.media }}
1834
{% csrf_token %}
1935
{% for hidden in form.hidden_fields %}
@@ -48,8 +64,26 @@ <h2>{{ value }}</h2>
4864
{{ message }}
4965
</div>
5066
{% endfor %}
67+
{% block show_submission %}
68+
<aside :class="showSubmission ? 'flex-1 ps-4' : ''">
69+
<section
70+
class="p-4 overflow-y-auto bg-white shadow-xl max-h-screen"
71+
x-show="showSubmission"
72+
x-transition:enter="transition ease-out duration-250"
73+
x-transition:enter-start="transform opacity-0 translate-x-full"
74+
x-transition:enter-end="transform opacity-100 translate-x-0"
75+
x-transition:leave="transition ease-in duration-150"
76+
x-transition:leave-start="transform opacity-100 translate-x-0"
77+
x-transition:leave-end="transform opacity-0 translate-x-full"
78+
hx-get="{% url 'funds:submissions:partial-answers' submission.id %}"
79+
hx-trigger="intersect once"
80+
>
81+
<p>{% trans "Loading…" %}</p>
82+
</section>
83+
</aside>
84+
{% endblock %}
85+
</section>
5186
{% endblock %}
52-
</section>
5387
{% endblock %}
5488

5589
{% block extra_js %}

hypha/apply/determinations/templates/determinations/batch_determination_form.html

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
<link rel="stylesheet" href="{% static 'css/fancybox.css' %}">
77
{% endblock %}
88

9-
{% adminbar %}
10-
{% slot header %}{% trans "Add Batch Determination" %} - {{ action_name }}{% endslot %}
11-
{% endadminbar %}
9+
{% block adminbar %}
10+
{% adminbar %}
11+
{% slot header %}{% trans "Add Batch Determination" %} - {{ action_name }}{% endslot %}
12+
{% endadminbar %}
13+
{% endblock %}
1214

1315
{% block determination_information %}
1416
<div class="list-reveal list-reveal--determination">
@@ -33,6 +35,9 @@
3335
<input type="submit" value="Submit" name="submit" class="is-hidden" />
3436
{% endblock %}
3537

38+
{% block show_submission %}
39+
{% endblock %}
40+
3641
{% block extra_js %}
3742
{{ block.super }}
3843
<script src="{% static 'js/jquery.fancybox.min.js' %}"></script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% load i18n %}
2+
<h3>{% trans "Proposal Information" %}</h3>
3+
<div>
4+
{{ submission.output_named_blocks_answers }}
5+
</div>
6+
<div class="rich-text rich-text--answers">
7+
{{ submission.output_answers }}
8+
</div>

hypha/apply/funds/urls.py

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
partial_reviews_card,
4949
partial_reviews_decisions,
5050
partial_submission_activities,
51+
partial_submission_answers,
5152
partial_submission_lead,
5253
sub_menu_bulk_update_lead,
5354
sub_menu_bulk_update_reviewers,
@@ -235,6 +236,11 @@
235236
partial_reviews_card,
236237
name="partial-reviews-card",
237238
),
239+
path(
240+
"partial/answers/",
241+
partial_submission_answers,
242+
name="partial-answers",
243+
),
238244
path("edit/", SubmissionEditView.as_view(), name="edit"),
239245
path("sealed/", SubmissionSealedView.as_view(), name="sealed"),
240246
path(

hypha/apply/funds/views_partials.py

+14
Original file line numberDiff line numberDiff line change
@@ -438,3 +438,17 @@ def get_applications_status_counts(request):
438438
"type": "Applications",
439439
},
440440
)
441+
442+
443+
@login_required
444+
@require_http_methods(["GET"])
445+
def partial_submission_answers(request, pk):
446+
submission = get_object_or_404(ApplicationSubmission, pk=pk)
447+
has_permission(
448+
"submission_view", request.user, object=submission, raise_exception=True
449+
)
450+
return render(
451+
request,
452+
"submissions/partials/applicationsubmission.html",
453+
{"submission": submission},
454+
)

hypha/apply/review/templates/review/review_form.html

+57-28
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,74 @@
66
{% adminbar %}
77
{% slot header %}{{ title }}{% endslot %}
88
{% slot sub_heading %}
9-
{% trans "For" %} <a href="{% url "funds:submissions:detail" submission.id %}">{{ submission.title }}</a>
9+
{% trans "For" %} <a class="text-blue-300 hover:underline" href="{% url "funds:submissions:detail" submission.id %}">{{ submission.title }}</a>
10+
{% endslot %}
11+
{% slot buttons %}
12+
<button
13+
class="tab__item ms-auto block pb-4"
14+
x-data
15+
@click="showSubmission = !showSubmission"
16+
>
17+
<span x-show="!showSubmission">{% trans "Show application" %}</span>
18+
<span x-show="showSubmission">{% trans "Hide application" %}</span>
19+
</button>
20+
</a>
1021
{% endslot %}
1122
{% endadminbar %}
1223

13-
{% include "forms/includes/form_errors.html" with form=form %}
1424

15-
<div class="wrapper wrapper--medium wrapper--inner-space-medium">
25+
{% block form %}
1626
{% if not has_submitted_review %}
17-
<form class="form form--with-p-tags form--scoreable" action="" method="post">
18-
{{ form.media }}
19-
{% csrf_token %}
27+
<section class="my-8 flex justify-between">
28+
{% include "forms/includes/form_errors.html" with form=form %}
29+
<form class="form form--with-p-tags form--scoreable max-w-3xl flex-1" action="" method="post">
30+
{{ form.media }}
31+
{% csrf_token %}
2032

21-
{% for hidden in form.hidden_fields %}
22-
{{ hidden }}
23-
{% endfor %}
33+
{% for hidden in form.hidden_fields %}
34+
{{ hidden }}
35+
{% endfor %}
2436

25-
{% for field in form.visible_fields %}
37+
{% for field in form.visible_fields %}
2638
{# to be replaced with better logic when we use stream form #}
27-
{% ifchanged field.field.group %}
28-
{% for key, value in form.titles.items %}
29-
{% if key == field.field.group %}
30-
<h2>{{ value }}</h2>
31-
{% endif %}
32-
{% endfor %}
33-
{% endifchanged %}
39+
{% ifchanged field.field.group %}
40+
{% for key, value in form.titles.items %}
41+
{% if key == field.field.group %}
42+
<h2>{{ value }}</h2>
43+
{% endif %}
44+
{% endfor %}
45+
{% endifchanged %}
3446

35-
{% if field.field %}
36-
{% include "forms/includes/field.html" %}
37-
{% else %}
38-
{{ field.block }}
47+
{% if field.field %}
48+
{% include "forms/includes/field.html" %}
49+
{% else %}
50+
{{ field.block }}
51+
{% endif %}
52+
{% endfor %}
53+
{% if not object.id or object.is_draft %}
54+
<button class="button button--submit button--top-space button--white" type="submit" name="{{ form.draft_button_name }}" formnovalidate>{% trans "Save draft" %}</button>
3955
{% endif %}
40-
{% endfor %}
41-
{% if not object.id or object.is_draft %}
42-
<button class="button button--submit button--top-space button--white" type="submit" name="{{ form.draft_button_name }}" formnovalidate>{% trans "Save draft" %}</button>
43-
{% endif %}
44-
<button class="button button--submit button--top-space button--primary" type="submit" name="submit">{% trans "Submit" %}</button>
45-
</form>
56+
<button class="button button--submit button--top-space button--primary" type="submit" name="submit">{% trans "Submit" %}</button>
57+
</form>
58+
<aside :class="showSubmission ? 'flex-1 ps-4' : ''">
59+
<section
60+
class="p-4 overflow-y-auto bg-white shadow-xl max-h-screen"
61+
x-show="showSubmission"
62+
x-transition:enter="transition ease-out duration-250"
63+
x-transition:enter-start="transform opacity-0 translate-x-full"
64+
x-transition:enter-end="transform opacity-100 translate-x-0"
65+
x-transition:leave="transition ease-in duration-150"
66+
x-transition:leave-start="transform opacity-100 translate-x-0"
67+
x-transition:leave-end="transform opacity-0 translate-x-full"
68+
hx-get="{% url 'funds:submissions:partial-answers' submission.id %}"
69+
hx-trigger="intersect once"
70+
>
71+
<p>{% trans "Loading…" %}</p>
72+
</section>
73+
</aside>
74+
</section>
4675
{% else %}
4776
<p>{% trans "You have already posted a review for this submission" %}</p>
4877
{% endif %}
49-
</div>
78+
{% endblock %}
5079
{% endblock %}

hypha/templates/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
{% block header %}{% endblock header %}
9191

9292
{% block content_wrapper %}
93-
<main class="wrapper wrapper--large wrapper--main grow" id="main">
93+
<main class="wrapper wrapper--large wrapper--main grow" id="main" x-data="{ showSubmission: false }">
9494
{% block content %}{% endblock %}
9595
</main>
9696
{% endblock %}

0 commit comments

Comments
 (0)