mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-03-16 22:20:23 +00:00
52 lines
No EOL
956 B
JavaScript
52 lines
No EOL
956 B
JavaScript
define([
|
|
'jquery',
|
|
'backbone',
|
|
'bus'
|
|
], function( $, Backbone, bus ){
|
|
|
|
return Backbone.Router.extend({
|
|
routes: {
|
|
"" : "home",
|
|
"requests" : "requests",
|
|
"wiretap" : "wiretap",
|
|
"*anything" : "redirect"
|
|
},
|
|
|
|
initialize: function() {
|
|
var self = this;
|
|
_.bindAll( self );
|
|
|
|
$( document ).delegate( "a.ps-nav", "click", function( e ){
|
|
e.preventDefault();
|
|
self.navigate( $( this ).attr( 'href' ), { trigger: true });
|
|
});
|
|
bus.router.publish( "initialized" );
|
|
},
|
|
|
|
activateUI: function( uiName, context ) {
|
|
bus.viewManager.publish({
|
|
topic: "ui.show",
|
|
data: {
|
|
name: uiName,
|
|
context: context
|
|
}
|
|
});
|
|
},
|
|
|
|
home: function() {
|
|
this.activateUI( "homeUI" );
|
|
},
|
|
|
|
requests: function() {
|
|
this.activateUI( "searchRequestUI" );
|
|
},
|
|
|
|
wiretap: function() {
|
|
this.activateUI( "wireTapLogUI" );
|
|
},
|
|
|
|
redirect: function() {
|
|
this.navigate( "/", { trigger: true });
|
|
}
|
|
});
|
|
}); |