2015-01-20 10:25:10 +00:00
|
|
|
define([
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
2015-01-31 05:17:47 +00:00
|
|
|
'common',
|
2015-01-27 14:41:16 +00:00
|
|
|
'app/collections/groups',
|
2015-02-01 06:15:00 +00:00
|
|
|
'app/views/myhome-repos',
|
2015-02-04 13:57:26 +00:00
|
|
|
'app/views/myhome-shared-repos',
|
2015-01-27 14:41:16 +00:00
|
|
|
'app/views/dir',
|
2015-01-31 05:17:47 +00:00
|
|
|
'app/views/group-nav',
|
2015-02-01 06:15:00 +00:00
|
|
|
], function($, _, Backbone, Common, GroupCollection,
|
2015-02-04 13:57:26 +00:00
|
|
|
ReposView, SharedReposView, DirView, GroupNavView) {
|
2015-01-20 10:25:10 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var MyHomeView = Backbone.View.extend({
|
|
|
|
el: '#main',
|
|
|
|
|
|
|
|
initialize: function() {
|
2015-01-31 05:17:47 +00:00
|
|
|
Common.prepareApiCsrf();
|
|
|
|
|
2015-02-01 06:15:00 +00:00
|
|
|
//_.bindAll(this, 'ajaxLoadingShow', 'ajaxLoadingHide');
|
|
|
|
//this.$el.ajaxStart(this.ajaxLoadingShow).ajaxStop(this.ajaxLoadingHide);
|
2015-01-20 10:25:10 +00:00
|
|
|
|
2015-01-31 05:17:47 +00:00
|
|
|
this.$cont = this.$('#right-panel');
|
|
|
|
|
2015-02-01 06:15:00 +00:00
|
|
|
this.reposView = new ReposView();
|
2015-02-04 13:57:26 +00:00
|
|
|
this.sharedReposView = new SharedReposView();
|
2015-01-25 10:47:42 +00:00
|
|
|
this.dirView = new DirView();
|
2015-01-27 14:41:16 +00:00
|
|
|
this.groupView = new GroupNavView();
|
2015-03-22 14:39:39 +00:00
|
|
|
this.currentView = this.reposView;
|
2015-02-11 14:36:35 +00:00
|
|
|
|
|
|
|
Common.initAccountPopup();
|
2015-03-20 05:55:50 +00:00
|
|
|
Common.initNoticePopup();
|
2015-03-22 14:39:39 +00:00
|
|
|
|
|
|
|
$('#initial-loading-view').hide();
|
2015-01-20 10:25:10 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
2015-01-31 05:17:47 +00:00
|
|
|
ajaxLoadingShow: function() {
|
|
|
|
Common.feedback('Loading...', 'info', Common.INFO_TIMEOUT);
|
|
|
|
},
|
|
|
|
|
|
|
|
ajaxLoadingHide: function() {
|
|
|
|
$('.messages .info').hide();
|
|
|
|
},
|
|
|
|
|
|
|
|
hideLoading: function() {
|
|
|
|
this.$cont.find('.loading').hide();
|
2015-01-20 10:25:10 +00:00
|
|
|
},
|
|
|
|
|
2015-01-31 05:17:47 +00:00
|
|
|
showLoading: function() {
|
|
|
|
this.$cont.find('.loading').show();
|
|
|
|
},
|
|
|
|
|
2015-02-04 13:57:26 +00:00
|
|
|
showMyRepos: function() {
|
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-02-04 13:57:26 +00:00
|
|
|
showSharedRepos: function() {
|
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-02-06 09:32:02 +00:00
|
|
|
showDir: function(category, repo_id, path) {
|
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-01-31 05:17:47 +00:00
|
|
|
},
|
|
|
|
|
2015-01-25 10:47:42 +00:00
|
|
|
|
2015-01-20 10:25:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return MyHomeView;
|
|
|
|
});
|