Allow serving everything beneath a baseUrl with a path.
See: https://github.com/freifunkhamburg/ffffng/issues/44
This commit is contained in:
parent
3d6fb5feec
commit
8de06a0a8a
14 changed files with 85 additions and 55 deletions
|
@ -40,6 +40,8 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
var admin = nga.application(title);
|
||||
document.title = title;
|
||||
|
||||
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
|
||||
|
||||
admin
|
||||
.header(
|
||||
'<div class="navbar-header">' +
|
||||
|
@ -59,12 +61,12 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
'</a>' +
|
||||
'</p>' +
|
||||
'<p class="navbar-text navbar-right">' +
|
||||
'<a href="/" target="_blank">' +
|
||||
'<a href="' + pathPrefix + '/" target="_blank">' +
|
||||
'<i class="fa fa-external-link" aria-hidden="true"></i> Frontend' +
|
||||
'</a>' +
|
||||
'</p>'
|
||||
)
|
||||
.baseApiUrl('/internal/api/')
|
||||
.baseApiUrl(pathPrefix + '/internal/api/')
|
||||
.debug(true);
|
||||
|
||||
function nodeClasses(node) {
|
||||
|
@ -374,7 +376,7 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
.addChild(nga
|
||||
.menu()
|
||||
.template(
|
||||
'<a href="/internal/admin">' +
|
||||
'<a href="' + pathPrefix + '/internal/admin">' +
|
||||
'<span class="fa fa-dashboard"></span> Dashboard / Statistics' +
|
||||
'</a>'
|
||||
)
|
||||
|
@ -398,7 +400,7 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
.addChild(nga
|
||||
.menu()
|
||||
.template(
|
||||
'<a href="/internal/logs" target="_blank">' +
|
||||
'<a href="' + pathPrefix + '/internal/logs" target="_blank">' +
|
||||
'<span class="fa fa-list"></span> Logs' +
|
||||
'</a>'
|
||||
)
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffngAdmin')
|
||||
.directive('faDashboardStats', function ($http, $state, notification) {
|
||||
.directive('faDashboardStats', function ($http, $state, notification, config) {
|
||||
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
|
||||
|
||||
var link = function (scope) {
|
||||
scope.stats = {};
|
||||
$http.get('/internal/api/statistics')
|
||||
$http.get(pathPrefix + '/internal/api/statistics')
|
||||
.then(function (result) { scope.stats = result.data; })
|
||||
.catch(function (e) {
|
||||
notification.log('Error: ' + e.data, { addnCls: 'humane-flatty-error' });
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffngAdmin')
|
||||
.directive('faMailActionButton', function (Restangular, $state, notification) {
|
||||
.directive('faMailActionButton', function (Restangular, $state, notification, config) {
|
||||
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
|
||||
|
||||
var link = function (scope) {
|
||||
scope.label = scope.label || 'ACTION';
|
||||
scope.icon = scope.icon || 'envelope';
|
||||
|
@ -11,7 +13,7 @@ angular.module('ffffngAdmin')
|
|||
var mail = scope.mail();
|
||||
|
||||
Restangular
|
||||
.one('/internal/api/mails/' + scope.action, mail.values.id).put()
|
||||
.one(pathPrefix + '/internal/api/mails/' + scope.action, mail.values.id).put()
|
||||
.then(function () { $state.reload() })
|
||||
.then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); })
|
||||
.catch(function (e) {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffngAdmin')
|
||||
.directive('faTaskActionButton', function (Restangular, $state, notification) {
|
||||
.directive('faTaskActionButton', function (Restangular, $state, notification, config) {
|
||||
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
|
||||
|
||||
var link = function (scope) {
|
||||
scope.label = scope.label || 'ACTION';
|
||||
scope.icon = scope.icon || 'play';
|
||||
|
@ -11,7 +13,7 @@ angular.module('ffffngAdmin')
|
|||
var task = scope.task();
|
||||
|
||||
Restangular
|
||||
.one('/internal/api/tasks/' + scope.action, task.values.id).put()
|
||||
.one(pathPrefix + '/internal/api/tasks/' + scope.action, task.values.id).put()
|
||||
.then(function () { $state.reload() })
|
||||
.then(function () { notification.log('Done', { addnCls: 'humane-flatty-success' }); })
|
||||
.catch(function (e) {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffngAdmin')
|
||||
.directive('faVersion', function ($http, $state, notification) {
|
||||
.directive('faVersion', function ($http, $state, notification, config) {
|
||||
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
|
||||
|
||||
var link = function (scope) {
|
||||
scope.version = '?';
|
||||
$http.get('/api/version')
|
||||
$http.get(pathPrefix + '/api/version')
|
||||
.then(function (result) { scope.version = result.data.version; })
|
||||
.catch(function (e) {
|
||||
notification.log('Error: ' + e.data, { addnCls: 'humane-flatty-error' });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue