|
157 | 157 | <span class="fas fa-pencil"></span>
|
158 | 158 | </a>
|
159 | 159 | {% if not evaluation|has_nonresponsible_editor %}
|
160 |
| - <a href="#" class="btn btn-sm btn-dark" data-bs-toggle="tooltip" |
161 |
| - data-bs-placement="top" title="{% trans 'Delegate preparation' %}" |
162 |
| - onclick="delegateSelectionModalShow(`{{ evaluation.full_name }}`, `{% url 'contributor:evaluation_direct_delegation' evaluation.id %}`);return false;" |
163 |
| - > |
164 |
| - <span class="fas fa-hand-point-left"></span> |
165 |
| - </a> |
| 160 | + <confirmation-modal data-evaluation-direct-delegation-url="{% url 'contributor:evaluation_direct_delegation' evaluation.id %}"> |
| 161 | + <span slot="title">{% trans 'Delegate preparation' %}</span> |
| 162 | + <span slot="action-text">{% trans 'Delegate preparation' %}</span> |
| 163 | + <span slot="question"> |
| 164 | + {% blocktrans with evaluation_name=evaluation.full_name %} |
| 165 | + Do you really want to delegate the preparation of the evaluation {{ evaluation_name }}? |
| 166 | + {% endblocktrans %} |
| 167 | + <div class="my-4"> |
| 168 | + {% include 'bootstrap_form.html' with form=delegate_selection_form wide=True %} |
| 169 | + </div> |
| 170 | + </span> |
| 171 | + |
| 172 | + <a slot="show-button" href="#" class="btn btn-sm btn-dark" data-bs-toggle="tooltip" data-bs-placement="top" title="{% trans 'Delegate preparation' %}"> |
| 173 | + <span class="fas fa-hand-point-left"></span> |
| 174 | + </a> |
| 175 | + </confirmation-modal> |
166 | 176 | {% endif %}
|
167 | 177 | {% elif evaluation.state == evaluation.State.EDITOR_APPROVED or evaluation.state == evaluation.State.APPROVED %}
|
168 | 178 | <a href="{% url 'contributor:evaluation_view' evaluation.id %}" class="btn btn-sm btn-light"
|
|
191 | 201 | {% endfor %}
|
192 | 202 | </tbody>
|
193 | 203 | </table>
|
| 204 | + |
| 205 | + <!-- TODO: javascript to submit it above --> |
194 | 206 | </div>
|
195 | 207 | </div>
|
196 | 208 | {% endif %}
|
197 | 209 | {% endfor %}
|
198 | 210 | {% endblock %}
|
199 |
| - |
200 |
| -{% block modals %} |
201 |
| - {{ block.super }} |
202 |
| - |
203 |
| - {% with modal_id='delegateSelectionModal' %} |
204 |
| - <div class="modal fade" id="{{ modal_id }}" role="dialog" aria-labelledby="{{ modal_id }}Label" aria-hidden="true"> |
205 |
| - <div class="modal-dialog" role="document"> |
206 |
| - <div class="modal-content"> |
207 |
| - <form method="POST"> |
208 |
| - {% csrf_token %} |
209 |
| - <div class="modal-header"> |
210 |
| - <h5 class="modal-title" id="{{ modal_id }}Label">{% trans 'Delegate preparation' %}</h5> |
211 |
| - <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
212 |
| - </div> |
213 |
| - <div class="modal-body"> |
214 |
| - {% trans 'Do you really want to delegate the preparation of the evaluation <strong data-label=""></strong>?' %} |
215 |
| - <div class="my-4"> |
216 |
| - {% include 'bootstrap_form.html' with form=delegate_selection_form wide=True %} |
217 |
| - </div> |
218 |
| - <div class="modal-submit-group"> |
219 |
| - <button type="button" class="btn btn-light" data-bs-dismiss="modal">{% trans 'Cancel' %}</button> |
220 |
| - <button type="submit" id="btn-action" class="btn btn-primary ms-2">{% trans 'Delegate preparation' %}</button> |
221 |
| - </div> |
222 |
| - </div> |
223 |
| - |
224 |
| - </form> |
225 |
| - </div> |
226 |
| - </div> |
227 |
| - </div> |
228 |
| - |
229 |
| - <script type="text/javascript"> |
230 |
| - function {{ modal_id }}Show(evaluationName, action) { |
231 |
| - const modal = document.getElementById("{{ modal_id }}"); |
232 |
| - // set form's action location |
233 |
| - modal.querySelectorAll("form").forEach(form => form.action = action); |
234 |
| - |
235 |
| - // put the correct evaluation name in the modal |
236 |
| - modal.querySelectorAll('[data-label=""]').forEach(el => el.innerText = evaluationName); |
237 |
| - |
238 |
| - // unselect any previously selected options in the modal |
239 |
| - modal.querySelectorAll("select").forEach(select => select.tomselect.clear()); |
240 |
| - |
241 |
| - // show modal |
242 |
| - var {{ modal_id }} = new bootstrap.Modal(document.getElementById('{{ modal_id }}')); |
243 |
| - {{ modal_id }}.show(); |
244 |
| - } |
245 |
| - </script> |
246 |
| - {% endwith %} |
247 |
| -{% endblock %} |
0 commit comments