@@ -11,9 +11,6 @@ var app = {
11
11
OFFLINE : 'offline' ,
12
12
FAILURE : 'failure' ,
13
13
ERROR : 'error' ,
14
- get wq_config ( ) {
15
- return this . getAuthState ( ) . config || this . config ;
16
- } ,
17
14
get user ( ) {
18
15
return this . getAuthState ( ) . user ;
19
16
} ,
@@ -209,7 +206,7 @@ app.init = function (config) {
209
206
// Register routes with wq/router.js
210
207
var root = false ;
211
208
Object . keys ( app . config . pages ) . forEach ( function ( page ) {
212
- var conf = _getBaseConf ( page ) ;
209
+ var conf = _getConf ( page ) ;
213
210
if ( ! conf . url ) {
214
211
root = true ;
215
212
}
@@ -540,7 +537,7 @@ const syncUpdateUrl = {
540
537
541
538
// Return a list of all foreign key fields
542
539
app . getParents = function ( page ) {
543
- var conf = _getBaseConf ( page ) ;
540
+ var conf = _getConf ( page ) ;
544
541
return conf . form
545
542
. filter ( function ( field ) {
546
543
return field [ 'wq:ForeignKey' ] ;
@@ -630,7 +627,7 @@ function _extendRouteInfo(routeInfo) {
630
627
const routeName = routeInfo . name ,
631
628
itemid = ( page !== 'outbox' && routeInfo . slugs . slug ) || null ;
632
629
var [ page , mode , variant ] = app . splitRoute ( routeName ) ,
633
- conf = _getConf ( page , true , true ) ,
630
+ conf = _getConf ( page , true ) ,
634
631
pageid = null ;
635
632
636
633
if ( conf ) {
@@ -675,14 +672,14 @@ function _extendRouteInfo(routeInfo) {
675
672
// Generate list view context and render with [url]_list template;
676
673
// handles requests for [url] and [url]/
677
674
_register . list = function ( page ) {
678
- const conf = _getBaseConf ( page ) ,
675
+ const conf = _getConf ( page ) ,
679
676
register = conf . url === '' ? router . registerLast : router . register ,
680
677
url = conf . url === '' ? '' : conf . url + '/' ;
681
678
register ( url , _joinRoute ( page , 'list' ) , ctx => _displayList ( ctx ) ) ;
682
679
683
680
// Special handling for /[parent_list_url]/[parent_id]/[url]
684
681
app . getParents ( page ) . forEach ( function ( ppage ) {
685
- var pconf = _getBaseConf ( ppage ) ;
682
+ var pconf = _getConf ( ppage ) ;
686
683
var url = pconf . url ;
687
684
var registerParent ;
688
685
if ( url === '' ) {
@@ -866,7 +863,7 @@ async function _displayList(ctx, parentInfo) {
866
863
// Generate item detail view context and render with [url]_detail template;
867
864
// handles requests for [url]/[id]
868
865
_register . detail = function ( page , mode , contextFn = _displayItem ) {
869
- var conf = _getBaseConf ( page ) ;
866
+ var conf = _getConf ( page ) ;
870
867
var url = _getDetailUrl ( conf . url , mode ) ;
871
868
const register = conf . url === '' ? router . registerLast : router . register ;
872
869
register ( url , _joinRoute ( page , mode ) , contextFn ) ;
@@ -886,7 +883,7 @@ function _getDetailUrl(url, mode) {
886
883
// Generate item edit context and render with [url]_edit template;
887
884
// handles requests for [url]/[id]/edit and [url]/new
888
885
_register . edit = function ( page ) {
889
- var conf = _getBaseConf ( page ) ;
886
+ var conf = _getConf ( page ) ;
890
887
const register = conf . url === '' ? router . registerLast : router . register ;
891
888
register (
892
889
_getDetailUrl ( conf . url , 'edit' ) ,
@@ -953,7 +950,7 @@ async function _displayItem(ctx) {
953
950
// Render non-list pages with with [url] template;
954
951
// handles requests for [url] and [url]/
955
952
function _registerOther ( page ) {
956
- var conf = _getBaseConf ( page ) ;
953
+ var conf = _getConf ( page ) ;
957
954
router . register (
958
955
conf . url ,
959
956
page ,
@@ -1451,16 +1448,8 @@ function _default_attachments(field, context) {
1451
1448
}
1452
1449
1453
1450
// Load configuration based on page id
1454
- function _getBaseConf ( page ) {
1455
- return _getConf ( page , false , true ) ;
1456
- }
1457
-
1458
- function _getConf ( page , silentFail , baseConf ) {
1459
- var conf = ( baseConf ? app . config : app . wq_config ) . pages [ page ] ;
1460
- if ( ! conf && ! baseConf ) {
1461
- return _getConf ( page , silentFail , true ) ;
1462
- }
1463
-
1451
+ function _getConf ( page , silentFail ) {
1452
+ var conf = app . config . pages [ page ] ;
1464
1453
if ( ! conf ) {
1465
1454
if ( silentFail ) {
1466
1455
return ;
0 commit comments