Jun 24 - Implement function to view history broadcast messages - fix issue
This commit is contained in:
@@ -109,16 +109,13 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for b in history %}
|
{% for b in history %}
|
||||||
<tr style="cursor:pointer;"
|
<tr class="broadcast-row" style="cursor:pointer;"
|
||||||
onclick="showBroadcast(
|
data-title="{{ b.title | e }}"
|
||||||
{{ b.id }},
|
data-body="{{ b.body | e }}"
|
||||||
{{ b.title | tojson }},
|
data-sent-at="{{ b.sent_at.strftime('%b %-d, %Y %I:%M %p') }}"
|
||||||
{{ b.body | tojson }},
|
data-sent-by="{{ (b.sent_by.display_name if b.sent_by else '—') | e }}"
|
||||||
{{ b.sent_at.strftime('%b %-d, %Y %I:%M %p') | tojson }},
|
data-recipients="{{ b.recipient_count }}"
|
||||||
{{ (b.sent_by.display_name if b.sent_by else '—') | tojson }},
|
data-roles="{{ b.target_roles | tojson | e }}">
|
||||||
{{ b.recipient_count }},
|
|
||||||
{{ b.target_roles | tojson }}
|
|
||||||
)">
|
|
||||||
<td class="text-nowrap text-muted small">
|
<td class="text-nowrap text-muted small">
|
||||||
{{ b.sent_at.strftime('%b %-d, %Y') }}<br>
|
{{ b.sent_at.strftime('%b %-d, %Y') }}<br>
|
||||||
<span class="text-muted" style="font-size:.75rem;">
|
<span class="text-muted" style="font-size:.75rem;">
|
||||||
@@ -195,17 +192,20 @@
|
|||||||
<script>
|
<script>
|
||||||
var ROLE_LABELS = {{ role_labels | tojson }};
|
var ROLE_LABELS = {{ role_labels | tojson }};
|
||||||
|
|
||||||
function showBroadcast(id, title, body, sentAt, sentBy, recipientCount, roles) {
|
document.querySelectorAll('.broadcast-row').forEach(function(row) {
|
||||||
document.getElementById('bdTitle').textContent = title;
|
row.addEventListener('click', function() {
|
||||||
document.getElementById('bdBody').textContent = body;
|
var roles = JSON.parse(this.dataset.roles);
|
||||||
document.getElementById('bdSentAt').textContent = sentAt;
|
document.getElementById('bdTitle').textContent = this.dataset.title;
|
||||||
document.getElementById('bdSentBy').textContent = sentBy;
|
document.getElementById('bdBody').textContent = this.dataset.body;
|
||||||
document.getElementById('bdRecipients').textContent = recipientCount + ' user(s)';
|
document.getElementById('bdSentAt').textContent = this.dataset.sentAt;
|
||||||
document.getElementById('bdRoles').textContent = roles.map(function(r) {
|
document.getElementById('bdSentBy').textContent = this.dataset.sentBy;
|
||||||
return ROLE_LABELS[r] || r;
|
document.getElementById('bdRecipients').textContent = this.dataset.recipients + ' user(s)';
|
||||||
}).join(', ');
|
document.getElementById('bdRoles').textContent = roles.map(function(r) {
|
||||||
new bootstrap.Modal(document.getElementById('broadcastDetailModal')).show();
|
return ROLE_LABELS[r] || r;
|
||||||
}
|
}).join(', ');
|
||||||
|
new bootstrap.Modal(document.getElementById('broadcastDetailModal')).show();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var textarea = document.getElementById('body');
|
var textarea = document.getElementById('body');
|
||||||
|
|||||||
Reference in New Issue
Block a user