fix #500 Ne voir que les user deja dans la liste dans Edit du LIst Manager

This commit is contained in:
Nicolas Le Goff
2012-03-05 20:10:42 +01:00
parent 80b599e3ea
commit 5173bb7df1
4 changed files with 36 additions and 22 deletions

View File

@@ -764,17 +764,6 @@ class Push implements ControllerProviderInterface
$query->havePositions($request->get('Position'));
}
if($request->get('ListUser'))
{
$entries = $list->getEntries();
$ids = array();
foreach($entries as $usrEntries)
{
$ids[] = $usrEntries->getUsrId();
}
$query->in($ids);
}
$sort = $request->get('srt', 'usr_creationdate');
$ord = $request->get('ord', 'desc');

View File

@@ -176,14 +176,20 @@
{% endmacro %}
{% macro badgeReadonly(entry) %}
{% macro badgeReadonly(entry, role) %}
<div class="badge">
<input type="hidden" value="{{ entry.getUser().get_id() }}" name="id">
{% if role >= constant('\\Entities\\UsrListOwner::ROLE_EDITOR') %}
<a class="deleter" href="#">
<img src="/skins/prod/Push/close_badge.png">
</a>
{% endif %}
<table>
<tr>
<td class="icon">
<td>
<img src="/skins/icons/user.png"/>
</td>
<td class="infos">
<td class="infos" >
<span class="name">{{ entry.getUser().get_display_name() }}</span>
<span class="subtite"></span>
</td>

View File

@@ -50,8 +50,9 @@
</p>
</div>
<div class="PNB" style="top:35px;overflow:auto;">
{% set role = list.getOwner(user).getRole() %}
{% for entry in list.getEntries() %}
{{ ListsMacros.badgeReadonly(entry) }}
{{ ListsMacros.badgeReadonly(entry, role) }}
{% endfor %}
</div>
</div>
@@ -89,13 +90,7 @@
{% trans 'boutton::chercher' %}
</button>
</div>
<div class="PNB" style="top:40px;height:20px;bottom:auto;">
<ul>
<li style="display:inline-block;"><span>{%trans%}all users{%endtrans%}</span><input type="radio" name="ListUser" value="0" checked="checked"/></li>
<li style="display:inline-block;"><span>{%trans%}users from list{%endtrans%}</span><input type="radio" name="ListUser" value="1" /></li>
</ul>
</div>
<div class="PNB" style="top:60px;height:120px;bottom:auto;">
<div class="PNB" style="top:40px;height:120px;bottom:auto;">
<table style="table-layout:fixed;width:100%;">
<tr>
<td>
@@ -178,5 +173,12 @@
<script type="text/javascript">
$(document).ready(function(){
p4.ListManager.workOn({{ list.getId() }});
$("#ListManager .readonly .badge .deleter").click(function(){
var badge = $(this).closest(".badge");
var usr_id = badge.find('input[name="id"]').val();
p4.ListManager.getList().removeUser(usr_id, function(list, data){
badge.remove();
});
});
});
</script>

View File

@@ -213,7 +213,24 @@
width:250px;
display:inline-block;
margin:5px;
background-color: #515150;
padding:5px;
}
#ListManager .content.readonly .badge .deleter{
float:right;
}
#ListManager .content.readonly .badge table{
width:auto;
table-layout: fixed;
}
#ListManager .content.readonly .badge .infos{
padding:2px;
}
#ListManager h1 span.title{
font-size:24px;
line-height:24px;