resolve conflict
This commit is contained in:
parent
06d3a71fb0
commit
d465fb3de7
6 changed files with 134 additions and 36 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
Date: 2024-10-02 02:10
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
Tags:
|
Tags: bouton poussoir, coloris & nuances
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Date: 2024-10-02 02:10
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ return [
|
||||||
require(__DIR__ . '/routes/toggle-favorite.php'),
|
require(__DIR__ . '/routes/toggle-favorite.php'),
|
||||||
require(__DIR__ . '/routes/upload-images.php'),
|
require(__DIR__ . '/routes/upload-images.php'),
|
||||||
require(__DIR__ . '/routes/save-page.php'),
|
require(__DIR__ . '/routes/save-page.php'),
|
||||||
|
require(__DIR__ . '/routes/save-file.php'),
|
||||||
],
|
],
|
||||||
'hooks' => [
|
'hooks' => [
|
||||||
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
'page.create:after' => require_once(__DIR__ . '/hooks/create-steps.php'),
|
||||||
|
|
|
||||||
25
public/site/config/routes/save-file.php
Normal file
25
public/site/config/routes/save-file.php
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pattern' => '(:all)save-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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$newProperties = [];
|
||||||
|
|
||||||
|
foreach ($data->properties as $incomingProperty) {
|
||||||
|
$newProperties[$incomingProperty->name] = $incomingProperty->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newFile = $file->update($newProperties);
|
||||||
|
|
||||||
|
return json_encode($newProperties);
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
@ -6,8 +6,8 @@ foreach ($page->clientBriefImages()->toFiles() as $image) {
|
||||||
$images[] = [
|
$images[] = [
|
||||||
'url' => $image->url(),
|
'url' => $image->url(),
|
||||||
'uuid' => (string) $image->uuid(),
|
'uuid' => (string) $image->uuid(),
|
||||||
'tags' => page('projects')->clientBriefImageTags()->split(),
|
'tags' => $image->tags()->split(),
|
||||||
'selectedTags' => $image->tags()->split()
|
'name' => $image->filename()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
rows="3"
|
rows="3"
|
||||||
class="border border-grey-200 | rounded-xl | p-16 | w-full"
|
class="border border-grey-200 | rounded-xl | p-16 | w-full"
|
||||||
v-model="page.content.description"
|
v-model="page.content.description"
|
||||||
@input="savePage()"
|
@input="saveDescription()"
|
||||||
></textarea>
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
<fieldset class="project-details__filters | flex-1">
|
<fieldset class="project-details__filters | flex-1">
|
||||||
|
|
@ -34,12 +34,12 @@
|
||||||
<input
|
<input
|
||||||
class="sr-only"
|
class="sr-only"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:id="`${tag}-page`"
|
:id="`${tag}`"
|
||||||
:name="`${tag}-page`"
|
:name="`${tag}`"
|
||||||
:value="`${tag}-page`"
|
:value="`${tag}`"
|
||||||
v-model="localSelectedTags"
|
v-model="localSelectedTags"
|
||||||
/>
|
/>
|
||||||
<label class="btn btn--sm btn--primary" :for="`${tag}-page`">{{
|
<label class="btn btn--sm btn--primary" :for="`${tag}`">{{
|
||||||
toPascalCase(tag)
|
toPascalCase(tag)
|
||||||
}}</label>
|
}}</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -71,7 +71,7 @@ function updateSelectedTags(tags) {
|
||||||
|
|
||||||
const isWaitingForSave = ref(false);
|
const isWaitingForSave = ref(false);
|
||||||
|
|
||||||
const savePage = debounce(() => {
|
const saveDescription = debounce(() => {
|
||||||
if (!isWaitingForSave.value) {
|
if (!isWaitingForSave.value) {
|
||||||
isWaitingForSave.value = true;
|
isWaitingForSave.value = true;
|
||||||
const headers = {
|
const headers = {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="h-full | flex flex-col" style="--row-gap: var(--space-32)">
|
<section class="h-full | flex flex-col" style="--row-gap: var(--space-32)">
|
||||||
<Header :selectedTags="selectedTags" />
|
<Header
|
||||||
|
:selectedTags="selectedTags"
|
||||||
|
@update:selectedTags="changeSelectedTags"
|
||||||
|
/>
|
||||||
<div class="h-full | masonry">
|
<div class="h-full | masonry">
|
||||||
<button
|
<button
|
||||||
data-icon="upload"
|
data-icon="upload"
|
||||||
class="flex flex-col | bg-white | border border-grey-200 | text-grey-800 | font-medium | rounded-2xl"
|
class="flex flex-col | bg-white | border border-grey-200 | text-grey-800 | font-medium | rounded-2xl"
|
||||||
@click="addImages = true"
|
@click="addImages = true"
|
||||||
>
|
>
|
||||||
|
<<<<<<< HEAD
|
||||||
Ajouter une ou plusieurs images
|
Ajouter une ou plusieurs images
|
||||||
</button>
|
</button>
|
||||||
<figure
|
<figure
|
||||||
|
|
@ -17,6 +21,54 @@
|
||||||
<span class="tag | btn btn--sm">Tag</span>
|
<span class="tag | btn btn--sm">Tag</span>
|
||||||
<img :src="image.url" alt="" />
|
<img :src="image.url" alt="" />
|
||||||
</figure>
|
</figure>
|
||||||
|
=======
|
||||||
|
<template #chooseicon>
|
||||||
|
<svg
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M0.714355 15.0001V16.4286C0.714355 17.1864 1.01538 17.9131 1.55119 18.4489C2.08701 18.9848 2.81374 19.2858 3.5715 19.2858H16.4286C17.1864 19.2858 17.9131 18.9848 18.4489 18.4489C18.9848 17.9131 19.2858 17.1864 19.2858 16.4286V15.0001M5.71436 5.71436L10.0001 0.714355M10.0001 0.714355L14.2858 5.71436M10.0001 0.714355V13.5715"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.25"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
<template
|
||||||
|
#content="{
|
||||||
|
files,
|
||||||
|
uploadedFiles,
|
||||||
|
removeUploadedFileCallback,
|
||||||
|
removeFileCallback,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div v-if="files.length > 0">Fichiers importés</div>
|
||||||
|
</template>
|
||||||
|
</FileUpload>
|
||||||
|
<Toast />
|
||||||
|
<template v-for="image in images" :key="image.uuid">
|
||||||
|
<figure
|
||||||
|
v-if="
|
||||||
|
selectedTags.length === 0 ||
|
||||||
|
selectedTags.some((pageSelectedTag) =>
|
||||||
|
image.tags.includes(pageSelectedTag)
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@click="modal = image"
|
||||||
|
class="image"
|
||||||
|
>
|
||||||
|
<span v-for="tag in image.selectedTags" class="tag | btn btn--sm">{{
|
||||||
|
tag
|
||||||
|
}}</span>
|
||||||
|
<img :src="image.url" alt="" />
|
||||||
|
</figure>
|
||||||
|
</template>
|
||||||
|
>>>>>>> 5d1403a (client brief - update file tab working)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
|
|
@ -127,18 +179,21 @@
|
||||||
<fieldset class="image__tags">
|
<fieldset class="image__tags">
|
||||||
<legend class="text-sm text-grey-700 | mb-8">Tags</legend>
|
<legend class="text-sm text-grey-700 | mb-8">Tags</legend>
|
||||||
<div class="flex" style="gap: var(--space-8)">
|
<div class="flex" style="gap: var(--space-8)">
|
||||||
<template v-for="(tag, index) in modal.tags" :key="index">
|
<template v-for="(pageTag, index) in page.tags" :key="index">
|
||||||
<input
|
<input
|
||||||
class="sr-only"
|
class="sr-only"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:id="tag + '-image'"
|
:id="pageTag + '-image'"
|
||||||
:name="tag + '-image'"
|
:name="pageTag + '-image'"
|
||||||
:value="tag + '-image'"
|
:value="pageTag"
|
||||||
v-model="modal.selectedTags"
|
@change="saveTags(modal)"
|
||||||
|
v-model="modal.tags"
|
||||||
/>
|
/>
|
||||||
<label class="btn btn--sm btn--primary" :for="tag + '-image'">{{
|
<label
|
||||||
toPascalCase(tag)
|
class="btn btn--sm btn--primary"
|
||||||
}}</label>
|
:for="pageTag + '-image'"
|
||||||
|
>{{ toPascalCase(pageTag) }}</label
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
@ -172,27 +227,16 @@ import Toast from "primevue/toast";
|
||||||
import FileUpload from "primevue/fileupload";
|
import FileUpload from "primevue/fileupload";
|
||||||
import Dialog from "primevue/dialog";
|
import Dialog from "primevue/dialog";
|
||||||
import Header from "./Header.vue";
|
import Header from "./Header.vue";
|
||||||
|
import { toPascalCase } from "../../../helpers";
|
||||||
import { useToast } from "primevue/usetoast";
|
import { useToast } from "primevue/usetoast";
|
||||||
import { usePageStore } from "../../../stores/page";
|
import { usePageStore } from "../../../stores/page";
|
||||||
import { ref, watch } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
const { page } = usePageStore();
|
const { page } = usePageStore();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
const selectedTags = ref([]);
|
const selectedTags = ref([]);
|
||||||
|
|
||||||
const modal = ref(null);
|
const modal = ref(null);
|
||||||
watch(modal, (newValue) => {
|
|
||||||
if (newValue) {
|
|
||||||
newValue.selectedTags = newValue.selectedTags.map((tag) => {
|
|
||||||
if (!tag.includes("image")) {
|
|
||||||
return tag + "-image";
|
|
||||||
} else {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const images = ref(page.images);
|
const images = ref(page.images);
|
||||||
|
|
||||||
function onAdvancedUpload(event) {
|
function onAdvancedUpload(event) {
|
||||||
|
|
@ -224,6 +268,34 @@ function beforeSend(event) {
|
||||||
"projects/miss-dior-blooming-bouquet/client-brief"
|
"projects/miss-dior-blooming-bouquet/client-brief"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeSelectedTags(newTags) {
|
||||||
|
selectedTags.value = newTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveTags(image) {
|
||||||
|
const headers = {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
pageUri: page.uri,
|
||||||
|
fileName: image.name,
|
||||||
|
properties: [
|
||||||
|
{
|
||||||
|
name: "tags",
|
||||||
|
value: image.tags,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
fetch("/save-file.json", headers)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((json) => {
|
||||||
|
console.log(json);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Erreur lors de la sauvegarde :", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue