mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
[system admin] groups: bugfix & improvement
This commit is contained in:
@@ -15,7 +15,7 @@ define([
|
||||
parseRecords: function(data) {
|
||||
return data.groups;
|
||||
},
|
||||
url: function () {
|
||||
url: function() {
|
||||
return Common.getUrl({name: 'admin-groups'});
|
||||
}
|
||||
});
|
||||
|
@@ -4,10 +4,8 @@ define([
|
||||
'backbone',
|
||||
'common',
|
||||
'moment',
|
||||
'simplemodal',
|
||||
'select2',
|
||||
'app/views/widgets/hl-item-view'
|
||||
], function($, _, Backbone, Common, Moment, Simplemodal, Select2, HLItemView) {
|
||||
], function($, _, Backbone, Common, Moment, HLItemView) {
|
||||
'use strict';
|
||||
|
||||
var GroupView = HLItemView.extend({
|
||||
@@ -43,7 +41,7 @@ define([
|
||||
dataType: 'json',
|
||||
success: function() {
|
||||
_this.$el.remove();
|
||||
Common.feedback(gettext("Successfully deleted."), 'success');
|
||||
Common.feedback(gettext("Successfully deleted 1 item."), 'success');
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
Common.ajaxErrorHandler(xhr, textStatus, errorThrown);
|
||||
@@ -60,6 +58,8 @@ define([
|
||||
transferGroup: function() {
|
||||
var _this = this;
|
||||
var group_name = this.model.get('name');
|
||||
var group_id = this.model.get('id');
|
||||
var cur_owner = this.model.get('owner');
|
||||
var $form = $(this.transferTemplate({
|
||||
title: gettext("Transfer Group {group_name} To").replace('{group_name}',
|
||||
'<span class="op-target ellipsis ellipsis-op-target" title="' + Common.HTMLescape(group_name) + '">' + Common.HTMLescape(group_name) + '</span>')
|
||||
@@ -77,25 +77,24 @@ define([
|
||||
|
||||
$form.submit(function() {
|
||||
var email = $.trim($('[name="email"]', $(this)).val());
|
||||
var $submitBtn = $('[type="submit"]', $(this));
|
||||
|
||||
if (!email) {
|
||||
return false;
|
||||
}
|
||||
if (email == _this.model.get('owner')) {
|
||||
if (email == cur_owner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var url = Common.getUrl({'name': 'admin-group','group_id': _this.model.get('id')});
|
||||
var $submitBtn = $('[type="submit"]', $(this));
|
||||
Common.disableButton($submitBtn);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
url: Common.getUrl({'name': 'admin-group', 'group_id': group_id}),
|
||||
type: 'put',
|
||||
dataType: 'json',
|
||||
beforeSend: Common.prepareCSRFToken,
|
||||
data: {
|
||||
'new_owner': email,
|
||||
'old_owner': _this.model.get('owner')
|
||||
'old_owner': cur_owner
|
||||
},
|
||||
success: function() {
|
||||
$.modal.close();
|
||||
|
@@ -24,31 +24,30 @@ define([
|
||||
render: function() {
|
||||
this.$el.append(this.template());
|
||||
|
||||
this.$exportExcel = this.$('.js-export-excel');
|
||||
this.$table = this.$('table');
|
||||
this.$tableBody = $('tbody', this.$table);
|
||||
this.$loadingTip = this.$('.loading-tip');
|
||||
this.$emptyTip = this.$('.empty-tips');
|
||||
this.$jsPrevious = this.$('.js-previous');
|
||||
this.$jsNext = this.$('.js-next');
|
||||
this.$error = this.$('.error');
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .js-export-excel': 'exportExcel',
|
||||
'click #paginator .js-next': 'getNextPage',
|
||||
'click #paginator .js-previous': 'getPreviousPage'
|
||||
},
|
||||
|
||||
exportExcel: function() {
|
||||
location.href = app.config.siteRoot + "sys/groupadmin/export-excel/";
|
||||
},
|
||||
|
||||
initPage: function() {
|
||||
this.$loadingTip.show();
|
||||
this.$exportExcel.hide();
|
||||
this.$table.hide();
|
||||
this.$tableBody.empty();
|
||||
this.$loadingTip.show();
|
||||
this.$emptyTip.hide();
|
||||
this.$jsNext.hide();
|
||||
this.$jsPrevious.hide();
|
||||
this.$emptyTip.hide();
|
||||
this.$error.hide();
|
||||
},
|
||||
|
||||
getNextPage: function() {
|
||||
@@ -106,7 +105,7 @@ define([
|
||||
} else {
|
||||
err_msg = gettext("Failed. Please check the network.");
|
||||
}
|
||||
Common.feedback(err_msg, 'error');
|
||||
_this.$error.html(err_msg).show();
|
||||
},
|
||||
complete:function() {
|
||||
_this.$loadingTip.hide();
|
||||
@@ -121,6 +120,7 @@ define([
|
||||
|
||||
this.$loadingTip.hide();
|
||||
if (this.groupCollection.length > 0) {
|
||||
this.$exportExcel.show();
|
||||
this.groupCollection.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
this.renderPaginator();
|
||||
|
Reference in New Issue
Block a user