mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
[system admin] groups: bugfix & improvement
This commit is contained in:
@@ -507,36 +507,37 @@
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="groups-tmpl">
|
||||
<div class="hd">
|
||||
<div class="hd ovhd">
|
||||
<h3 class="fleft">{% trans "Groups" %}</h3>
|
||||
<button class="js-export-excel fright">{% trans "Export Excel" %}</button>
|
||||
<a class="sf-btn-link btn-white js-export-excel fright hide" href="{% url "sys_group_admin_export_excel" %}">{% trans "Export Excel" %}</a>
|
||||
</div>
|
||||
<span class="loading-icon loading-tip"></span>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="30%">{% trans "Name" %}</th>
|
||||
<th width="30%">{% trans "Creator" %}</th>
|
||||
<th width="25%">{% trans "Create At" %}</th>
|
||||
<th width="15%">{% trans "Operations" %}</th>
|
||||
<th width="35%">{% trans "Name" %}</th>
|
||||
<th width="30%">{% trans "Owner" %}</th>
|
||||
<th width="25%">{% trans "Created At" %}</th>
|
||||
<th width="10%"><!--Operations--></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<span class="loading-icon loading-tip"></span>
|
||||
<div class="empty-tips hide">
|
||||
<h2 class="alc">{% trans "No groups" %}</h2>
|
||||
</div>
|
||||
<div id="paginator">
|
||||
<a class="prev js-previous hide" href="#">{% trans "Previous" %}</a>
|
||||
<a class="next js-next hide" href="#">{% trans "Next" %}</a>
|
||||
</div>
|
||||
<div class="empty-tips hide">
|
||||
<h2 class="alc">{% trans "No groups" %}</h2>
|
||||
</div>
|
||||
<p class="error error-tip hide"></p>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="group-item-tmpl">
|
||||
<td><a href="/sys/groupadmin/<%- id %>/"><%- name %></a></td>
|
||||
<td><a href="{{ SITE_ROOT }}sys/groupadmin/<%= id %>/"><%- name %></a></td>
|
||||
<td><a href="{{ SITE_ROOT }}useradmin/info/<% print(encodeURIComponent(owner)); %>/"><%- owner %></a></td>
|
||||
<td><time title='<%- time %>'><%- time_from_now %></time></td>
|
||||
<td><time title="<%= time %>"><%= time_from_now %></time></td>
|
||||
<td>
|
||||
<a href="#" class="sf2-icon-delete sf2-x group-delete-btn op-icon vh" title="{% trans "Delete" %}" aria-label="{% trans "Delete" %}"></a>
|
||||
<a href="#" class="sf2-icon-move sf2-x group-transfer-btn op-icon vh" title="{% trans "Transfer" %}" aria-label="{% trans "Transfer" %}"></a>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
{% block right_panel %}
|
||||
|
||||
<p class="path-bar">
|
||||
<a class="normal" href="{{ SITE_ROOT }}sys/groupadmin/">Groups</a>
|
||||
<a class="normal" href="{{ SITE_ROOT }}sysadmin/#groups/">Groups</a>
|
||||
<span class="path-split">/</span>
|
||||
{{ group.group_name }}
|
||||
</p>
|
||||
|
@@ -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