This commit is contained in:
2017-12-25 20:23:32 +01:00
parent 1175a4f8ff
commit 0cc882060c
36 changed files with 781 additions and 86 deletions
+32 -6
View File
@@ -10,15 +10,41 @@ $( function () {
dbo.menuModel = {
init : function(){
pages : ko.observable(),
initialized: ko.observable( false ),
init: function () {
var vm = dbo.menuModel;
dbo.pageDataservice.getAppPages( function ( data ) {
vm.pages = data;
//create for each page an observable
$.each( data, function ( i, p ) {
vm[p.pageurl] = ko.observable( false );
} );
// first page will be visible
vm[data[0].pageurl]( true );
ko.applyBindings( dbo.menuModel, document.getElementById( "dbois-app" ) );
vm.initialized( true );
} );
},
setPage: function ( page ) {
var vm = dbo.menuModel;
$.each( vm.pages, function ( i, p ) {
vm[p.pageurl]( false );
} );
vm[page]( true );
var func = page.toLowerCase() + 'Init';
window.dbo[func]();
}
}
dbo.menuModel.init();
ko.applyBindings(dbo.menuModel, document.getElementById("dbois-app"));
} );