Add support for exporting signups to AddOns like Exorsus Raid Tools.

This commit is contained in:
Casper V. Kristensen 2019-11-21 00:32:43 +01:00
parent 39d423e437
commit c8f050531e
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -32,11 +32,34 @@
{% endif %} {% endif %}
<div class="mb-4"></div> <div class="mb-4"></div>
<div class="modal fade" id="exportModal" tabindex="-1" role="dialog" aria-labelledby="exportModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exportModalLabel">Export</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Export list of characters for automatic invitation using <a href="https://www.curseforge.com/wow/addons/exorsus-raid-tools">Exorsus Raid Tools</a>.</p>
<div class="form-group">
<label for="characters-textinput" class="col-form-label">Characters:</label>
<textarea readonly class="form-control" id="characters-textinput" onclick="this.select();"></textarea>
</div>
</div>
</div>
</div>
</div>
{% regroup responses by get_status_display as status_responses_list %} {% regroup responses by get_status_display as status_responses_list %}
{% for status, status_responses in status_responses_list %} {% for status, status_responses in status_responses_list %}
{% with status=status|default_if_none:"No Response" %} {% with status=status|default_if_none:"No Response" %}
<div class="card mb-2"> <div class="card mb-2">
<h6 class="card-header response-status-{{ status | slugify }}-bg">{{ status }} ({{ status_responses | length }})</h6> <h6 class="card-header d-flex response-status-{{ status | slugify }}-bg">
<span class="mr-auto">{{ status }} ({{ status_responses | length }})</span>
<span type="button" class="badge badge-dark" data-toggle="modal" data-target="#exportModal">Export</span>
</h6>
<div class="card-body mb-n4"> <div class="card-body mb-n4">
{% regroup status_responses by get_role_display as role_responses_list %} {% regroup status_responses by get_role_display as role_responses_list %}
{% for role, role_responses in role_responses_list %} {% for role, role_responses in role_responses_list %}
@ -89,3 +112,15 @@
</div> </div>
</div> </div>
{% endblock content %} {% endblock content %}
{% block scripts %}
<script>
const charactersTextinput = document.querySelector("#characters-textinput");
$("#exportModal").on("show.bs.modal", function (event) {
charactersTextinput.textContent = $(event.relatedTarget).closest(".card").find(".response-character-button").map(function () {
return this.text.trim();
}).get().join("\n");
})
</script>
{% endblock scripts %}