mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
Finish URL design
This commit is contained in:
@@ -7,22 +7,22 @@ define([
|
||||
'app/views/group',
|
||||
'app/views/organization',
|
||||
'app/views/group-nav',
|
||||
], function($, Backbone, Common, MyHomeView, GroupView, orgView,
|
||||
], function($, Backbone, Common, MyHomeView, GroupView, OrgView,
|
||||
GroupNavView) {
|
||||
"use strict";
|
||||
|
||||
var Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
'my-libs': 'showMyRepos',
|
||||
'my-libs/': 'showMyRepos',
|
||||
'my-libs/lib/:repo_id(/*path)': 'showMyRepoDir',
|
||||
'my-sub-libs': 'showMySubRepos',
|
||||
'my-sub-libs/': 'showMySubRepos',
|
||||
'my-sub-libs/lib/:repo_id(/*path)': 'showMySubRepoDir',
|
||||
'shared-libs': 'showSharedRepos',
|
||||
'shared-libs/': 'showSharedRepos',
|
||||
'shared-libs/lib/:repo_id(/*path)': 'showSharedRepoDir',
|
||||
'group/:group_id/': 'showGroupRepos',
|
||||
'group/:group_id/:repo_id(/*path)': 'showGroupRepoDir',
|
||||
'org': 'showOrgRepos',
|
||||
'org/:repo_id(/*path)': 'showOrgRepoDir',
|
||||
'group/:group_id/lib/:repo_id(/*path)': 'showGroupRepoDir',
|
||||
'org/': 'showOrgRepos',
|
||||
'org/lib/:repo_id(/*path)': 'showOrgRepoDir',
|
||||
|
||||
// Default
|
||||
'*actions': 'defaultAction'
|
||||
@@ -35,27 +35,31 @@ define([
|
||||
|
||||
this.myHomeView = new MyHomeView();
|
||||
this.groupView = new GroupView();
|
||||
this.orgView = new orgView();
|
||||
this.orgView = new OrgView();
|
||||
this.currentView = this.myHomeView;
|
||||
|
||||
this.groupNavView = new GroupNavView();
|
||||
},
|
||||
|
||||
switchCurrentView: function(newView) {
|
||||
if (this.currentView != newView) {
|
||||
this.currentView.hide();
|
||||
this.currentView = newView;
|
||||
}
|
||||
},
|
||||
|
||||
showMyRepos: function() {
|
||||
this.currentView.hide();
|
||||
this.currentView = this.myHomeView;
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showMyRepos();
|
||||
},
|
||||
|
||||
showMySubRepos: function() {
|
||||
this.currentView.hide();
|
||||
this.currentView = this.myHomeView;
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showMySubRepos();
|
||||
},
|
||||
|
||||
showSharedRepos: function() {
|
||||
this.currentView.hide();
|
||||
this.currentView = this.myHomeView;
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showSharedRepos();
|
||||
},
|
||||
|
||||
@@ -65,8 +69,7 @@ define([
|
||||
} else {
|
||||
path = '/';
|
||||
}
|
||||
this.currentView.hide();
|
||||
this.currentView = this.myHomeView;
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showDir('my-libs', repo_id, path);
|
||||
},
|
||||
|
||||
@@ -76,8 +79,7 @@ define([
|
||||
} else {
|
||||
path = '/';
|
||||
}
|
||||
this.currentView.hide();
|
||||
this.currentView = this.myHomeView;
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showDir('my-sub-libs', repo_id, path);
|
||||
},
|
||||
|
||||
@@ -87,14 +89,12 @@ define([
|
||||
} else {
|
||||
path = '/';
|
||||
}
|
||||
this.currentView.hide();
|
||||
this.currentView = this.myHomeView;
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showDir('shared-libs', repo_id, path);
|
||||
},
|
||||
|
||||
showGroupRepos: function(group_id) {
|
||||
this.currentView.hide();
|
||||
this.currentView = this.groupView;
|
||||
this.switchCurrentView(this.groupView);
|
||||
this.groupView.showRepoList(group_id);
|
||||
},
|
||||
|
||||
@@ -104,14 +104,12 @@ define([
|
||||
} else {
|
||||
path = '/';
|
||||
}
|
||||
this.currentView.hide();
|
||||
this.currentView = this.groupView;
|
||||
this.switchCurrentView(this.groupView);
|
||||
this.groupView.showDir(group_id, repo_id, path);
|
||||
},
|
||||
|
||||
showOrgRepos: function() {
|
||||
this.currentView.hide();
|
||||
this.currentView = this.orgView;
|
||||
this.switchCurrentView(this.orgView);
|
||||
this.orgView.showRepoList();
|
||||
},
|
||||
|
||||
@@ -121,8 +119,7 @@ define([
|
||||
} else {
|
||||
path = '/';
|
||||
}
|
||||
this.currentView.hide();
|
||||
this.currentView = this.orgView;
|
||||
this.switchCurrentView(this.orgView);
|
||||
this.orgView.showDir(repo_id, path);
|
||||
},
|
||||
|
||||
@@ -130,6 +127,7 @@ define([
|
||||
// We have no matching route, lets just log what the URL was
|
||||
console.log('No route:', actions);
|
||||
|
||||
this.switchCurrentView(this.myHomeView);
|
||||
this.myHomeView.showMyRepos();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user