Oubli instantiation evenement

This commit is contained in:
Michael RICOIS 2012-05-15 14:51:28 +00:00
parent fab41ebdf0
commit 9667819051

View File

@ -9,7 +9,7 @@ div#entete {
}
div#entete li {
background-color:#4D90FE;
background-color:#4D90FE;
border-top:2px solid #ffffff;
border-bottom:2px solid #ffffff;
line-height:20px;
@ -31,7 +31,7 @@ div#dico {
div#dico li {
list-style-type:none;
padding:5px 10px;
background-color:#4D90FE;
background-color:#4D90FE;
border-top:2px solid #ffffff;
border-bottom:2px solid #ffffff;
line-height:20px;
@ -48,23 +48,23 @@ input[type="text"] {
<h1 class="ui-widget-header">Entete</h1>
<div class="ui-widget-content">
<ol>
<?php if (count($this->criteres)==0) {?>
<span class="placeholder">Placer les elements ici</span>
<?php } else {?>
<?php if (count($this->criteres)==0) {?>
<span class="placeholder">Placer les elements ici</span>
<?php } else {?>
<?php foreach($this->criteres as $key => $element) {?>
<li id="<?=$key?>">
<?php if (isset($element['lib'])) { echo $element['lib']; } else { echo $key; }?>
<?php if (isset($element['values']) && $element['values']!==false ) {
<?php if (isset($element['values']) && $element['values']!==false ) {
echo "<input type=\"text\" name=\"".$key."\" value=\"".$element['values']."\"/>"; }?>
</li>
<?php }?>
<?php }?>
<?php }?>
</ol>
</div>
</div>
</div>
<div id="dico">
<h1 class="ui-widget-header">Elements disponibles</h1>
<h1 class="ui-widget-header">Elements disponibles</h1>
<ul>
<?php foreach($this->elements as $key => $element) {?>
<li id="<?=$key?>">
@ -97,7 +97,7 @@ $(function() {
accept: ":not(.ui-sortable-helper)",
drop: function( e, ui ) {
e.preventDefault();
$( this ).find( ".placeholder" ).remove();
$( this ).find( ".placeholder" ).remove();
var id = ui.draggable.attr('id');
$('<li id="'+id+'"></li>').html( ui.draggable.html() ).appendTo( this );
}
@ -108,29 +108,29 @@ $(function() {
}
});
$("#entete").delegate("a.delete","click", function(){
$("#entete").delegate("a.delete","click", function(e){
e.preventDefault();
$(this).parent().remove();
});
$("#entete ol").delegate("li" , "hover", function(e) {
e.preventDefault();
if (e.type === 'mouseenter') {
var html = $(this).html();
var html = $(this).html();
$(this).html(html+'<a href="#" style="float:right;" class="delete">Supprimer</a>');
} else {
$( this ).find( ".delete" ).remove();
$( this ).find( ".delete" ).remove();
}
});
$('#save').click(function(e){
e.preventDefault();
var url = $(this).attr('href');
var list = new Array();
$('#entete ol li').each(function(index){
$('#entete ol li').each(function(index){
var id = $(this).attr('id');
if($('input[name='+id+']', this).length>0){
id = id + '(' + $('input[name='+id+']', this).val() + ')';
id = id + '(' + $('input[name='+id+']', this).val() + ')';
}
list.push(id);
});
@ -139,8 +139,8 @@ $(function() {
$.post(url, { reference: ref, criteres: list }, function(data){
if (data!='Erreur'){ window.location.href = '/'; }
}, 'json');
}
}
});
});
</script>