diff options
author | raghunayyar <me@iraghu.com> | 2014-01-30 21:18:18 +0530 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-06-02 12:52:52 +0200 |
commit | 71160ff853a504ba084dc51f305970cd7b5cb597 (patch) | |
tree | 17d5b1acb45fe8bc2619cd1066c0eb9322e277b8 /settings | |
parent | ce46cd3680979019de59e48654771f3061076e7b (diff) | |
download | nextcloud-server-71160ff853a504ba084dc51f305970cd7b5cb597.tar.gz nextcloud-server-71160ff853a504ba084dc51f305970cd7b5cb597.zip |
Deletes Group Clientside Effectively.
Diffstat (limited to 'settings')
-rw-r--r-- | settings/css/settings.css | 6 | ||||
-rw-r--r-- | settings/js/users.js | 50 | ||||
-rw-r--r-- | settings/templates/users.php | 5 |
3 files changed, 59 insertions, 2 deletions
diff --git a/settings/css/settings.css b/settings/css/settings.css index 39290308cbe..ae986ccb9b4 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -51,7 +51,11 @@ table.nostyle label { margin-right: 2em; } table.nostyle td { padding: 0.2em 0; } /* USERS */ -.usercount { float: right; margin:6px;} +.usercount { float: left; margin: 5px; } +span.utils .delete { + float: left; position: relative; + margin: 3px; top: 4px; +} form { display:inline; } table.grid th { height:2em; color:#999; } table.grid th, table.grid td { border-bottom:1px solid #ddd; padding:0 .5em; padding-left:.8em; text-align:left; font-weight:normal; } diff --git a/settings/js/users.js b/settings/js/users.js index 7b06d961b1a..8107a98df0b 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -16,6 +16,48 @@ function setQuota (uid, quota, ready) { ); } +var GroupList = { + + delete_group: function (gid) { + if(GroupList.deleteGid !=='undefined') { + GroupList.finishDelete(null); + } + + //Set the undo flag + GroupList.deleteCanceled = false; + + //Provide an option to undo + $('#notification').data('deletegroup', true); + OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(gid) + '<span class="undo">' + t('settings', 'undo') + '</span>'); + }, + + finishDelete: function (ready) { + if (!GroupList.deleteCanceled && GroupList.deleteGid) { + $.ajax({ + type: 'POST', + url: OC.filePath('settings', 'ajax', 'removegroup.php'), + async: false, + data: { groupname: GroupList.deleteGid }, + success: function (result) { + if (result.status === 'success') { + // Remove undo option, & remove user from table + OC.Notification.hide(); + $('li').filterAttr('data-gid', GroupList.deleteGid).remove(); + GroupList.deleteCanceled = true; + if (ready) { + ready(); + } + } else { + OC.dialogs.alert(result.data.message, t('settings', 'Unable to remove group')); + } + } + }); + } + + }, + +} + var UserList = { useUndo: true, availableGroups: [], @@ -477,6 +519,14 @@ $(document).ready(function () { }); }); + $('ul').on('click', 'span.utils>a', function (event) { + var li = $(this).parent().parent(); + var gid = $(li).attr('data-gid'); + $(li).hide(); + // Call function for handling delete/undo on Groups + GroupList.delete_group(gid); + }); + $('#newuser').submit(function (event) { event.preventDefault(); var username = $('#newusername').val(); diff --git a/settings/templates/users.php b/settings/templates/users.php index 83ac79365b6..daf0ee49e4a 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -30,10 +30,13 @@ $_['subadmingroups'] = array_flip($items); </li> <!--List of Groups--> <?php foreach($_["groups"] as $group): ?> - <li> + <li data-gid="<?php p($group['name']) ?>"> <a href="#"><?php p($group['name']); ?></a> <span class="utils"> <span class="usercount"><?php p(count($group['useringroup'])); ?></span> + <a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>"> + <img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" class="svg" /> + </a> </span> </li> <?php endforeach; ?> |