chore: simplify by removing useless ajax call

This commit is contained in:
Régis Behmo 2024-12-05 16:40:01 +01:00
parent b7ff461da2
commit bdfecd5066
3 changed files with 13 additions and 19 deletions

View File

@ -191,14 +191,8 @@ def run(root: str, **app_kwargs: t.Any) -> None:
@app.get("/")
async def home() -> str:
return await render_template("index.html")
@app.get("/sidebar/plugins")
async def sidebar_plugins() -> str:
# TODO get rid of this view and render from home()
return await render_template(
"sidebar/_plugins.html",
"index.html",
installed_plugins=sorted(set(hooks.Filters.PLUGINS_INSTALLED.iterate())),
)

View File

@ -40,7 +40,18 @@
<div class="header">
Plugins
</div>
<div class="content" hx-get="{{ url_for('sidebar_plugins') }}" hx-trigger="revealed"></div>
<div class="content">
<ul>
{% for plugin in installed_plugins %}
<li><a href="{{ url_for('plugin', name=plugin) }}">{{ plugin }}</a></li>
{% endfor %}
<form action="{{ url_for('tutor_cli') }}" method="POST">
<input type="hidden" name="args[]" value="local">
<input type="hidden" name="args[]" value="launch">
<button type="submit">Apply changes</button>
</form>
</ul>
</div>
</div>
</div>

View File

@ -1,11 +0,0 @@
<ul>
{% for plugin in installed_plugins %}
<li><a href="{{ url_for('plugin', name=plugin) }}">{{ plugin }}</a></li>
{% endfor %}
<form action="{{ url_for('tutor_cli') }}" method="POST">
<input type="hidden" name="args[]" value="local">
<input type="hidden" name="args[]" value="launch">
<button type="submit">Apply changes</button>
</form>
</ul>