Fix overview modals
This commit is contained in:
parent
ba99642060
commit
ef3022e1b3
|
@ -1,17 +1,37 @@
|
|||
var modal = document.querySelector('.modal'); // assuming you have only 1
|
||||
var html = document.querySelector('html');
|
||||
modal.querySelector('.modal-background').addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var elements = document.querySelectorAll('.modal-background');
|
||||
for(var i = 0; i < elements.length; i++) {
|
||||
elements[i].addEventListener('click', function(e) {
|
||||
// elements[i].preventDefault();
|
||||
modal.classList.remove('is-active');
|
||||
html.classList.remove('is-clipped');
|
||||
});
|
||||
modal.querySelector('.modal-close').addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
var elements = document.querySelectorAll('.modal-close');
|
||||
for(var i = 0; i < elements.length; i++) {
|
||||
elements[i].addEventListener('click', function(e) {
|
||||
// elements[i].preventDefault();
|
||||
modal.classList.remove('is-active');
|
||||
html.classList.remove('is-clipped');
|
||||
});
|
||||
modal.querySelector('.modal-close-button').addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
function activateButtons() {
|
||||
var elements = document.querySelectorAll('.modal-close-button');
|
||||
for(var i = 0; i < elements.length; i++) {
|
||||
elements[i].addEventListener('click', function(e) {
|
||||
// elements[i].preventDefault();
|
||||
modal.classList.remove('is-active');
|
||||
html.classList.remove('is-clipped');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
activateButtons();
|
||||
// modal.querySelector('.modal-close-button').addEventListener('click', function(e) {
|
||||
// e.preventDefault();
|
||||
// modal.classList.remove('is-active');
|
||||
// html.classList.remove('is-clipped');
|
||||
// });
|
|
@ -64,12 +64,14 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<button
|
||||
type="button"
|
||||
class="button is-light"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="{% url 'threshold_irc_network_info' net %}">
|
||||
Cancel
|
||||
</button>
|
||||
<button class="button is-info">Submit</button>
|
||||
<button type="submit" class="button is-info">Submit</button>
|
||||
<script>activateButtons();</script>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="{% url 'threshold_irc_actions_add-network' %}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modals-here-actions"
|
||||
hx-target="#modals-here"
|
||||
class="button is-info">
|
||||
<span class="icon-text">
|
||||
<span class="icon">
|
||||
|
|
|
@ -42,6 +42,4 @@
|
|||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="modals-here">
|
||||
</div>
|
||||
</div>
|
|
@ -63,11 +63,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="button is-light modal-close-button">
|
||||
Cancel
|
||||
</button>
|
||||
<button class="button is-info modal-close-button">Submit</button>
|
||||
|
||||
<button type="submit" class="button is-info modal-close-button">Submit</button>
|
||||
<script>activateButtons();</script>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -52,11 +52,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="button is-light modal-close-button">
|
||||
Cancel
|
||||
</button>
|
||||
<button class="button is-info modal-close-button">Submit</button>
|
||||
|
||||
<button type="submit" class="button is-info modal-close-button">Submit</button>
|
||||
<script>activateButtons();</script>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -85,5 +85,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modals-here">
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue