|
@@ -3,12 +3,14 @@ import os
|
3
|
3
|
from pyramid.renderers import render_to_response
|
4
|
4
|
from pyramid.config import Configurator
|
5
|
5
|
from tracim_backend.exceptions import PageNotFound
|
|
6
|
+from tracim_backend.models.applications import applications
|
6
|
7
|
from tracim_backend.views import BASE_API_V2
|
7
|
8
|
from tracim_backend.lib.utils.request import TracimRequest
|
8
|
9
|
from tracim_backend.views.controllers import Controller
|
9
|
10
|
import spectra
|
10
|
11
|
|
11
|
12
|
INDEX_PAGE_NAME = 'index.mak'
|
|
13
|
+APP_FRONTEND_PATH = 'app/{minislug}.app.js'
|
12
|
14
|
|
13
|
15
|
|
14
|
16
|
class FrontendController(Controller):
|
|
@@ -29,9 +31,24 @@ class FrontendController(Controller):
|
29
|
31
|
return self.index(context, request)
|
30
|
32
|
|
31
|
33
|
def index(self, context, request: TracimRequest):
|
|
34
|
+ app_config = request.registry.settings['CFG']
|
|
35
|
+ # TODO - G.M - 2018-08-07 - Refactor autogen valid app list for frontend
|
|
36
|
+ frontend_apps = []
|
|
37
|
+ for app in applications:
|
|
38
|
+ app_frontend_path = APP_FRONTEND_PATH.replace('{minislug}',
|
|
39
|
+ app.minislug) # nopep8
|
|
40
|
+ app_path = os.path.join(self.dist_folder_path,
|
|
41
|
+ app_frontend_path) # nopep8
|
|
42
|
+ if os.path.exists(app_path):
|
|
43
|
+ frontend_apps.append(app)
|
32
|
44
|
return render_to_response(
|
33
|
45
|
self._get_index_file_path(),
|
34
|
|
- {'primary': spectra.html('#7d4e24')}
|
|
46
|
+ {
|
|
47
|
+ 'colors': {
|
|
48
|
+ 'primary': spectra.html('#7d4e24'),
|
|
49
|
+ },
|
|
50
|
+ 'applications': frontend_apps,
|
|
51
|
+ }
|
35
|
52
|
)
|
36
|
53
|
|
37
|
54
|
def bind(self, configurator: Configurator) -> None:
|