mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Part image delete (#3963)
* Add button to remove an associated image from a part - Also fixes some issues with onclick event propagation * Similar feature for company image
This commit is contained in:
		| @@ -58,6 +58,9 @@ | ||||
|             {% if allow_download %} | ||||
|             <button type='button' class='btn btn-outline-secondary' title="{% trans 'Download image from URL' %}" id='company-image-url'><span class='fas fa-cloud-download-alt'></span></button> | ||||
|             {% endif %} | ||||
|             {% if company.image %} | ||||
|             <button type='button' class='btn btn-outline-secondary' title='{% trans "Delete image" %}' id='company-image-delete'><span class='fas fa-trash-alt icon-red'></span></button> | ||||
|             {% endif %} | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| @@ -194,10 +197,37 @@ | ||||
|     $('#company-image').click(function() { | ||||
|         showModalImage('{{ company.image.url }}'); | ||||
|     }); | ||||
|  | ||||
|     $('#company-image-delete').click(function(event) { | ||||
|         event.stopPropagation(); | ||||
|         showQuestionDialog( | ||||
|             '{% trans "Remove Image" %}', | ||||
|             '{% trans "Remove associated image from this company" %}', | ||||
|             { | ||||
|                 accept_text: '{% trans "Remove" %}', | ||||
|                 submitClass: 'danger', | ||||
|                 accept: function() { | ||||
|                     inventreePut( | ||||
|                         '{% url "api-company-detail" company.pk %}', | ||||
|                         { | ||||
|                             'image': null, | ||||
|                         }, | ||||
|                         { | ||||
|                             method: 'PATCH', | ||||
|                             success: function() { | ||||
|                                 location.reload(); | ||||
|                             } | ||||
|                         } | ||||
|                     ); | ||||
|                 } | ||||
|             } | ||||
|         ); | ||||
|     }); | ||||
|  | ||||
|     {% endif %} | ||||
|  | ||||
|     $("#company-image-upload").click(function() { | ||||
|  | ||||
|     $("#company-image-upload").click(function(event) { | ||||
|         event.stopPropagation(); | ||||
|         constructForm( | ||||
|             '{% url "api-company-detail" company.pk %}', | ||||
|             { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user