Skip to content

Commit 079f12a

Browse files
authored
Align submission and project detail pages styling (#4820)
The project detail page was the last place where the wrapper classes was used. Aligning it with the submission detail page allow us to delete the wrapper sass styles. This PR also fixes submission tables on (community) reviewers dashboard by copying from the applicant dashboard. ## Test Steps - [ ] Ensure that the project detail page look and works as before. - [ ] Test that the reviewer dashboard works as it should.
1 parent c5a4e0e commit 079f12a

7 files changed

Lines changed: 170 additions & 256 deletions

File tree

hypha/apply/dashboard/templates/dashboard/community_dashboard.html

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -57,57 +57,35 @@ <h2 class="section-header">
5757
</section>
5858
{% endif %}
5959

60-
<section>
61-
<h2 class="section-header">
62-
{% trans "Your active submissions" %}
63-
</h2>
64-
{% for submission in my_submissions %}
65-
<div class="wrapper wrapper--status-bar-outer">
66-
<div class="wrapper wrapper--status-bar-inner">
67-
<div class="flex flex-col gap-2 max-w-sm sm:max-w-lg md:flex-row md:justify-between md:w-full md:max-w-none lg:flex-col lg:justify-start lg:w-auto lg:max-w-sm">
68-
<div>
69-
<h3 class="text-base font-bold">
70-
<a class="{% if not submission.is_active %} text-slate-500 {% endif %} hover:underline" href="{% url 'funds:submissions:detail' submission.id %}">
71-
{{ submission.title }}
72-
<span class="text-fg-muted">#{{ submission.application_id }}</span>
73-
</a>
74-
</h3>
75-
<p class="text-sm heading text-fg-muted">
76-
{% trans "Submitted" %}: {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }}
77-
</p>
60+
{% if my_submissions_exists %}
61+
<section>
62+
<h2 class="section-header">{% trans "My submissions" %}</h2>
63+
<div class="overflow-hidden border border-base-200 rounded-box shadow-xs">
64+
<div
65+
hx-get="{% url 'dashboard:applicant_submissions' %}"
66+
hx-trigger="load"
67+
id="submissions_list"
68+
class="list"
69+
>
70+
{% for dummy_item in per_section_items %}
71+
<div class="animate-pulse list-row min-h-40">
72+
<div class="mt-5 ms-4 lg:max-w-[30%] h-9 bg-base-300 "></div>
7873
</div>
79-
{% if request.user|has_edit_perm:submission %}
80-
<div>
81-
<a class="btn btn-primary" href="{% url 'funds:submissions:edit' submission.id %}">
82-
{% if submission.status == 'draft_proposal' %}
83-
{% trans "Start your" %} {{ submission.stage }} {% trans "application" %}
84-
{% else %}
85-
<span class="whitespace-nowrap">
86-
{% heroicon_mini "pencil-square" size=18 class="inline align-text-bottom me-1" aria_hidden=true %}
87-
{% trans "Edit" %}
88-
</span>
89-
{% endif %}
90-
</a>
91-
</div>
92-
{% endif %}
93-
</div>
94-
95-
{% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %}
74+
{% endfor %}
9675
</div>
9776
</div>
98-
{% empty %}
99-
{% trans "No active submissions" %}
100-
{% endfor %}
101-
</section>
77+
</section>
78+
{% endif %}
10279

103-
{% if my_inactive_submissions.data %}
104-
<section>
80+
{% if historical_submissions.count %}
81+
<section id="submission-history">
10582
<h2 class="section-header">
10683
{% trans "Submission history" %}
10784
</h2>
108-
{% render_table my_inactive_submissions %}
85+
<div class="overflow-x-auto border border-base-200 rounded-box shadow-xs">
86+
{% render_table historical_submissions.table %}
87+
</div>
10988
</section>
11089
{% endif %}
11190
</div>
112-
11391
{% endblock %}

hypha/apply/dashboard/templates/dashboard/reviewer_dashboard.html

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,40 +55,34 @@ <h2 class="section-header">
5555
</section>
5656
{% endif %}
5757

58-
{% if my_submissions %}
58+
{% if my_submissions_exists %}
5959
<section>
60-
<h2 class="section-header">
61-
{% trans "Your active submissions" %}
62-
</h2>
63-
{% for submission in my_submissions %}
64-
<div class="wrapper wrapper--status-bar-outer">
65-
<div class="wrapper wrapper--status-bar-inner">
66-
<div>
67-
<h5 class="m-0 heading"><a class="underline" href="{% url 'funds:submissions:detail' submission.id %}">{{ submission.title }}</a></h5>
68-
<h6 class="m-0 heading"><span>{% trans "Submitted" %}:</span> {{ submission.submit_time.date }} {% trans "by" %} {{ submission.user.get_full_name }}</h6>
60+
<h2 class="section-header">{% trans "My submissions" %}</h2>
61+
<div class="overflow-hidden border border-base-200 rounded-box shadow-xs">
62+
<div
63+
hx-get="{% url 'dashboard:applicant_submissions' %}"
64+
hx-trigger="load"
65+
id="submissions_list"
66+
class="list"
67+
>
68+
{% for dummy_item in per_section_items %}
69+
<div class="animate-pulse list-row min-h-40">
70+
<div class="mt-5 ms-4 lg:max-w-[30%] h-9 bg-base-300 "></div>
6971
</div>
70-
{% status_bar submission.workflow submission.phase request.user css_class="status-bar--small" %}
71-
</div>
72-
{% if request.user|has_edit_perm:submission %}
73-
<a class="btn btn-primary" href="{% url 'funds:submissions:edit' submission.id %}">
74-
{% if submission.status == 'draft_proposal' %}
75-
{% trans "Start your" %} {{ submission.stage }} {% trans "application" %}
76-
{% else %}
77-
{% trans "Edit" %}
78-
{% endif %}
79-
</a>
80-
{% endif %}
72+
{% endfor %}
8173
</div>
82-
{% endfor %}
74+
</div>
8375
</section>
8476
{% endif %}
8577

86-
{% if my_inactive_submissions.data %}
87-
<section>
78+
{% if historical_submissions.count %}
79+
<section id="submission-history">
8880
<h2 class="section-header">
8981
{% trans "Submission history" %}
9082
</h2>
91-
{% render_table my_inactive_submissions %}
83+
<div class="overflow-x-auto border border-base-200 rounded-box shadow-xs">
84+
{% render_table historical_submissions.table %}
85+
</div>
9286
</section>
9387
{% endif %}
9488
</div>

hypha/apply/dashboard/views.py

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,6 @@ def get_preview_context(queryset, limit=5):
3939
}
4040

4141

42-
class MySubmissionContextMixin:
43-
def get_context_data(self, **kwargs):
44-
submissions = ApplicationSubmission.objects.all().for_table(self.request.user)
45-
my_submissions = (
46-
submissions.filter(user=self.request.user)
47-
.active()
48-
.current()
49-
.select_related("draft_revision")
50-
)
51-
my_submissions = [submission.from_draft() for submission in my_submissions]
52-
53-
my_inactive_submissions = (
54-
submissions.filter(user=self.request.user).inactive().current()
55-
)
56-
my_inactive_submissions_table = ReviewerSubmissionsTable(
57-
my_inactive_submissions, prefix="my-submissions-"
58-
)
59-
60-
return super().get_context_data(
61-
my_submissions=my_submissions,
62-
my_inactive_submissions=my_inactive_submissions_table,
63-
**kwargs,
64-
)
65-
66-
6742
class MyFlaggedMixin:
6843
def my_flagged(self, submissions):
6944
return get_preview_context(
@@ -94,6 +69,22 @@ def paf_for_review(self):
9469
}
9570

9671

72+
class HistoricalSubmissionMixin:
73+
def historical_submission_data(self):
74+
historical_submissions = list(
75+
ApplicationSubmission.objects.filter(
76+
user=self.request.user,
77+
)
78+
.inactive()
79+
.current()
80+
.for_table(self.request.user)
81+
)
82+
return {
83+
"count": len(historical_submissions),
84+
"table": SubmissionsTable(data=historical_submissions),
85+
}
86+
87+
9788
class AdminDashboardView(PAFReviewMixin, MyFlaggedMixin, TemplateView):
9889
template_name = "dashboard/staff_dashboard.html"
9990
paf_reviewer_role = "is_apply_staff"
@@ -233,7 +224,7 @@ def invoices_to_convert(self):
233224
}
234225

235226

236-
class ReviewerDashboardView(MyFlaggedMixin, MySubmissionContextMixin, TemplateView):
227+
class ReviewerDashboardView(HistoricalSubmissionMixin, MyFlaggedMixin, TemplateView):
237228
template_name = "dashboard/reviewer_dashboard.html"
238229

239230
def get(self, request, *args, **kwargs):
@@ -268,6 +259,10 @@ def get_context_data(self, **kwargs):
268259

269260
context.update(
270261
{
262+
"my_submissions_exists": ApplicationSubmission.objects.filter(
263+
Q(user=self.request.user) | Q(co_applicants__user=self.request.user)
264+
).exists(),
265+
"historical_submissions": self.historical_submission_data(),
271266
"awaiting_reviews": self.awaiting_reviews(submissions),
272267
"my_reviewed": get_preview_context(
273268
submissions.reviewed_by(self.request.user).order_by("-submit_time")
@@ -353,7 +348,7 @@ def projects_in_contracting(self):
353348
}
354349

355350

356-
class CommunityDashboardView(MySubmissionContextMixin, TemplateView):
351+
class CommunityDashboardView(HistoricalSubmissionMixin, TemplateView):
357352
template_name = "dashboard/community_dashboard.html"
358353

359354
def get_context_data(self, **kwargs):
@@ -366,6 +361,10 @@ def get_context_data(self, **kwargs):
366361
)
367362
context.update(
368363
{
364+
"my_submissions_exists": ApplicationSubmission.objects.filter(
365+
Q(user=self.request.user) | Q(co_applicants__user=self.request.user)
366+
).exists(),
367+
"historical_submissions": self.historical_submission_data(),
369368
"my_community_review": my_community_review_table,
370369
"my_community_review_count": my_community_review_qs.count(),
371370
"my_reviewed": get_preview_context(
@@ -387,7 +386,7 @@ def my_community_review(self, user, submissions):
387386
return my_community_review, my_community_review_table
388387

389388

390-
class ApplicantDashboardView(TemplateView):
389+
class ApplicantDashboardView(HistoricalSubmissionMixin, TemplateView):
391390
template_name = "dashboard/applicant_dashboard.html"
392391

393392
def get_context_data(self, **kwargs):
@@ -434,20 +433,6 @@ def historical_project_data(self):
434433
),
435434
}
436435

437-
def historical_submission_data(self):
438-
historical_submissions = list(
439-
ApplicationSubmission.objects.filter(
440-
user=self.request.user,
441-
)
442-
.inactive()
443-
.current()
444-
.for_table(self.request.user)
445-
)
446-
return {
447-
"count": len(historical_submissions),
448-
"table": SubmissionsTable(data=historical_submissions),
449-
}
450-
451436

452437
class DashboardView(ViewDispatcher):
453438
admin_view = AdminDashboardView

hypha/apply/funds/templates/funds/applicationsubmission_detail.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
{% block content %}
5858
<div class="my-4 mx-auto layout layout-sidebar-end layout-flowrow-until-md layout-sidebar-flowrow-end md:[--layout-sidebar-width:20.5rem]">
59-
<article class="layout-main">
59+
<div class="layout-main">
6060
{% if request.user|has_edit_perm:object and object.status == 'draft_proposal' and not request.user.is_apply_staff %}
6161
<h4>{% trans "Congratulations!" %}</h4>
6262
<h5>{% blocktrans with stage=object.previous.stage %}Your {{ stage }} application has been accepted.{% endblocktrans %}</h5>
@@ -147,7 +147,7 @@ <h5>{% blocktrans with stage=object.previous.stage %}Your {{ stage }} applicatio
147147

148148
</article>
149149
{% endif %}
150-
</article>
150+
</div>
151151

152152
<aside class="flex flex-col gap-4 layout-sidebar">
153153
{% block sidebar_top %}
@@ -242,4 +242,4 @@ <h6 class="pb-2 mb-0 font-semibold uppercase border-b text-fg-muted">
242242
{% endblock %}
243243
</aside>
244244
</div>
245-
{% endblock %}
245+
{% endblock content %}

0 commit comments

Comments
 (0)