2015-01-20 18:25:10 +08:00
|
|
|
define([
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
2015-01-31 13:17:47 +08:00
|
|
|
'common',
|
2015-02-01 14:15:00 +08:00
|
|
|
'app/views/myhome-repos',
|
2015-03-30 10:55:23 +08:00
|
|
|
'app/views/myhome-sub-repos',
|
2015-02-04 21:57:26 +08:00
|
|
|
'app/views/myhome-shared-repos',
|
2015-05-04 17:02:20 +08:00
|
|
|
'app/views/starred-file',
|
2015-11-21 15:29:42 +08:00
|
|
|
'app/views/activities'
|
2015-04-17 10:59:48 +08:00
|
|
|
], function($, _, Backbone, Common, ReposView, SubReposView,
|
2015-11-21 15:29:42 +08:00
|
|
|
SharedReposView, StarredFileView, ActivitiesView) {
|
2015-01-20 18:25:10 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var MyHomeView = Backbone.View.extend({
|
|
|
|
el: '#main',
|
|
|
|
|
2015-04-17 18:07:17 +08:00
|
|
|
initialize: function(options) {
|
2015-02-01 14:15:00 +08:00
|
|
|
this.reposView = new ReposView();
|
2015-03-30 10:55:23 +08:00
|
|
|
this.subReposView = new SubReposView();
|
2015-02-04 21:57:26 +08:00
|
|
|
this.sharedReposView = new SharedReposView();
|
2015-05-04 17:02:20 +08:00
|
|
|
this.starredFileView = new StarredFileView();
|
2015-07-28 19:54:57 +08:00
|
|
|
this.activitiesView = new ActivitiesView();
|
2015-04-17 18:07:17 +08:00
|
|
|
|
|
|
|
this.dirView = options.dirView;
|
|
|
|
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView = this.reposView;
|
2015-02-11 22:36:35 +08:00
|
|
|
|
2015-03-22 22:39:39 +08:00
|
|
|
$('#initial-loading-view').hide();
|
2015-01-20 18:25:10 +08:00
|
|
|
},
|
|
|
|
|
2015-02-04 21:57:26 +08:00
|
|
|
showMyRepos: function() {
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView.hide();
|
2015-02-01 14:15:00 +08:00
|
|
|
this.reposView.show();
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView = this.reposView;
|
2015-01-20 18:25:10 +08:00
|
|
|
},
|
|
|
|
|
2015-03-30 10:55:23 +08:00
|
|
|
showMySubRepos: function() {
|
|
|
|
this.currentView.hide();
|
|
|
|
this.subReposView.show();
|
|
|
|
this.currentView = this.subReposView;
|
|
|
|
},
|
|
|
|
|
2015-02-04 21:57:26 +08:00
|
|
|
showSharedRepos: function() {
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView.hide();
|
2015-02-04 21:57:26 +08:00
|
|
|
this.sharedReposView.show();
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView = this.sharedReposView;
|
2015-02-04 21:57:26 +08:00
|
|
|
},
|
|
|
|
|
2015-05-04 17:02:20 +08:00
|
|
|
showStarredFile: function() {
|
|
|
|
this.currentView.hide();
|
|
|
|
this.starredFileView.show();
|
|
|
|
this.currentView = this.starredFileView;
|
|
|
|
},
|
|
|
|
|
2015-07-28 19:54:57 +08:00
|
|
|
showActivities: function() {
|
2015-07-24 11:37:57 +08:00
|
|
|
this.currentView.hide();
|
2015-07-28 19:54:57 +08:00
|
|
|
this.activitiesView.show();
|
|
|
|
this.currentView = this.activitiesView;
|
2015-07-24 11:37:57 +08:00
|
|
|
},
|
|
|
|
|
2015-02-06 17:32:02 +08:00
|
|
|
showDir: function(category, repo_id, path) {
|
2015-01-20 18:25:10 +08:00
|
|
|
var path = path || '/';
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView.hide();
|
2015-02-06 17:32:02 +08:00
|
|
|
this.dirView.showDir(category, repo_id, path);
|
2015-03-22 22:39:39 +08:00
|
|
|
this.currentView = this.dirView;
|
2015-04-11 15:14:56 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
hide: function() {
|
|
|
|
this.currentView.hide();
|
2015-03-30 10:55:23 +08:00
|
|
|
}
|
2015-01-31 13:17:47 +08:00
|
|
|
|
2015-01-20 18:25:10 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
return MyHomeView;
|
|
|
|
});
|