mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 15:19:06 +00:00
[backbone] Merge into one library app
This commit is contained in:
@@ -5,14 +5,13 @@ define([
|
||||
'common',
|
||||
'app/collections/group-repos',
|
||||
'app/collections/dirents',
|
||||
'app/views/group-repos',
|
||||
'app/views/group-repo',
|
||||
'app/views/add-group-repo',
|
||||
'app/views/group-recent-change',
|
||||
'app/views/dir',
|
||||
'app/views/group-nav',
|
||||
], function($, _, Backbone, Common, GroupRepos, DirentCollection,
|
||||
GroupRepoView, AddGroupRepoView/*, DirentView*/, GroupRecentChangeView,
|
||||
DirView, GroupNavView) {
|
||||
GroupRepoView, AddGroupRepoView, GroupRecentChangeView,
|
||||
DirView) {
|
||||
'use strict';
|
||||
|
||||
var GroupView = Backbone.View.extend({
|
||||
@@ -25,28 +24,19 @@ define([
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
Common.prepareApiCsrf();
|
||||
|
||||
this.$cont = this.$('#right-panel');
|
||||
|
||||
this.$tabs = this.$('#tabs');
|
||||
this.$tab = this.$('#tabs div:first-child');
|
||||
this.$table = this.$('#grp-repos table');
|
||||
this.$tabs = this.$('#group-repo-tabs');
|
||||
this.$table = this.$('#grp-repos table', this.$tabs);
|
||||
this.$tableHead = $('thead', this.$table);
|
||||
this.$tableBody = $('tbody', this.$table);
|
||||
this.$loadingTip = $('.loading-tip', this.$cont);
|
||||
this.$emptyTip = $('.empty-tips', this.$cont);
|
||||
|
||||
this.$loadingTip = $('.loading-tip', this.$tabs);
|
||||
this.$emptyTip = $('.empty-tips', this.$tabs);
|
||||
this.$createForm = this.$('#repo-create-form');
|
||||
|
||||
this.repos = new GroupRepos();
|
||||
this.listenTo(this.repos, 'add', this.addOne);
|
||||
this.listenTo(this.repos, 'reset', this.reset);
|
||||
|
||||
this.dirView = new DirView();
|
||||
|
||||
this.groupView = new GroupNavView();
|
||||
Common.initAccountPopup();
|
||||
Common.initNoticePopup();
|
||||
},
|
||||
|
||||
/*
|
||||
@@ -64,8 +54,7 @@ define([
|
||||
},
|
||||
|
||||
addOne: function(repo, collection, options) {
|
||||
console.log('add repo: ' + repo.get('name'));
|
||||
var view = new GroupRepoView({model: repo});
|
||||
var view = new GroupRepoView({model: repo, group_id: this.group_id});
|
||||
if (options.prepend) {
|
||||
this.$tableBody.prepend(view.render().el);
|
||||
} else {
|
||||
@@ -86,9 +75,11 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
showRepoList: function() {
|
||||
showRepoList: function(group_id) {
|
||||
this.group_id = group_id;
|
||||
this.dirView.hide();
|
||||
this.$tabs.show();
|
||||
this.repos.setGroupID(group_id);
|
||||
this.repos.fetch({reset: true});
|
||||
this.$loadingTip.show();
|
||||
},
|
||||
@@ -97,7 +88,8 @@ define([
|
||||
this.$tabs.hide();
|
||||
},
|
||||
|
||||
showDir: function(repo_id, path) {
|
||||
showDir: function(group_id, repo_id, path) {
|
||||
this.group_id = group_id;
|
||||
this.hideRepoList();
|
||||
this.dirView.showDir('', repo_id, path);
|
||||
},
|
||||
@@ -146,6 +138,11 @@ define([
|
||||
this.$tableBody.empty();
|
||||
repos.each(this.addOne, this);
|
||||
el.toggleClass('icon-caret-up icon-caret-down');
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.hideRepoList();
|
||||
this.dirView.hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user