-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple extensions page in Control Panel
- Loading branch information
Showing
6 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% extends "controlpanel/layout.html" %} | ||
|
||
{% block title %}4CAT Extensions{% endblock %} | ||
{% block body_class %}plain-page admin {{ body_class }}{% endblock %} | ||
{% block subbreadcrumbs %}{% set navigation.sub = "extensions" %}{% endblock %} | ||
|
||
{% block body %} | ||
<article class="small"> | ||
<section class="result-list"> | ||
<h2><span>4CAT Extensions</span></h2> | ||
{% for notice in flashes %} | ||
<p class="form-notice">{{ notice|safe }}</p> | ||
{% endfor %} | ||
<p>4CAT extensions can be installed in the <code>extensions</code> folder in the 4CAT root. For more | ||
information, see the README file in that folder. This page lists all currently installed extensions; | ||
currently, to manage extensions you will need to access the filesystem and move files into the correct | ||
location manually.</p> | ||
<div class="user-panel"> | ||
<table class="fullwidth notification-table cp-table"> | ||
<colgroup> | ||
<col> | ||
<col> | ||
<col class="actions"> | ||
</colgroup> | ||
<tr> | ||
<th>Extension</th> | ||
<th>Version</th> | ||
<th>Links</th> | ||
</tr> | ||
{% if extensions %} | ||
{% for extension_id, extension in extensions.items() %} | ||
<tr> | ||
<td><span class="property-badge">{{ extension_id }}</span>{% if extension_id != extension.name %} | ||
{{ extension.name }}{% endif %}</td> | ||
<td>{% if extension.version %}{{ extension.version }}{% else %}unknown{% endif %}</td> | ||
<td> | ||
{% if extension.url and extension.url != extension.git_url %} | ||
<a href="{{ extension.url }}"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span | ||
class="sr-only">Website</span></a>{% endif %} | ||
{% if extension.git_url %}<a href="{{ extension.git_url }}"><i class="fab fa-fw fa-git{% if "github.com" in extension.git_url %}hub{% endif %}" | ||
aria-hidden="true"></i><span | ||
class="sr-only">Remote git repository</span></a>{% endif %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
{% else %} | ||
<tr> | ||
<td colspan="3">No 4CAT extensions are installed.</td> | ||
</tr> | ||
{% endif %} | ||
</table> | ||
</div> | ||
</section> | ||
</article> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
4CAT extension views - routes to manipulate 4CAT extensions | ||
""" | ||
|
||
from flask import render_template, request, flash, get_flashed_messages | ||
from flask_login import current_user, login_required | ||
|
||
from webtool import app, config | ||
from common.lib.helpers import find_extensions | ||
|
||
from common.config_manager import ConfigWrapper | ||
|
||
config = ConfigWrapper(config, user=current_user, request=request) | ||
|
||
|
||
@app.route("/admin/extensions/") | ||
@login_required | ||
def extensions_panel(): | ||
extensions, load_errors = find_extensions() | ||
|
||
if extensions is None: | ||
return render_template("error.html", message="No extensions folder is available - cannot " | ||
"list or manipulate extensions in this 4CAT server."), 500 | ||
|
||
for error in load_errors: | ||
flash(error) | ||
|
||
return render_template("controlpanel/extensions-list.html", extensions=extensions, flashes=get_flashed_messages()) |