client brief image details - remove image working
This commit is contained in:
parent
c0db3f5238
commit
e1e844d057
12 changed files with 54 additions and 45 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB |
|
|
@ -1,17 +0,0 @@
|
|||
Description:
|
||||
|
||||
----
|
||||
|
||||
Tags: bouton poussoir, coloris & nuances, matériaux & textures
|
||||
|
||||
----
|
||||
|
||||
Date: 2024-10-02 02:10
|
||||
|
||||
----
|
||||
|
||||
Uuid: jGugtGC1EbgJQrYq
|
||||
|
||||
----
|
||||
|
||||
Template: image
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 217 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 213 KiB |
|
|
@ -1,17 +0,0 @@
|
|||
Description:
|
||||
|
||||
----
|
||||
|
||||
Tags: bouton poussoir, DA globale, forme & design
|
||||
|
||||
----
|
||||
|
||||
Date: 2024-10-02 02:10
|
||||
|
||||
----
|
||||
|
||||
Uuid: BJZhoIKbKAh76NEV
|
||||
|
||||
----
|
||||
|
||||
Template: image
|
||||
|
|
@ -16,10 +16,12 @@ Description: Bon voilà ça marche
|
|||
|
||||
Clientbriefimages:
|
||||
|
||||
- file://BJZhoIKbKAh76NEV
|
||||
- file://jGugtGC1EbgJQrYq
|
||||
- file://TCy5v8H96mcAaTc8
|
||||
- file://AiNBBh9kVEjjmWId
|
||||
- file://HtsU6YRSecIxEcpg
|
||||
- file://x0PdZLKFgnH9vAUx
|
||||
- file://KvwJxk77JwPx4i9n
|
||||
- file://zIyqi62CsCiraGDI
|
||||
- file://OteRWTbf0rgLGhq6
|
||||
- file://b4Ywx4ProE0Smc0Q
|
||||
|
||||
----
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
|
|
@ -6,11 +6,7 @@ Tags:
|
|||
|
||||
----
|
||||
|
||||
Date: 2024-10-02 02:10
|
||||
|
||||
----
|
||||
|
||||
Uuid: TCy5v8H96mcAaTc8
|
||||
Uuid: b4Ywx4ProE0Smc0Q
|
||||
|
||||
----
|
||||
|
||||
|
|
@ -24,6 +24,7 @@ return [
|
|||
require(__DIR__ . '/routes/upload-images.php'),
|
||||
require(__DIR__ . '/routes/save-page.php'),
|
||||
require(__DIR__ . '/routes/save-file.php'),
|
||||
require(__DIR__ . '/routes/remove-file.php'),
|
||||
],
|
||||
'hooks' => [
|
||||
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
||||
|
|
|
|||
17
public/site/config/routes/remove-file.php
Normal file
17
public/site/config/routes/remove-file.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'pattern' => '(:all)remove-file.json',
|
||||
'method' => 'POST',
|
||||
'action' => function () {
|
||||
$json = file_get_contents('php://input');
|
||||
$data = json_decode($json);
|
||||
|
||||
$page = page($data->pageUri);
|
||||
$file = $page->file($data->fileName);
|
||||
|
||||
$file->delete();
|
||||
|
||||
return json_encode("File successfully removed.");
|
||||
}
|
||||
];
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<button
|
||||
data-icon="delete"
|
||||
class="btn btn--black-10 | ml-auto mt-auto"
|
||||
@click="image = false"
|
||||
@click="remove()"
|
||||
>
|
||||
Supprimer cette image
|
||||
</button>
|
||||
|
|
@ -64,7 +64,7 @@ const { imageDetails } = defineProps({
|
|||
imageDetails: Object,
|
||||
});
|
||||
|
||||
const emit = defineEmits(["close"]);
|
||||
const emit = defineEmits(["close", "remove"]);
|
||||
|
||||
const isOpen = ref(true);
|
||||
watch(isOpen, () => {
|
||||
|
|
@ -117,11 +117,32 @@ const saveDescription = debounce(() => {
|
|||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
console.log(json);
|
||||
emit("");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Erreur lors de la sauvegarde :", error);
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
function remove() {
|
||||
const headers = {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
pageUri: page.uri,
|
||||
fileName: image.value.name,
|
||||
}),
|
||||
};
|
||||
fetch("/remove-file.json", headers)
|
||||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
console.log(json);
|
||||
emit("remove", image.value);
|
||||
isOpen.value = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Erreur lors de la suppression :", error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
v-if="imageDetails"
|
||||
:imageDetails="imageDetails"
|
||||
@close="imageDetails = null"
|
||||
@remove="removeImage"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
|
@ -89,6 +90,11 @@ function beforeSend(event) {
|
|||
function changeSelectedTags(newTags) {
|
||||
selectedTags.value = newTags;
|
||||
}
|
||||
|
||||
function removeImage(target) {
|
||||
console.log("remove", target);
|
||||
images.value = images.value.filter((image) => image.uuid !== target.uuid);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue