Skip to content

Commit 257df96

Browse files
committed
Add internal notes to grants recap
1 parent d026a87 commit 257df96

2 files changed

Lines changed: 121 additions & 0 deletions

File tree

backend/reviews/admin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ def _review_grants_recap_view(self, request, review_session):
292292
if key.startswith("reimbursementcategory-")
293293
}
294294

295+
notes_updates = {
296+
int(key.split("-")[1]): value
297+
for [key, value] in data.items()
298+
if key.startswith("notes-")
299+
}
300+
295301
grants = list(
296302
review_session.conference.grants.filter(id__in=decisions.keys()).all()
297303
)
@@ -393,6 +399,17 @@ def _review_grants_recap_view(self, request, review_session):
393399
change_message=f"[Review Session] Reimbursement {reimbursement.category.name} added.",
394400
)
395401

402+
# Update internal notes for all grants that have notes changes
403+
if notes_updates:
404+
grants_to_update_notes = review_session.conference.grants.filter(
405+
id__in=notes_updates.keys()
406+
).all()
407+
for grant in grants_to_update_notes:
408+
new_notes = notes_updates.get(grant.id, "")
409+
if grant.internal_notes != new_notes:
410+
grant.internal_notes = new_notes
411+
grant.save(update_fields=["internal_notes"])
412+
396413
messages.success(
397414
request, "Decisions saved. Check the Grants Summary for more info."
398415
)

backend/reviews/templates/grants-recap.html

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,93 @@
181181
tr:nth-of-type(odd) {
182182
background-color: var(--body-bg);
183183
}
184+
185+
/* Tooltip */
186+
.tooltip {
187+
position: relative;
188+
display: inline-block;
189+
}
190+
191+
.tooltip .tooltiptext {
192+
visibility: hidden;
193+
opacity: 0;
194+
width: 220px;
195+
background-color: #333;
196+
color: #fff;
197+
text-align: left;
198+
text-transform: none;
199+
padding: 8px 10px;
200+
border-radius: 6px;
201+
position: absolute;
202+
z-index: 1;
203+
top: 125%;
204+
left: 50%;
205+
margin-left: -110px;
206+
font-size: 12px;
207+
font-weight: normal;
208+
line-height: 1.4;
209+
transition: opacity 0.2s ease-in-out 0.5s, visibility 0.2s ease-in-out 0.5s;
210+
}
211+
212+
.tooltip .tooltiptext::after {
213+
content: "";
214+
position: absolute;
215+
bottom: 100%;
216+
left: 50%;
217+
margin-left: -5px;
218+
border-width: 5px;
219+
border-style: solid;
220+
border-color: transparent transparent #333 transparent;
221+
}
222+
223+
.tooltip:hover .tooltiptext {
224+
visibility: visible;
225+
opacity: 1;
226+
}
227+
228+
/* Sortable columns */
229+
.sortable {
230+
cursor: pointer;
231+
user-select: none;
232+
}
233+
234+
.sortable:hover {
235+
text-decoration: underline;
236+
}
237+
238+
.notes-cell {
239+
position: relative;
240+
min-width: 220px;
241+
}
242+
243+
.notes-textarea {
244+
position: absolute;
245+
top: 8px;
246+
left: 8px;
247+
right: 8px;
248+
bottom: 8px;
249+
width: calc(100% - 16px);
250+
min-height: 80px;
251+
resize: none;
252+
font-size: 12px;
253+
padding: 5px;
254+
box-sizing: border-box;
255+
}
256+
257+
/* Center-align columns */
258+
.results-table th:nth-child(1), /* number column */
259+
.results-table th:nth-child(3), /* score column */
260+
.results-table th:nth-child(4), /* std dev column */
261+
.results-table th:nth-child(6), /* current status column */
262+
.results-table th:nth-child(7), /* pending status column */
263+
.results-table td:nth-child(1), /* number column */
264+
.results-table td:nth-child(3), /* score column */
265+
.results-table td:nth-child(4), /* std dev column */
266+
.results-table td:nth-child(6), /* current status column */
267+
.results-table td:nth-child(7) /* pending status column */
268+
{
269+
text-align: center;
270+
}
184271
</style>
185272
<script type="application/javascript">
186273
const grantsById = {};
@@ -462,6 +549,12 @@ <h3>
462549
</div>
463550
<div class="clear"></div>
464551
</th>
552+
<th scope="col">
553+
<div class="text">
554+
<span>Notes</span>
555+
</div>
556+
<div class="clear"></div>
557+
</th>
465558
</tr>
466559
</thead>
467560
<tbody>
@@ -659,6 +752,17 @@ <h3>
659752
</ul>
660753
{% else %} No permission to change. {% endif %}
661754
</td>
755+
<td class="notes-cell">
756+
{% if perms.reviews.decision_reviewsession %}
757+
<textarea
758+
name="notes-{{ item.id }}"
759+
class="notes-textarea"
760+
placeholder="Internal notes..."
761+
>{{ item.internal_notes }}</textarea>
762+
{% else %}
763+
{{ item.internal_notes|default:"-" }}
764+
{% endif %}
765+
</td>
662766
</tr>
663767
{% endfor %}
664768
</tbody>

0 commit comments

Comments
 (0)