|
@@ -87,12 +87,14 @@ function hackpoint_sketch_search(callback){
|
|
|
|
|
|
//Ajout ou modification d'élément sketch
|
|
|
function hackpoint_sketch_save(){
|
|
|
- var data = $('#sketch-form').toJson();
|
|
|
- $.action(data,function(r){
|
|
|
-
|
|
|
-
|
|
|
- $.message('success','Enregistré');
|
|
|
- });
|
|
|
+ var data = {
|
|
|
+ action : 'hackpoint_sketch_save',
|
|
|
+ id : $('#sketch-form').attr('data-id'),
|
|
|
+ label : $('#label').val(),
|
|
|
+ state : $('#state').prop('checked'),
|
|
|
+ comment : $('#comment').val()
|
|
|
+ }
|
|
|
+ $.action(data);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -115,14 +117,15 @@ function hackpoint_sketch_delete(element){
|
|
|
function hackpoint_resource_search(callback,triggered){
|
|
|
$('#resources').fill({
|
|
|
action:'hackpoint_resource_search',
|
|
|
- sketch : $('#sketch-form').attr('data-id')
|
|
|
+ sketch : $('#sketch-form').attr('data-id'),
|
|
|
+ showItems : false
|
|
|
},function(){
|
|
|
|
|
|
-
|
|
|
- var trigger = triggered ? triggered: '#resources li:visible(:eq(0))';
|
|
|
- $(trigger).trigger('click');
|
|
|
|
|
|
+
|
|
|
+ //rend les menu sortables
|
|
|
$( "#resources" ).sortable({
|
|
|
+ axis: "y",
|
|
|
update: function( event, ui ){
|
|
|
var sort = [];
|
|
|
$( "#resources li:visible" ).each(function(i,li){
|
|
@@ -139,6 +142,24 @@ function hackpoint_resource_search(callback,triggered){
|
|
|
});
|
|
|
$( "#resources" ).disableSelection();
|
|
|
|
|
|
+ //affiche les menu de façon progressive
|
|
|
+ $('#resources li:not(:eq(0))').removeClass('hidden')
|
|
|
+ .css('transform','translateX(-120px)');
|
|
|
+ $('#resources li:visible').each(function(i,element){
|
|
|
+ setTimeout(function(){
|
|
|
+ $(element)
|
|
|
+ .css('transform','translateX(0px)');
|
|
|
+ },150*i);
|
|
|
+ });
|
|
|
+
|
|
|
+ var trigger = '#resources li:eq(1)';
|
|
|
+ if(triggered){
|
|
|
+ trigger = triggered;
|
|
|
+ }else if($.urlParam('resource')){
|
|
|
+ trigger = '#resources li[data-id="'+$.urlParam('resource')+'"]';
|
|
|
+ }
|
|
|
+
|
|
|
+ $(trigger).trigger('click');
|
|
|
|
|
|
if(callback!=null) callback();
|
|
|
});
|
|
@@ -154,6 +175,9 @@ function hackpoint_resource_edit(element){
|
|
|
id : id
|
|
|
},function(r){
|
|
|
$('#sketch-editor').html(r.html).attr('data-id',id);
|
|
|
+
|
|
|
+ window.history.replaceState(null, null, "index.php?module=hackpoint&page=sheet.sketch&id="+$('#sketch-form').attr('data-id')+"&resource="+id);
|
|
|
+
|
|
|
init_components('#sketch-editor');
|
|
|
if(r.javascript){
|
|
|
eval(r.javascript);
|
|
@@ -170,12 +194,12 @@ function resource_add_document(files){
|
|
|
}, function(r){
|
|
|
|
|
|
$.each(r.files, function(i, file){
|
|
|
- var line = $('li[data-path="'+file.oldPath+'"]', form);
|
|
|
+ var line = $('#sketch-editor li[data-path="'+file.oldPath+'"]');
|
|
|
line.attr('data-path', file.relative);
|
|
|
line.find('a').attr('href', file.url);
|
|
|
line.find('i.pointer').attr('onclick', 'resource_delete_document(this)');
|
|
|
|
|
|
- $('[data-type="dropzone"] input:not(:visible)', form).val('');
|
|
|
+ $('#sketch-editor [data-type="dropzone"] input:not(:visible)').val('');
|
|
|
|
|
|
});
|
|
|
|