@@ -305,27 +368,21 @@
(function () {
'use strict';
- // ── Immediate bell refresh after a successful update ──────────────────
- // After form submit + redirect, Flask flashes 'Issue updated.' and the
- // URL stays at /issues/. We detect the flash message presence and
- // call the global fetchNotifications() defined in base.html so the bell
- // badge updates instantly without waiting for the 60-second poll cycle.
+ // Refresh bell badge after a successful update
if (document.querySelector('.alert-success')) {
if (typeof fetchNotifications === 'function') {
fetchNotifications();
}
}
- // ── Auto-scroll to Update History after save ──────────────────────────
- // If there's a success flash AND comments exist, scroll the history
- // section into view so the newly added comment is immediately visible.
+ // Scroll to bottom of comments list after posting a comment
if (document.querySelector('.alert-success')) {
- var historyEl = document.getElementById('update-history');
- if (historyEl) {
- historyEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
+ var section = document.getElementById('comments-section');
+ if (section) {
+ section.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
})();
{% endblock %}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
Update History
+ {# ── Comments ───────────────────────────────────────────────────────── #} ++ Comments + {{ comments|length }} +
+ + {# Comment list #} + {% if comments %} +
+ {% set avatar_colors = ['#4f46e5','#0891b2','#059669','#d97706','#dc2626','#7c3aed','#db2777'] %}
{% for c in comments %}
- -
-
-
- {{ c.author.display_name }}
-
-
-
- {{ c.status_at_time|replace('_',' ')|title }}
-
- {{ c.created_at.strftime('%Y-%m-%d %H:%M') }}
-
+ {% set avatar_color = avatar_colors[c.author.id % (avatar_colors | length)] %}
+
+
+ {{ c.author.display_name[0] | upper }}
-
+
+
+ {{ c.author.display_name }}
+ {% if c.author.role == 'customer' %}
+ Customer
+ {% else %}
+ {{ c.author.role|replace('_',' ')|title }}
+ {% endif %}
+
+
+
+ {{ c.status_at_time|replace('_',' ')|title }}
+
+ {{ c.created_at.strftime('%b %d, %Y %H:%M') }}
+
+
+
+
{% endfor %}
-
+
+
+
+ {% elif current_user.role != 'customer' %}
+
+
+ {% endif %}
- {% endif %}
-
{{ c.body }}
- +{{ c.body }}
++ {% endif %} + + {# Add Comment form — submits to the same view POST endpoint #} + {% if can_edit %} +
Add Comment
+ ++ Only assigned staff can add comments. +
+Update Issue