Skip to content

Commit

Permalink
Mechanism to disable install plugin link on click, refs #10
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Sep 11, 2021
1 parent 819efde commit 123bca7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>{{ row.name }}</h2>
<p><strong>Currently installed</strong></p>
{% else %}
{% if actor.id == "root" and row.installed == "not installed" %}
<p><a class="install-plugin-button" href="javascript:datasetteApp.installPlugin('{{ row.name }}')">Install plugin: {{ row.name }}</a></p>
<p><a class="install-plugin-button" data-plugin="{{ row.name }}" href="#">Install plugin: {{ row.name }}</a></p>
{% endif %}
{% endif %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,16 @@
top: 1px;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
var buttons = document.querySelectorAll(".install-plugin-button");
Array.from(buttons).forEach(button => {
button.addEventListener("click", (ev) => {
ev.preventDefault();
ev.target.style.pointerEvents = 'none';
datasetteApp.installPlugin(ev.target.dataset.plugin, ev.target);
});
});
});
</script>
{% endblock %}

0 comments on commit 123bca7

Please sign in to comment.