[fix] Adapt result processing from user_list to it new behaviour

This commit is contained in:
Jérôme Lebleu 2015-03-25 11:39:29 +01:00
parent 914256946f
commit db77ebf401
2 changed files with 14 additions and 16 deletions

View file

@ -1064,9 +1064,9 @@ app = Sammy('#main', function (sam) {
// Display a list of available users // Display a list of available users
if (v.name == 'admin' || data.manifest.arguments.install[k].type == 'user') { if (v.name == 'admin' || data.manifest.arguments.install[k].type == 'user') {
data.manifest.arguments.install[k].choices = []; data.manifest.arguments.install[k].choices = [];
$.each(params.users, function(key, user){ $.each(params.users, function(username, user){
data.manifest.arguments.install[k].choices.push({ data.manifest.arguments.install[k].choices.push({
value: user.username, value: username,
label: user.fullname+' ('+user.mail+')', label: user.fullname+' ('+user.mail+')',
selected: false selected: false
}); });
@ -1239,17 +1239,17 @@ app = Sammy('#main', function (sam) {
// Available users // Available users
data.users = []; data.users = [];
$.each(dataUsers.users, function(key, user){ $.each(dataUsers.users, function(username, user){
// Do not list allowed_users in select list // Do not list allowed_users in select list
if ( data.settings.allowed_users.indexOf(user.username) === -1 ) { if ( data.settings.allowed_users.indexOf(username) === -1 ) {
data.users.push({ data.users.push({
value: user.username, value: username,
label: user.fullname+' ('+user.mail+')' label: user.fullname+' ('+user.mail+')'
}); });
} else { } else {
// Complete allowed_users data // Complete allowed_users data
data.settings.allowed_users[data.settings.allowed_users.indexOf(user.username)] = { data.settings.allowed_users[data.settings.allowed_users.indexOf(username)] = {
username: user.username, username: username,
fullname: user.fullname, fullname: user.fullname,
mail: user.mail, mail: user.mail,
} }

View file

@ -12,20 +12,18 @@
<div class="separator"></div> <div class="separator"></div>
<div class="list-group"> <div class="list-group">
{{#users}} {{#each users}}
<a href="#/users/{{username}}" class="list-group-item slide clearfix"> <a href="#/users/{{@key}}" class="list-group-item slide clearfix">
<span class="pull-right fa-chevron-right"></span> <span class="pull-right fa-chevron-right"></span>
<h2 class="list-group-item-heading">{{username}} <small>{{fullname}}</small></h2> <h2 class="list-group-item-heading">{{@key}} <small>{{fullname}}</small></h2>
<p class="list-group-item-text">{{mail}}</p> <p class="list-group-item-text">{{mail}}</p>
<p class="list-group-item-text">{{mailbox-quota}}</p> <p class="list-group-item-text">{{mailbox-quota}}</p>
</a> </a>
{{/users}} {{else}}
{{^users}}
<div class="alert alert-warning"> <div class="alert alert-warning">
<span class="fa-exclamation-triangle"></span> <span class="fa-exclamation-triangle"></span>
{{t 'users_no'}} {{t 'users_no'}}
</div> </div>
{{/users}} {{/each}}
</div> </div>