Skip to content

Commit

Permalink
feature 1668: delete single user, better colors for admin dark theme.
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@25479 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Nov 13, 2013
1 parent 146ee8c commit 46fd7a4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 17 deletions.
5 changes: 4 additions & 1 deletion admin/themes/clear/theme.css
Expand Up @@ -357,4 +357,7 @@ table.dataTable tr.odd td.sorting_1 {

table.dataTable thead th {
border-color: #aaa !important;
}
}

.userPropertiesContainer {border-color:#ddd;}
.userPrefs {border-color:#ddd;}
49 changes: 35 additions & 14 deletions admin/themes/default/template/user_list.tpl
Expand Up @@ -112,10 +112,10 @@ jQuery(document).ready(function() {
var userDetails = '<form>';
userDetails += '<div class="userActions">';
userDetails += '<a class="icon-key" href="#">Change password</a>';
userDetails += '<br><a href="#" class="icon-lock">Permissions</a>';
userDetails += '<br><a href="#" class="icon-trash">Delete</a>';
userDetails += '<br><a target="_blank" href="admin.php?page=user_perm&amp;user_id='+userId+'" class="icon-lock">Permissions</a>';
userDetails += '<br><span class="userDelete"><img class="loading" src="themes/default/images/ajax-loader-small.gif" style="display:none;"><a href="#" class="icon-trash" data-user_id="'+userId+'">Delete</a></span>';
userDetails += '</div>';
userDetails += '<strong>'+user.username+'</strong> <span class="icon-pencil"></span>';
userDetails += '<strong class="username">'+user.username+'</strong> <span class="icon-pencil"></span>';
userDetails += '<br><br>';
userDetails += sprintf(registeredOn_pattern, user.registration_date_string, user.registration_date_since);
Expand Down Expand Up @@ -226,8 +226,8 @@ jQuery(document).ready(function() {
userDetails += '</div>';
userDetails += '<div style="clear:both"></div></div>';

userDetails += '<span class="infos" style="display:none">&#x2714; User updated</span>';
userDetails += '<input type="submit" value="{/literal}{'Save Settings'|translate}{literal}" style="display:none;" data-user_id="'+userId+'">';
userDetails += '<span class="infos" style="display:none">&#x2714; User '+user.username+' updated</span>';
userDetails += '<input type="submit" value="{/literal}{'Update user'|translate}{literal}" style="display:none;" data-user_id="'+userId+'">';
userDetails += '<img class="submitWait" src="themes/default/images/ajax-loader-small.gif" style="display:none">'
userDetails += '</form>';

Expand All @@ -253,6 +253,36 @@ jQuery(document).ready(function() {
jQuery('#user'+userId+' .infos').hide();
});

jQuery(document).on('click', '.userDelete a', function() {
if (!confirm("{/literal}{'Are you sure?'|translate|escape:javascript}{literal}")) {
return false;
}

var userId = jQuery(this).data('user_id');
var username = jQuery('#user'+userId+' .username').html();

jQuery.ajax({
url: "ws.php?format=json&method=pwg.users.delete",
type:"POST",
data: {
user_id:userId,
pwg_token:pwg_token
},
beforeSend: function() {
jQuery('#user'+userId+' .userDelete .loading').show();
},
success:function(data) {
oTable.fnDraw();
jQuery('#showAddUser .infos').html('&#x2714; User '+username+' deleted').show();
},
error:function(XMLHttpRequest, textStatus, errorThrows) {
jQuery('#user'+userId+' .userDelete .loading').hide();
}
});

return false;
});

jQuery(document).on('click', '.userProperties input[type=submit]', function() {
var userId = jQuery(this).data('user_id');
Expand Down Expand Up @@ -593,15 +623,6 @@ table.dataTable {clear:right;padding-top:10px;}
#addUserForm p {margin-left:0;}
#applyActionBlock .actionButtons {margin-left:0;}
span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border-radius:5px;}

.userProperties {max-width:730px;}
.userPropertiesContainer {border-top:1px solid #ddd;margin-top:1em;}
.userPropertiesSet {width:350px;float:left;padding-top:5px}
.userPropertiesSetTitle {font-weight:bold;margin-bottom:1em;}
.userPrefs {border-left:1px solid #ddd;padding-left:10px;}
.userProperty {width:220px;float:left;margin-bottom:15px;}

.userActions {float:right;text-align:right;}
</style>
{/literal}

Expand Down
11 changes: 10 additions & 1 deletion admin/themes/default/theme.css
Expand Up @@ -1144,4 +1144,13 @@ a.group_perm {
font-size:16px;
margin-left:-8px;
cursor:pointer;
}
}

.userProperties {max-width:730px;}
.userPropertiesContainer {border-top:1px solid #ddd;margin-top:1em;}
.userPropertiesSet {width:350px;float:left;padding-top:5px}
.userPropertiesSetTitle {font-weight:bold;margin-bottom:1em;}
.userPrefs {border-left:1px solid #ddd;padding-left:10px;}
.userProperty {width:220px;float:left;margin-bottom:15px;}
.userActions {float:right;text-align:right;}

5 changes: 4 additions & 1 deletion admin/themes/roma/theme.css
Expand Up @@ -333,4 +333,7 @@ table.dataTable tr.odd td.sorting_1 {

table.dataTable thead th {
border-color: #333 !important;
}
}

.userPropertiesContainer {border-color:#333;}
.userPrefs {border-color:#333;}

0 comments on commit 46fd7a4

Please sign in to comment.