diff --git a/openlp/core/api/http/__init__.py b/openlp/core/api/http/__init__.py
index d98322015..983929625 100644
--- a/openlp/core/api/http/__init__.py
+++ b/openlp/core/api/http/__init__.py
@@ -57,6 +57,9 @@ def register_endpoint(end_point):
static_route = _route_from_url(end_point.url_prefix, 'static')
static_route += '(.*)'
application.add_static_route(static_route, end_point.static_dir)
+ assets_route = _route_from_url('', 'assets')
+ assets_route += '(.*)'
+ application.add_static_route(assets_route, end_point.assets_dir)
def check_auth(auth):
diff --git a/openlp/core/api/http/endpoint/__init__.py b/openlp/core/api/http/endpoint/__init__.py
index d7a09ab08..1acaca872 100644
--- a/openlp/core/api/http/endpoint/__init__.py
+++ b/openlp/core/api/http/endpoint/__init__.py
@@ -32,13 +32,17 @@ class Endpoint(object):
"""
This is an endpoint for the HTTP API
"""
- def __init__(self, url_prefix, template_dir=None, static_dir=None):
+ def __init__(self, url_prefix, template_dir=None, static_dir=None, assets_dir=None):
"""
Create an endpoint with a URL prefix
"""
self.url_prefix = url_prefix
self.static_dir = static_dir
self.template_dir = template_dir
+ if assets_dir:
+ self.assets_dir = assets_dir
+ else:
+ self.assets_dir = os.path.dirname(os.path.realpath(__file__))
self.routes = []
def add_url_route(self, url, view_func, method):
@@ -66,11 +70,9 @@ class Endpoint(object):
if not self.template_dir:
raise Exception('No template directory specified')
path = os.path.abspath(os.path.join(self.template_dir, filename))
- print(path)
- print(self.static_dir)
- print('/{prefix}/static'.format(prefix=self.url_prefix))
- # if self.static_dir:
- # kwargs['static_url'] = '/{prefix}/static'.format(prefix=self.url_prefix)
+ if self.static_dir:
+ kwargs['static_url'] = '/{prefix}/static'.format(prefix=self.url_prefix)
+ kwargs['assets_url'] = '/assets'
return Template(filename=path, input_encoding='utf-8').render(**kwargs)
diff --git a/openlp/core/api/http/endpoint/static/assets/jquery.js b/openlp/core/api/http/endpoint/assets/jquery.js
similarity index 100%
rename from openlp/core/api/http/endpoint/static/assets/jquery.js
rename to openlp/core/api/http/endpoint/assets/jquery.js
diff --git a/openlp/core/api/http/endpoint/static/assets/jquery.min.js b/openlp/core/api/http/endpoint/assets/jquery.min.js
similarity index 100%
rename from openlp/core/api/http/endpoint/static/assets/jquery.min.js
rename to openlp/core/api/http/endpoint/assets/jquery.min.js
diff --git a/openlp/core/api/http/endpoint/static/assets/jquery.mobile.js b/openlp/core/api/http/endpoint/assets/jquery.mobile.js
similarity index 100%
rename from openlp/core/api/http/endpoint/static/assets/jquery.mobile.js
rename to openlp/core/api/http/endpoint/assets/jquery.mobile.js
diff --git a/openlp/core/api/http/endpoint/static/assets/jquery.mobile.min.css b/openlp/core/api/http/endpoint/assets/jquery.mobile.min.css
similarity index 100%
rename from openlp/core/api/http/endpoint/static/assets/jquery.mobile.min.css
rename to openlp/core/api/http/endpoint/assets/jquery.mobile.min.css
diff --git a/openlp/core/api/http/endpoint/static/assets/jquery.mobile.min.js b/openlp/core/api/http/endpoint/assets/jquery.mobile.min.js
similarity index 100%
rename from openlp/core/api/http/endpoint/static/assets/jquery.mobile.min.js
rename to openlp/core/api/http/endpoint/assets/jquery.mobile.min.js
diff --git a/openlp/core/api/http/endpoint/core.py b/openlp/core/api/http/endpoint/core.py
index 1776ec42a..955f9d3dc 100644
--- a/openlp/core/api/http/endpoint/core.py
+++ b/openlp/core/api/http/endpoint/core.py
@@ -65,19 +65,7 @@ def stage_index(request):
"""
Deliver the page for the /stage url
"""
- #file_name = request.path
- #html_dir = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'core', 'api', 'html')
- #log.debug('serve file request {name}'.format(name=file_name))
- #if file_name.startswith('/'):
- # file_name = file_name[1:]
- #if not file_name:
- # file_name = 'index.mako'
- #if '.' not in file_name:
- # file_name += '.html'
- #if file_name.startswith('/'):
- # file_name = file_name[1:]
- #path = os.path.normpath(os.path.join(html_dir, file_name))
- return stage_endpoint.render_template('stage.mako', **TRANSLATED_STRINGS, static_url=static_dir)
+ return stage_endpoint.render_template('stage.mako', **TRANSLATED_STRINGS)
@main_endpoint.route('')
@@ -85,7 +73,7 @@ def main_index(request):
"""
Deliver the page for the /main url
"""
- return stage_endpoint.render_template('main.mako', **TRANSLATED_STRINGS)
+ return main_endpoint.render_template('main.mako', **TRANSLATED_STRINGS)
@blank_endpoint.route('')
diff --git a/openlp/core/api/http/endpoint/static/js/openlp.js b/openlp/core/api/http/endpoint/static/js/openlp.js
index 929209b52..27193007c 100644
--- a/openlp/core/api/http/endpoint/static/js/openlp.js
+++ b/openlp/core/api/http/endpoint/static/js/openlp.js
@@ -100,7 +100,7 @@ window.OpenLP = {
}
text = text.replace(/\n/g, '
');
if (slide["img"]) {
- text += "";
+ text += "";
}
var li = $("