From 33aa2b851e830dacc8e692eb568e42429ddd9bb6 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Mon, 15 Aug 2016 23:06:05 -0400 Subject: [PATCH] Make modules contain their own static files and templates --- realms/{ => modules/auth}/templates/auth/ldap/login.html | 0 realms/{ => modules/auth}/templates/auth/local/login.html | 0 realms/{ => modules/auth}/templates/auth/login.html | 0 realms/{ => modules/auth}/templates/auth/register.html | 0 realms/{ => modules/auth}/templates/auth/settings.html | 0 realms/modules/auth/views.py | 2 +- realms/{ => modules/search}/templates/search/search.html | 0 realms/modules/search/views.py | 2 +- realms/modules/wiki/assets.py | 2 +- realms/{ => modules/wiki}/static/js/aced.js | 0 .../{ => modules/wiki}/static/js/collaboration/firepad.js | 0 realms/{ => modules/wiki}/static/js/collaboration/main.js | 0 .../wiki}/static/js/collaboration/togetherjs.js | 0 realms/{ => modules/wiki}/static/js/editor.js | 0 realms/{ => modules/wiki}/templates/wiki/compare.html | 0 realms/{ => modules/wiki}/templates/wiki/edit.html | 8 ++++---- realms/{ => modules/wiki}/templates/wiki/history.html | 0 realms/{ => modules/wiki}/templates/wiki/index.html | 0 realms/{ => modules/wiki}/templates/wiki/page.html | 0 realms/modules/wiki/views.py | 3 ++- 20 files changed, 9 insertions(+), 8 deletions(-) rename realms/{ => modules/auth}/templates/auth/ldap/login.html (100%) rename realms/{ => modules/auth}/templates/auth/local/login.html (100%) rename realms/{ => modules/auth}/templates/auth/login.html (100%) rename realms/{ => modules/auth}/templates/auth/register.html (100%) rename realms/{ => modules/auth}/templates/auth/settings.html (100%) rename realms/{ => modules/search}/templates/search/search.html (100%) rename realms/{ => modules/wiki}/static/js/aced.js (100%) rename realms/{ => modules/wiki}/static/js/collaboration/firepad.js (100%) rename realms/{ => modules/wiki}/static/js/collaboration/main.js (100%) rename realms/{ => modules/wiki}/static/js/collaboration/togetherjs.js (100%) rename realms/{ => modules/wiki}/static/js/editor.js (100%) rename realms/{ => modules/wiki}/templates/wiki/compare.html (100%) rename realms/{ => modules/wiki}/templates/wiki/edit.html (95%) rename realms/{ => modules/wiki}/templates/wiki/history.html (100%) rename realms/{ => modules/wiki}/templates/wiki/index.html (100%) rename realms/{ => modules/wiki}/templates/wiki/page.html (100%) diff --git a/realms/templates/auth/ldap/login.html b/realms/modules/auth/templates/auth/ldap/login.html similarity index 100% rename from realms/templates/auth/ldap/login.html rename to realms/modules/auth/templates/auth/ldap/login.html diff --git a/realms/templates/auth/local/login.html b/realms/modules/auth/templates/auth/local/login.html similarity index 100% rename from realms/templates/auth/local/login.html rename to realms/modules/auth/templates/auth/local/login.html diff --git a/realms/templates/auth/login.html b/realms/modules/auth/templates/auth/login.html similarity index 100% rename from realms/templates/auth/login.html rename to realms/modules/auth/templates/auth/login.html diff --git a/realms/templates/auth/register.html b/realms/modules/auth/templates/auth/register.html similarity index 100% rename from realms/templates/auth/register.html rename to realms/modules/auth/templates/auth/register.html diff --git a/realms/templates/auth/settings.html b/realms/modules/auth/templates/auth/settings.html similarity index 100% rename from realms/templates/auth/settings.html rename to realms/modules/auth/templates/auth/settings.html diff --git a/realms/modules/auth/views.py b/realms/modules/auth/views.py index 8ca607f..11b1472 100644 --- a/realms/modules/auth/views.py +++ b/realms/modules/auth/views.py @@ -2,7 +2,7 @@ from flask import current_app, render_template, request, redirect, Blueprint, fl from flask.ext.login import logout_user from realms.modules.auth.models import Auth -blueprint = Blueprint('auth', __name__) +blueprint = Blueprint('auth', __name__, template_folder='templates') @blueprint.route("/login", methods=['GET', 'POST']) diff --git a/realms/templates/search/search.html b/realms/modules/search/templates/search/search.html similarity index 100% rename from realms/templates/search/search.html rename to realms/modules/search/templates/search/search.html diff --git a/realms/modules/search/views.py b/realms/modules/search/views.py index f94d27e..7892853 100644 --- a/realms/modules/search/views.py +++ b/realms/modules/search/views.py @@ -1,7 +1,7 @@ from flask import render_template, request, Blueprint from realms import search as search_engine -blueprint = Blueprint('search', __name__) +blueprint = Blueprint('search', __name__, template_folder='templates') @blueprint.route('/_search') diff --git a/realms/modules/wiki/assets.py b/realms/modules/wiki/assets.py index 8b2162d..8f20b42 100644 --- a/realms/modules/wiki/assets.py +++ b/realms/modules/wiki/assets.py @@ -7,4 +7,4 @@ assets.register('editor.js', 'vendor/ace-builds/src/mode-markdown.js', 'vendor/ace-builds/src/ext-keybinding_menu.js', 'vendor/keymaster/keymaster.js', - 'js/aced.js') + 'wiki/js/aced.js') diff --git a/realms/static/js/aced.js b/realms/modules/wiki/static/js/aced.js similarity index 100% rename from realms/static/js/aced.js rename to realms/modules/wiki/static/js/aced.js diff --git a/realms/static/js/collaboration/firepad.js b/realms/modules/wiki/static/js/collaboration/firepad.js similarity index 100% rename from realms/static/js/collaboration/firepad.js rename to realms/modules/wiki/static/js/collaboration/firepad.js diff --git a/realms/static/js/collaboration/main.js b/realms/modules/wiki/static/js/collaboration/main.js similarity index 100% rename from realms/static/js/collaboration/main.js rename to realms/modules/wiki/static/js/collaboration/main.js diff --git a/realms/static/js/collaboration/togetherjs.js b/realms/modules/wiki/static/js/collaboration/togetherjs.js similarity index 100% rename from realms/static/js/collaboration/togetherjs.js rename to realms/modules/wiki/static/js/collaboration/togetherjs.js diff --git a/realms/static/js/editor.js b/realms/modules/wiki/static/js/editor.js similarity index 100% rename from realms/static/js/editor.js rename to realms/modules/wiki/static/js/editor.js diff --git a/realms/templates/wiki/compare.html b/realms/modules/wiki/templates/wiki/compare.html similarity index 100% rename from realms/templates/wiki/compare.html rename to realms/modules/wiki/templates/wiki/compare.html diff --git a/realms/templates/wiki/edit.html b/realms/modules/wiki/templates/wiki/edit.html similarity index 95% rename from realms/templates/wiki/edit.html rename to realms/modules/wiki/templates/wiki/edit.html index 398cbae..aef6a3b 100644 --- a/realms/templates/wiki/edit.html +++ b/realms/modules/wiki/templates/wiki/edit.html @@ -6,7 +6,7 @@ var PAGE_NAME = '{{ name }}'; - + {% if partials %} + {% endif %} {% if config.get('COLLABORATION') == 'firepad' %} @@ -34,11 +34,11 @@ - + {% endif %} {% if config.get('COLLABORATION') == 'togetherjs' %} - + {% endif %} diff --git a/realms/templates/wiki/history.html b/realms/modules/wiki/templates/wiki/history.html similarity index 100% rename from realms/templates/wiki/history.html rename to realms/modules/wiki/templates/wiki/history.html diff --git a/realms/templates/wiki/index.html b/realms/modules/wiki/templates/wiki/index.html similarity index 100% rename from realms/templates/wiki/index.html rename to realms/modules/wiki/templates/wiki/index.html diff --git a/realms/templates/wiki/page.html b/realms/modules/wiki/templates/wiki/page.html similarity index 100% rename from realms/templates/wiki/page.html rename to realms/modules/wiki/templates/wiki/page.html diff --git a/realms/modules/wiki/views.py b/realms/modules/wiki/views.py index c851741..017b7f9 100644 --- a/realms/modules/wiki/views.py +++ b/realms/modules/wiki/views.py @@ -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 .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//")