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