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