{% extends "_base_header.html" %}

{% block page_title %}
Installed Plugins
{% endblock %}

{% block page_description %}
View all your installed plugins in one place.
{% endblock %}

{% block page_button %}
<button class="open-modal-button" type="button">Apply Changes</button>
{% endblock %}

{% set sidebar_active_tab = "my-plugins" %}

{% set search_endpoint = url_for('plugin_installed_list') %}

{% block workspace_content %}
<div id="plugins-list" class="installed-plugins-list" hx-get="{{ search_endpoint }}" hx-trigger="load"></div>
{% endblock %}

{% block scripts %}
<script>
    document.body.addEventListener('htmx:afterOnLoad', function(event) {
        let toggleSwitches = document.querySelectorAll(".switch");
        toggleSwitches.forEach(toggleSwitch => {
            toggleSwitch.onclick = function(event) {
                // If we click on the switch then do what the switch does
                // abort what the parent was going to do on click
                event.stopPropagation();
            }
        });
    });
</script>
{% endblock %}
