1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-03 02:06:45 +00:00
seahub/media/scripts/app/views/myhome.js

79 lines
2.1 KiB
JavaScript
Raw Normal View History

define([
'jquery',
'underscore',
'backbone',
2015-01-31 05:17:47 +00:00
'common',
'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',
'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) {
'use strict';
var MyHomeView = Backbone.View.extend({
el: '#main',
initialize: function() {
console.log('init MyHomePage');
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-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();
this.groupView = new GroupNavView();
},
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-31 05:17:47 +00:00
showLoading: function() {
this.$cont.find('.loading').show();
},
2015-02-04 13:57:26 +00:00
showMyRepos: function() {
console.log('show repo list');
2015-02-04 13:57:26 +00:00
this.sharedReposView.hide();
2015-02-01 06:15:00 +00:00
this.reposView.show();
2015-01-25 10:47:42 +00:00
this.dirView.hide();
},
2015-02-04 13:57:26 +00:00
showSharedRepos: function() {
this.dirView.hide();
this.reposView.hide();
this.sharedReposView.show();
},
2015-01-25 10:47:42 +00:00
showDir: function(repo_id, path) {
console.log('show dir ' + repo_id + ' ' + path);
var path = path || '/';
2015-02-01 06:15:00 +00:00
this.reposView.hide();
2015-01-25 10:47:42 +00:00
this.dirView.showDir(repo_id, path);
// this.dirent_list = new app.DirentListView({id: id, path: path});
// $('#my-own-repos table').children().remove();
// $('#my-own-repos table').append(this.dirent_list.render().el);
2015-01-31 05:17:47 +00:00
},
2015-01-25 10:47:42 +00:00
});
return MyHomeView;
});