1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-24 01:30:57 +00:00
seahub/static/scripts/app/routers/group.js

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-01-21 14:22:34 +00:00
/*global define*/
define([
'jquery',
'backbone',
'app/collections/group-repos',
'app/views/group'
], function($, Backbone, Repos, GroupView) {
"use strict";
var GroupRouter = Backbone.Router.extend({
routes: {
'lib/:repo_id(/*path)': 'showDir',
2015-01-21 14:22:34 +00:00
2015-01-29 06:45:26 +00:00
'recent-changes': 'showRecentChanges',
2015-01-21 14:22:34 +00:00
// Default
'*actions': 'defaultAction'
},
2015-01-29 06:45:26 +00:00
initialize: function() {
this.groupView = new GroupView();
},
showDir: function(repo_id, path) {
if (path) {
path = '/' + path;
} else {
path = '/';
}
this.groupView.showDir(repo_id, path);
2015-01-21 14:22:34 +00:00
},
2015-01-29 06:45:26 +00:00
showRecentChanges: function() {
console.log('recent changes');
this.groupView.showChanges();
},
2015-01-21 14:22:34 +00:00
defaultAction: function(actions){
// We have no matching route, lets just log what the URL was
console.log('No route:', actions);
2015-01-29 06:45:26 +00:00
this.groupView.showRepoList();
2015-01-21 14:22:34 +00:00
}
});
return GroupRouter;
});