idleman 5 роки тому
батько
коміт
56c8e70722

+ 3 - 1
plugin/hackpoint/action.php

@@ -191,6 +191,8 @@ switch($_['action']){
 			
 			$item->save();
 			$response = $item->toArray();
+
+			$response['type'] = $item->type();
 		});
 	break;
 	
@@ -353,7 +355,7 @@ switch($_['action']){
 			$item->part = $part->id;
 			$item->resource = $_['resource'];
 			$item->save();
-
+			$response = $item->toArray();
 		});
 	break;
 	

+ 4 - 1
plugin/hackpoint/css/main.css

@@ -86,7 +86,9 @@
 #resources-toolbar,#sketch-workspace{
 	height: 100%;
 }
-
+#sketch-workspace{
+	height: 90%;
+}
 #sketch-workspace .form-control-plaintext{
     color: #8e8e8e;
 }
@@ -177,6 +179,7 @@
 #resources-toolbar ul li h3{
 	text-transform: uppercase;
 	font-size: 11px;
+	word-break: break-word;
 	font-weight: bold;
 	margin:5px 0;
 	padding:0;

+ 16 - 3
plugin/hackpoint/js/main.js

@@ -88,7 +88,8 @@ function hackpoint_part_save(element){
 	}
 	$.action(data,function(r){
 		
-		
+		li.attr('data-part',r.part);
+		li.attr('data-id',r.id)
 		$.message('success','Enregistré');
 	});
 }
@@ -387,7 +388,7 @@ function resource_add_document(files){
 			line.find('i.pointer').attr('onclick', 'resource_delete_document(this)');
 			if($('.hackpoint').hasClass('readonly')) line.find('i.pointer').hide();
 			
-			
+
 			if(!file.icon){
 				line.find('img').attr('src', file.url);
 			}else{
@@ -480,7 +481,19 @@ function hackpoint_resource_save(element){
 		type:$(element).attr('data-slug')
 	}
 	$.action(data,function(r){
-		hackpoint_resource_search(null,'#resources li[data-id="'+r.id+'"]');
+
+		var tpl = $('#resources li:eq(0)').get(0).outerHTML;
+		var element = $(Mustache.render(tpl,r));
+		$('#resources').append(element);
+
+		element.removeClass('hidden')
+    	.css('transform','translateX(-120px)');
+    	setTimeout(function(){
+    		$(element).css('transform','translateX(0px)');
+    	},150);
+
+    	element.trigger('click');
+
 	});
 }
 

+ 2 - 1
plugin/hackpoint/page.list.sketch.php

@@ -35,8 +35,9 @@ require_once(__DIR__.SLASH.'Sketch.class.php');
  
             <li data-id="{{id}}" class="hidden">
 
-                    <div class="card" style="width: 18rem;">
+                    <div class="card">
                       <img src="{{picture}}" class="card-img-top" alt="{{label}}">
+
                       <div class="card-body">
                         <h5 class="card-title"> #{{id}} - {{label}}</h5>
                         

+ 1 - 1
plugin/hackpoint/page.sheet.sketch.php

@@ -59,7 +59,7 @@ $sketchClasses = $sketch->creator != $myUser->login ? "readonly":"editable";
 									<input id="state" name="state" class="form-control editable-input" onclick="hackpoint_sketch_save();" <?php echo $sketch->state?'checked="checked"':''; ?> type="checkbox" data-type="checkbox"> Public
 								</label>
 							</div>
-							<div class="btn-group" role="group" aria-label="Save">
+							<div class="btn-group" role="group" aria-label="Save" onclick="$.message('info','En cours d\'implémentation...')">
 								<div onclick="" class="btn btn-success"><i class="fas fa-cogs"></i></div>
 							</div>
 						</div>