mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 13:50:07 +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:
@@ -245,6 +245,7 @@ p { margin:0.5em 0; }
|
|||||||
.hide { display:none }
|
.hide { display:none }
|
||||||
.error { color:red; }
|
.error { color:red; }
|
||||||
.errorlist { color: red; }
|
.errorlist { color: red; }
|
||||||
|
.error-tip { text-align:center; margin-top:5em;}
|
||||||
.ovhd { overflow:hidden; }
|
.ovhd { overflow:hidden; }
|
||||||
.bold { font-weight:bold; }
|
.bold { font-weight:bold; }
|
||||||
.no-bold { font-weight:normal; }
|
.no-bold { font-weight:normal; }
|
||||||
|
@@ -104,6 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<img class="loading-tip" width="32" src="{{MEDIA_URL}}img/loading-new.gif" alt="{% trans 'Loading...' %}" />
|
<img class="loading-tip" width="32" src="{{MEDIA_URL}}img/loading-new.gif" alt="{% trans 'Loading...' %}" />
|
||||||
|
<p class="error error-tip hide"</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="starred-file" class="hide">
|
<div id="starred-file" class="hide">
|
||||||
@@ -177,6 +178,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<img class="loading-tip" width="32" src="{{MEDIA_URL}}img/loading-new.gif" alt="{% trans 'Loading...' %}" />
|
<img class="loading-tip" width="32" src="{{MEDIA_URL}}img/loading-new.gif" alt="{% trans 'Loading...' %}" />
|
||||||
|
<p class="error error-tip hide"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="organization-repos" class="tab-tabs hide">
|
<div id="organization-repos" class="tab-tabs hide">
|
||||||
@@ -189,11 +191,12 @@
|
|||||||
<thead></thead>
|
<thead></thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
<img class="loading-tip" width="32" src="{{MEDIA_URL}}img/loading-new.gif" alt="{% trans 'Loading...' %}" />
|
|
||||||
<div class="empty-tips hide">
|
<div class="empty-tips hide">
|
||||||
<h2 class="alc">{% trans "No public library" %}</h2>
|
<h2 class="alc">{% trans "No public library" %}</h2>
|
||||||
<p>{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}</p>
|
<p>{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<img class="loading-tip" width="32" src="{{MEDIA_URL}}img/loading-new.gif" alt="{% trans 'Loading...' %}" />
|
||||||
|
<p class="error error-tip hide"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% include "js/dir-view.html" %}
|
{% include "js/dir-view.html" %}
|
||||||
|
@@ -12,23 +12,23 @@ define([
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var GroupView = Backbone.View.extend({
|
var GroupView = Backbone.View.extend({
|
||||||
el: '#main',
|
el: '#group-repo-tabs',
|
||||||
|
|
||||||
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
|
reposHdTemplate: _.template($('#shared-repos-hd-tmpl').html()),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click #group-repo-tabs .repo-create': 'createRepo',
|
'click .repo-create': 'createRepo',
|
||||||
'click #grp-repos .by-name': 'sortByName',
|
'click #grp-repos .by-name': 'sortByName',
|
||||||
'click #grp-repos .by-time': 'sortByTime'
|
'click #grp-repos .by-time': 'sortByTime'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.$tabs = this.$('#group-repo-tabs');
|
this.$tabs = this.$el;
|
||||||
this.$table = this.$('#grp-repos table', this.$tabs);
|
this.$table = this.$('table');
|
||||||
this.$tableHead = $('thead', this.$table);
|
this.$tableHead = this.$('thead');
|
||||||
this.$tableBody = $('tbody', this.$table);
|
this.$tableBody = this.$('tbody');
|
||||||
this.$loadingTip = $('.loading-tip', this.$tabs);
|
this.$loadingTip = this.$('.loading-tip');
|
||||||
this.$emptyTip = $('.empty-tips', this.$tabs);
|
this.$emptyTip = this.$('.empty-tips');
|
||||||
|
|
||||||
this.sideNavView = new GroupSideNavView();
|
this.sideNavView = new GroupSideNavView();
|
||||||
|
|
||||||
@@ -57,12 +57,13 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.renderReposHd();
|
this.$('.error').hide();
|
||||||
this.$tableBody.empty();
|
|
||||||
this.repos.each(this.addOne, this);
|
|
||||||
this.$loadingTip.hide();
|
this.$loadingTip.hide();
|
||||||
if (this.repos.length) {
|
if (this.repos.length) {
|
||||||
this.$emptyTip.hide();
|
this.$emptyTip.hide();
|
||||||
|
this.renderReposHd();
|
||||||
|
this.$tableBody.empty();
|
||||||
|
this.repos.each(this.addOne, this);
|
||||||
this.$table.show();
|
this.$table.show();
|
||||||
} else {
|
} else {
|
||||||
this.$emptyTip.show();
|
this.$emptyTip.show();
|
||||||
@@ -87,9 +88,31 @@ define([
|
|||||||
this.$emptyTip.hide();
|
this.$emptyTip.hide();
|
||||||
this.$tabs.show();
|
this.$tabs.show();
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
|
var $loadingTip = this.$loadingTip;
|
||||||
|
$loadingTip.show();
|
||||||
|
var _this = this;
|
||||||
this.repos.setGroupID(group_id);
|
this.repos.setGroupID(group_id);
|
||||||
this.repos.fetch({reset: true, data: {from: 'web'}});
|
this.repos.fetch({
|
||||||
this.$loadingTip.show();
|
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() {
|
hideRepoList: function() {
|
||||||
|
@@ -48,30 +48,52 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.renderReposHd();
|
this.$('.error').hide();
|
||||||
this.$tableBody.empty();
|
this.$loadingTip.hide();
|
||||||
this.repos.each(this.addOne, this);
|
|
||||||
if (this.repos.length) {
|
if (this.repos.length) {
|
||||||
this.$emptyTip.hide();
|
this.$emptyTip.hide();
|
||||||
|
this.renderReposHd();
|
||||||
|
this.$tableBody.empty();
|
||||||
|
this.repos.each(this.addOne, this);
|
||||||
this.$table.show();
|
this.$table.show();
|
||||||
} else {
|
} else {
|
||||||
this.$emptyTip.show();
|
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
|
this.$emptyTip.show();
|
||||||
// Show guide popup when there is no owned repos and guide flag is true.
|
// Show guide popup when there is no owned repos and guide flag is true.
|
||||||
if (app.pageOptions.guide_enabled) {
|
if (app.pageOptions.guide_enabled) {
|
||||||
$('#guide-for-new').modal({appendTo: '#main', focus:false});
|
$('#guide-for-new').modal({appendTo: '#main', focus:false});
|
||||||
app.pageOptions.guide_enabled = false;
|
app.pageOptions.guide_enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$loadingTip.hide();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showMyRepos: function() {
|
showMyRepos: function() {
|
||||||
this.repos.fetch({reset: true});
|
|
||||||
this.$tabs.show();
|
this.$tabs.show();
|
||||||
|
$('#mylib-tab').parent().addClass('ui-state-active');
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
this.$loadingTip.show();
|
var $loadingTip = this.$loadingTip;
|
||||||
$('#mylib-tab', this.$tabs).parent().addClass('ui-state-active');
|
$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() {
|
show: function() {
|
||||||
|
@@ -40,25 +40,47 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.renderReposHd();
|
this.$('.error').hide();
|
||||||
this.$tableBody.empty();
|
this.$loadingTip.hide();
|
||||||
this.repos.each(this.addOne, this);
|
|
||||||
if (this.repos.length) {
|
if (this.repos.length) {
|
||||||
this.$emptyTip.hide();
|
this.$emptyTip.hide();
|
||||||
|
this.renderReposHd();
|
||||||
|
this.$tableBody.empty();
|
||||||
|
this.repos.each(this.addOne, this);
|
||||||
this.$table.show();
|
this.$table.show();
|
||||||
} else {
|
} else {
|
||||||
this.$emptyTip.show();
|
this.$emptyTip.show();
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
}
|
}
|
||||||
this.$loadingTip.hide();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showSharedRepos: function() {
|
showSharedRepos: function() {
|
||||||
this.repos.fetch({reset: true});
|
|
||||||
this.$tabs.show();
|
this.$tabs.show();
|
||||||
|
$('#shared-lib-tab').parent().addClass('ui-state-active');
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
this.$loadingTip.show();
|
var $loadingTip = this.$loadingTip;
|
||||||
$('#shared-lib-tab', this.$tabs).parent().addClass('ui-state-active');
|
$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() {
|
show: function() {
|
||||||
|
@@ -40,6 +40,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
|
this.$('.error').hide();
|
||||||
this.$tableBody.empty();
|
this.$tableBody.empty();
|
||||||
this.repos.each(this.addOne, this);
|
this.repos.each(this.addOne, this);
|
||||||
if (this.repos.length) {
|
if (this.repos.length) {
|
||||||
@@ -53,11 +54,32 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
showSubRepos: function() {
|
showSubRepos: function() {
|
||||||
this.repos.fetch({reset: true});
|
|
||||||
this.$tabs.show();
|
this.$tabs.show();
|
||||||
|
$('#sublib-tab').parent().addClass('ui-state-active');
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
this.$loadingTip.show();
|
var $loadingTip = this.$loadingTip;
|
||||||
$('#sublib-tab', this.$tabs).parent().addClass('ui-state-active');
|
$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() {
|
show: function() {
|
||||||
|
@@ -56,25 +56,47 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.renderReposHd();
|
this.$('.error').hide();
|
||||||
this.$tableBody.empty();
|
this.$loadingTip.hide();
|
||||||
this.repos.each(this.addOne, this);
|
|
||||||
if (this.repos.length) {
|
if (this.repos.length) {
|
||||||
this.$emptyTip.hide();
|
this.$emptyTip.hide();
|
||||||
|
this.renderReposHd();
|
||||||
|
this.$tableBody.empty();
|
||||||
|
this.repos.each(this.addOne, this);
|
||||||
this.$table.show();
|
this.$table.show();
|
||||||
} else {
|
} else {
|
||||||
this.$emptyTip.show();
|
|
||||||
this.$table.hide();
|
this.$table.hide();
|
||||||
|
this.$emptyTip.show();
|
||||||
}
|
}
|
||||||
this.$loadingTip.hide();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showRepoList: function() {
|
showRepoList: function() {
|
||||||
this.$sideNav.show();
|
this.$sideNav.show();
|
||||||
this.dirView.hide();
|
this.dirView.hide();
|
||||||
this.$reposDiv.show();
|
this.$reposDiv.show();
|
||||||
this.repos.fetch({reset: true});
|
var $loadingTip = this.$loadingTip;
|
||||||
this.$loadingTip.show();
|
$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() {
|
hideRepoList: function() {
|
||||||
|
Reference in New Issue
Block a user