Make modules contain their own static files and templates

This commit is contained in:
Chase Sterling 2016-08-15 23:06:05 -04:00
parent 4a38e896eb
commit 33aa2b851e
20 changed files with 9 additions and 8 deletions

View file

@ -2,7 +2,7 @@ from flask import current_app, render_template, request, redirect, Blueprint, fl
from flask.ext.login import logout_user from flask.ext.login import logout_user
from realms.modules.auth.models import Auth from realms.modules.auth.models import Auth
blueprint = Blueprint('auth', __name__) blueprint = Blueprint('auth', __name__, template_folder='templates')
@blueprint.route("/login", methods=['GET', 'POST']) @blueprint.route("/login", methods=['GET', 'POST'])

View file

@ -1,7 +1,7 @@
from flask import render_template, request, Blueprint from flask import render_template, request, Blueprint
from realms import search as search_engine from realms import search as search_engine
blueprint = Blueprint('search', __name__) blueprint = Blueprint('search', __name__, template_folder='templates')
@blueprint.route('/_search') @blueprint.route('/_search')

View file

@ -7,4 +7,4 @@ assets.register('editor.js',
'vendor/ace-builds/src/mode-markdown.js', 'vendor/ace-builds/src/mode-markdown.js',
'vendor/ace-builds/src/ext-keybinding_menu.js', 'vendor/ace-builds/src/ext-keybinding_menu.js',
'vendor/keymaster/keymaster.js', 'vendor/keymaster/keymaster.js',
'js/aced.js') 'wiki/js/aced.js')

View file

@ -6,7 +6,7 @@
var PAGE_NAME = '{{ name }}'; var PAGE_NAME = '{{ name }}';
</script> </script>
<script src="{{ url_for('static', filename='js/editor.js') }}"></script> <script src="{{ url_for('wiki.static', filename='js/editor.js') }}"></script>
{% if partials %} {% if partials %}
<script> <script>
@ -25,7 +25,7 @@
{% endif %} {% endif %}
{% if config.get('COLLABORATION') %} {% if config.get('COLLABORATION') %}
<script src="{{ url_for('static', filename='js/collaboration/main.js') }}"></script> <script src="{{ url_for('wiki.static', filename='js/collaboration/main.js') }}"></script>
{% endif %} {% endif %}
{% if config.get('COLLABORATION') == 'firepad' %} {% if config.get('COLLABORATION') == 'firepad' %}
@ -34,11 +34,11 @@
</script> </script>
<script src="https://cdn.firebase.com/js/client/1.0.17/firebase.js"></script> <script src="https://cdn.firebase.com/js/client/1.0.17/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/firepad/1.0.0/firepad.min.js"></script> <script src="https://cdn.firebase.com/libs/firepad/1.0.0/firepad.min.js"></script>
<script src="{{ url_for('static', filename='js/collaboration/firepad.js') }}"></script> <script src="{{ url_for('wiki.static', filename='js/collaboration/firepad.js') }}"></script>
{% endif %} {% endif %}
{% if config.get('COLLABORATION') == 'togetherjs' %} {% if config.get('COLLABORATION') == 'togetherjs' %}
<script src="{{ url_for('static', filename='js/collaboration/togetherjs.js') }}"></script> <script src="{{ url_for('wiki.static', filename='js/collaboration/togetherjs.js') }}"></script>
<script src="https://togetherjs.com/togetherjs-min.js"></script> <script src="https://togetherjs.com/togetherjs-min.js"></script>
{% endif %} {% endif %}

View file

@ -6,7 +6,8 @@ from flask.ext.login import login_required, current_user
from realms.lib.util import to_canonical, remove_ext, gravatar_url from realms.lib.util import to_canonical, remove_ext, gravatar_url
from .models import PageNotFound from .models import PageNotFound
blueprint = Blueprint('wiki', __name__) blueprint = Blueprint('wiki', __name__, template_folder='templates',
static_folder='static', static_url_path='/static/wiki')
@blueprint.route("/_commit/<sha>/<path:name>") @blueprint.route("/_commit/<sha>/<path:name>")