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

[sysadmin] groups: modification

This commit is contained in:
llj
2016-12-22 19:15:21 +08:00
parent d6e216dda5
commit 1785171a14
4 changed files with 18 additions and 9 deletions

View File

@@ -3291,9 +3291,6 @@ button.sf-dropdown-toggle:focus {
vertical-align: middle;
}
/* sysadmin */
#admin-groups .btn-white {
margin-left:3px;
}
#import-members-btn .icon-upload-alt {
color:#777;
margin-right:3px;

View File

@@ -519,8 +519,10 @@
<script type="text/template" id="groups-tmpl">
<div class="hd ovhd">
<h3 class="fleft">{% trans "Groups" %}</h3>
<a class="sf-btn-link btn-white js-export-excel fright" href="{% url "sys_group_admin_export_excel" %}">{% trans "Export Excel" %}</a>
<a class="sf-btn-link btn-white js-add-group fright" href="#">{% trans "New Group" %}</a>
<div class="fright">
<button class="btn-white js-add-group">{% trans "New Group" %}</button>
<button class="btn-white js-export-excel">{% trans "Export Excel" %}</button>
</div>
</div>
<span class="loading-icon loading-tip"></span>
<table>
@@ -543,14 +545,16 @@
<h2 class="alc">{% trans "No groups" %}</h2>
</div>
<p class="error error-tip hide"></p>
</script>
<script type="text/template" id="group-add-form-tmpl">
<form id="group-add-form" action="" method="post" class="hide">{% csrf_token %}
<h3 id="dialogTitle">{% trans "New Group" %}</h3>
<label for="group-name">{% trans "Name" %}</label><br />
<input type="text" name="group_name" value="" class="input" id="group-name" /><br />
<label for="group-owner">{% trans "Owner" %}</label>
<span class="tip">{% trans "(If left blank, owner will be admin)" %}</span><br />
<input type="hidden" name="group_owner" value="" class="input" id="group-owner" /><br />
<input type="hidden" name="group_owner" value="" id="group-owner" />
<p class="error hide"></p>
<input type="submit" class="submit" value="{% trans "Submit" %}" />
</form>

View File

@@ -183,6 +183,7 @@ define([
case 'admin-trash-libraries': return siteRoot + 'api/v2.1/admin/trash-libraries/';
case 'admin-trash-library': return siteRoot + 'api/v2.1/admin/trash-libraries/' + options.repo_id + '/';
case 'admin_shares': return siteRoot + 'api/v2.1/admin/shares/';
case 'sys_group_admin_export_excel': return siteRoot + 'sys/groupadmin/export-excel/';
}
},

View File

@@ -13,6 +13,7 @@ define([
id: 'admin-groups',
template: _.template($("#groups-tmpl").html()),
groupAddFormtemplate: _.template($("#group-add-form-tmpl").html()),
initialize: function() {
this.groupCollection = new GroupCollection();
@@ -36,6 +37,7 @@ define([
events: {
'click .js-add-group': 'addGroup',
'click .js-export-excel': 'exportExcel',
'click #paginator .js-next': 'getNextPage',
'click #paginator .js-previous': 'getPreviousPage'
},
@@ -51,7 +53,7 @@ define([
},
addGroup: function () {
var $form = $('#group-add-form'),
var $form = $(this.groupAddFormtemplate()),
groups = this.groupCollection,
_this = this;
@@ -60,7 +62,8 @@ define([
$('[name="group_owner"]', $form).select2($.extend(
Common.contactInputOptionsForSelect2(), {
width: '270px',
width: '268px',
containerCss: {'margin-bottom': '5px'},
maximumSelectionSize: 1,
placeholder: gettext("Search user or enter email and press Enter"), // to override 'placeholder' returned by `Common.conta...`
formatSelectionTooBig: gettext("You cannot select any more choices")
@@ -73,7 +76,7 @@ define([
var $submitBtn = $('[type="submit"]', $form);
if (!group_name) {
$error.html(gettext("It is required.")).show();
$error.html(gettext("Name is required.")).show();
return false;
}
@@ -105,6 +108,10 @@ define([
return false;
},
exportExcel: function() {
location.href = Common.getUrl({'name': 'sys_group_admin_export_excel'});
},
getNextPage: function() {
this.initPage();
var current_page = this.groupCollection.state.current_page;