1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

Restructure views

Conflicts:
	seahub/templates/libraries.html
	static/scripts/app/router.js
	static/scripts/app/views/group.js
	static/scripts/app/views/organization.js
This commit is contained in:
Daniel Pan
2016-03-24 14:43:20 +08:00
parent dd906d7f68
commit 45a7ba13e7
16 changed files with 460 additions and 483 deletions

View File

@@ -13,29 +13,41 @@ define([
'use strict';
var OrganizationView = Backbone.View.extend({
el: '#organization-repos',
id: 'organization-repos-tmpl',
template: _.template($('#organization-repos-tmpl').html()),
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
initialize: function(options) {
this.repos = new PubRepoCollection();
this.listenTo(this.repos, 'add', this.addOne);
this.listenTo(this.repos, 'reset', this.reset);
this.render();
},
render: function() {
this.$el.html(this.template());
this.$table = this.$('table');
this.$tableHead = $('thead', this.$table);
this.$tableBody = $('tbody', this.$table);
this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = this.$('.empty-tips');
this.repos = new PubRepoCollection();
this.listenTo(this.repos, 'add', this.addOne);
this.listenTo(this.repos, 'reset', this.reset);
this.dirView = options.dirView;
this.dropdown = new DropdownView({
el: this.$('.js-add-pub-lib-dropdown'),
right: '0px'
});
},
show: function() {
$("#right-panel").html(this.$el);
this.showRepoList();
},
hide: function() {
this.$el.detach();
},
events: {
'click .share-existing': 'addRepo',
'click .create-new': 'createRepo',
@@ -84,8 +96,6 @@ define([
},
showRepoList: function() {
this.dirView.hide();
this.$el.show();
var $loadingTip = this.$loadingTip;
$loadingTip.show();
var _this = this;
@@ -112,16 +122,6 @@ define([
});
},
hideRepoList: function() {
this.$el.hide();
},
showDir: function(repo_id, path) {
var path = path || '/';
this.hideRepoList();
this.dirView.showDir('org', repo_id, path);
},
sortByName: function() {
$('.by-time .sort-icon', this.$table).hide();
var repos = this.repos;
@@ -157,12 +157,6 @@ define([
repos.each(this.addOne, this);
el.toggleClass('icon-caret-up icon-caret-down').show();
repos.comparator = null;
},
hide: function() {
this.hideRepoList();
this.$emptyTip.hide();
this.dirView.hide();
}
});