git-svn-id: https://msi/svn/firstRepo/Management/trunk@8 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
define(['jquery', 'underscore', 'backbone',
|
||||
'modules/home/home','modules/ricette/ricette'],//, 'jQueryPlugins'],
|
||||
function($, _, Backbone,
|
||||
HomeView, RicetteView) {
|
||||
|
||||
'use strict';
|
||||
var Router = Backbone.Router.extend({
|
||||
//define routes and mapping route to the function
|
||||
routes: {
|
||||
'': 'showHome', //home view
|
||||
'homeView': 'showHome', //home view as well
|
||||
'*actions': 'defaultAction' //default action
|
||||
},
|
||||
|
||||
defaultAction: function(actions){
|
||||
this.showHome(actions);
|
||||
},
|
||||
|
||||
modifyRicetta:function(){
|
||||
// will render home view and navigate to homeView
|
||||
|
||||
this.changePage(ricetteView);
|
||||
},
|
||||
|
||||
showHome:function(actions){
|
||||
// will render home view and navigate to homeView
|
||||
var homeView=new HomeView();
|
||||
homeView.render();
|
||||
this.changePage(homeView);
|
||||
},
|
||||
|
||||
changePage:function (view) {
|
||||
|
||||
//append to dom
|
||||
$('body').append(view.$el);
|
||||
|
||||
//$.mobile.pageContainer.pagecontainer ("change", $(view.el), {changeHash:false});
|
||||
|
||||
//FastClick.attach(document.body);
|
||||
|
||||
if(!this.init){
|
||||
|
||||
}else{
|
||||
this.init = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Router;
|
||||
});
|
||||
Reference in New Issue
Block a user