mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-24 21:07:17 +00:00
enable 'show error' for 'fetch libs'
Conflicts: static/scripts/app/views/group.js static/scripts/app/views/myhome-repos.js static/scripts/app/views/myhome-shared-repos.js static/scripts/app/views/organization.js
This commit is contained in:
@@ -12,23 +12,23 @@ define([
|
||||
'use strict';
|
||||
|
||||
var GroupView = Backbone.View.extend({
|
||||
el: '#main',
|
||||
el: '#group-repo-tabs',
|
||||
|
||||
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'click #group-repo-tabs .repo-create': 'createRepo',
|
||||
'click .repo-create': 'createRepo',
|
||||
'click #grp-repos .by-name': 'sortByName',
|
||||
'click #grp-repos .by-time': 'sortByTime'
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
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.$tabs);
|
||||
this.$emptyTip = $('.empty-tips', this.$tabs);
|
||||
this.$tabs = this.$el;
|
||||
this.$table = this.$('table');
|
||||
this.$tableHead = this.$('thead');
|
||||
this.$tableBody = this.$('tbody');
|
||||
this.$loadingTip = this.$('.loading-tip');
|
||||
this.$emptyTip = this.$('.empty-tips');
|
||||
|
||||
this.sideNavView = new GroupSideNavView();
|
||||
|
||||
@@ -57,12 +57,13 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$('.error').hide();
|
||||
this.$loadingTip.hide();
|
||||
if (this.repos.length) {
|
||||
this.$emptyTip.hide();
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
} else {
|
||||
this.$emptyTip.show();
|
||||
@@ -87,9 +88,31 @@ define([
|
||||
this.$emptyTip.hide();
|
||||
this.$tabs.show();
|
||||
this.$table.hide();
|
||||
var $loadingTip = this.$loadingTip;
|
||||
$loadingTip.show();
|
||||
var _this = this;
|
||||
this.repos.setGroupID(group_id);
|
||||
this.repos.fetch({reset: true, data: {from: 'web'}});
|
||||
this.$loadingTip.show();
|
||||
this.repos.fetch({
|
||||
reset: true,
|
||||
data: {from: 'web'},
|
||||
success: function (collection, response, opts) {
|
||||
},
|
||||
error: function (collection, response, opts) {
|
||||
$loadingTip.hide();
|
||||
var $error = _this.$('.error');
|
||||
var err_msg;
|
||||
if (response.responseText) {
|
||||
if (response['status'] == 401 || response['status'] == 403) {
|
||||
err_msg = gettext("Permission error");
|
||||
} else {
|
||||
err_msg = gettext("Error");
|
||||
}
|
||||
} else {
|
||||
err_msg = gettext('Please check the network.');
|
||||
}
|
||||
$error.html(err_msg).show();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
hideRepoList: function() {
|
||||
|
@@ -48,30 +48,52 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$('.error').hide();
|
||||
this.$loadingTip.hide();
|
||||
if (this.repos.length) {
|
||||
this.$emptyTip.hide();
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
} else {
|
||||
this.$emptyTip.show();
|
||||
this.$table.hide();
|
||||
this.$emptyTip.show();
|
||||
// Show guide popup when there is no owned repos and guide flag is true.
|
||||
if (app.pageOptions.guide_enabled) {
|
||||
$('#guide-for-new').modal({appendTo: '#main', focus:false});
|
||||
app.pageOptions.guide_enabled = false;
|
||||
}
|
||||
}
|
||||
this.$loadingTip.hide();
|
||||
},
|
||||
|
||||
showMyRepos: function() {
|
||||
this.repos.fetch({reset: true});
|
||||
this.$tabs.show();
|
||||
$('#mylib-tab').parent().addClass('ui-state-active');
|
||||
this.$table.hide();
|
||||
this.$loadingTip.show();
|
||||
$('#mylib-tab', this.$tabs).parent().addClass('ui-state-active');
|
||||
var $loadingTip = this.$loadingTip;
|
||||
$loadingTip.show();
|
||||
var _this = this;
|
||||
this.repos.fetch({
|
||||
reset: true,
|
||||
success: function (collection, response, opts) {
|
||||
},
|
||||
error: function (collection, response, opts) {
|
||||
$loadingTip.hide();
|
||||
var $error = _this.$('.error');
|
||||
var err_msg;
|
||||
if (response.responseText) {
|
||||
if (response['status'] == 401 || response['status'] == 403) {
|
||||
err_msg = gettext("Permission error");
|
||||
} else {
|
||||
err_msg = gettext("Error");
|
||||
}
|
||||
} else {
|
||||
err_msg = gettext('Please check the network.');
|
||||
}
|
||||
$error.html(err_msg).show();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
@@ -40,25 +40,47 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$('.error').hide();
|
||||
this.$loadingTip.hide();
|
||||
if (this.repos.length) {
|
||||
this.$emptyTip.hide();
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
} else {
|
||||
this.$emptyTip.show();
|
||||
this.$table.hide();
|
||||
}
|
||||
this.$loadingTip.hide();
|
||||
},
|
||||
|
||||
showSharedRepos: function() {
|
||||
this.repos.fetch({reset: true});
|
||||
this.$tabs.show();
|
||||
$('#shared-lib-tab').parent().addClass('ui-state-active');
|
||||
this.$table.hide();
|
||||
this.$loadingTip.show();
|
||||
$('#shared-lib-tab', this.$tabs).parent().addClass('ui-state-active');
|
||||
var $loadingTip = this.$loadingTip;
|
||||
$loadingTip.show();
|
||||
var _this = this;
|
||||
this.repos.fetch({
|
||||
reset: true,
|
||||
success: function (collection, response, opts) {
|
||||
},
|
||||
error: function (collection, response, opts) {
|
||||
$loadingTip.hide();
|
||||
var $error = _this.$('.error');
|
||||
var err_msg;
|
||||
if (response.responseText) {
|
||||
if (response['status'] == 401 || response['status'] == 403) {
|
||||
err_msg = gettext("Permission error");
|
||||
} else {
|
||||
err_msg = gettext("Error");
|
||||
}
|
||||
} else {
|
||||
err_msg = gettext('Please check the network.');
|
||||
}
|
||||
$error.html(err_msg).show();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
@@ -40,6 +40,7 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
this.$('.error').hide();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
if (this.repos.length) {
|
||||
@@ -53,11 +54,32 @@ define([
|
||||
},
|
||||
|
||||
showSubRepos: function() {
|
||||
this.repos.fetch({reset: true});
|
||||
this.$tabs.show();
|
||||
$('#sublib-tab').parent().addClass('ui-state-active');
|
||||
this.$table.hide();
|
||||
this.$loadingTip.show();
|
||||
$('#sublib-tab', this.$tabs).parent().addClass('ui-state-active');
|
||||
var $loadingTip = this.$loadingTip;
|
||||
$loadingTip.show();
|
||||
var _this = this;
|
||||
this.repos.fetch({
|
||||
reset: true,
|
||||
success: function (collection, response, opts) {
|
||||
},
|
||||
error: function (collection, response, opts) {
|
||||
$loadingTip.hide();
|
||||
var $error = _this.$('.error');
|
||||
var err_msg;
|
||||
if (response.responseText) {
|
||||
if (response['status'] == 401 || response['status'] == 403) {
|
||||
err_msg = gettext("Permission error");
|
||||
} else {
|
||||
err_msg = gettext("Error");
|
||||
}
|
||||
} else {
|
||||
err_msg = gettext('Please check the network.');
|
||||
}
|
||||
$error.html(err_msg).show();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
|
@@ -56,25 +56,47 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$('.error').hide();
|
||||
this.$loadingTip.hide();
|
||||
if (this.repos.length) {
|
||||
this.$emptyTip.hide();
|
||||
this.renderReposHd();
|
||||
this.$tableBody.empty();
|
||||
this.repos.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
} else {
|
||||
this.$emptyTip.show();
|
||||
this.$table.hide();
|
||||
this.$emptyTip.show();
|
||||
}
|
||||
this.$loadingTip.hide();
|
||||
},
|
||||
|
||||
showRepoList: function() {
|
||||
this.$sideNav.show();
|
||||
this.dirView.hide();
|
||||
this.$reposDiv.show();
|
||||
this.repos.fetch({reset: true});
|
||||
this.$loadingTip.show();
|
||||
var $loadingTip = this.$loadingTip;
|
||||
$loadingTip.show();
|
||||
var _this = this;
|
||||
this.repos.fetch({
|
||||
reset: true,
|
||||
success: function (collection, response, opts) {
|
||||
},
|
||||
error: function (collection, response, opts) {
|
||||
$loadingTip.hide();
|
||||
var $error = _this.$('.error');
|
||||
var err_msg;
|
||||
if (response.responseText) {
|
||||
if (response['status'] == 401 || response['status'] == 403) {
|
||||
err_msg = gettext("Permission error");
|
||||
} else {
|
||||
err_msg = gettext("Error");
|
||||
}
|
||||
} else {
|
||||
err_msg = gettext('Please check the network.');
|
||||
}
|
||||
$error.html(err_msg).show();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
hideRepoList: function() {
|
||||
|
Reference in New Issue
Block a user