accordions data linked to kirby
This commit is contained in:
parent
d7c7731fe3
commit
2f96f3f901
11 changed files with 122 additions and 10 deletions
|
|
@ -14,7 +14,14 @@ Description: test
|
|||
|
||||
----
|
||||
|
||||
Clientbriefimages: - file://b4Ywx4ProE0Smc0Q
|
||||
Clientbriefimages:
|
||||
|
||||
- file://b4Ywx4ProE0Smc0Q
|
||||
- file://aCuD18YBmLHg6YaS
|
||||
- file://Ke2XIraa5jlvtOdb
|
||||
- file://QBax5c69DcENi2rt
|
||||
- file://nqa5cCGHGoWQXulB
|
||||
- file://FWKdZwxSimGOaO2x
|
||||
|
||||
----
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
Description:
|
||||
|
||||
----
|
||||
|
||||
Tags: forme & design, coloris & nuances
|
||||
|
||||
----
|
||||
|
||||
Uuid: QBax5c69DcENi2rt
|
||||
|
||||
----
|
||||
|
||||
Template: image
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 213 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
Description:
|
||||
|
||||
----
|
||||
|
||||
Tags:
|
||||
|
||||
----
|
||||
|
||||
Uuid: Ke2XIraa5jlvtOdb
|
||||
|
||||
----
|
||||
|
||||
Template: image
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
Description:
|
||||
|
||||
----
|
||||
|
||||
Tags:
|
||||
|
||||
----
|
||||
|
||||
Uuid: nqa5cCGHGoWQXulB
|
||||
|
||||
----
|
||||
|
||||
Template: image
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
Description: test de description
|
||||
Description: test de description mais
|
||||
|
||||
----
|
||||
|
||||
Tags: forme & design, coloris & nuances, parachèvements
|
||||
Tags: parachèvements
|
||||
|
||||
----
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
Description:
|
||||
|
||||
----
|
||||
|
||||
Tags:
|
||||
|
||||
----
|
||||
|
||||
Uuid: FWKdZwxSimGOaO2x
|
||||
|
||||
----
|
||||
|
||||
Template: image
|
||||
|
|
@ -29,7 +29,8 @@
|
|||
placeholder="Ajoutez une description à cette image…"
|
||||
rows="3"
|
||||
class="border border-grey-200 | rounded-xl | p-16 | w-full"
|
||||
@input="saveDescription()"
|
||||
v-model="image.description"
|
||||
@input="saveDescription(image)"
|
||||
></textarea>
|
||||
</div>
|
||||
<fieldset class="image-details__filters | flex-1">
|
||||
|
|
@ -41,14 +42,17 @@
|
|||
<input
|
||||
class="sr-only"
|
||||
type="checkbox"
|
||||
:id="`${tag}`"
|
||||
:name="`${tag}`"
|
||||
:id="`${tag}-image-edit`"
|
||||
:name="`${tag}-image-edit`"
|
||||
:value="`${tag}`"
|
||||
v-model="localSelectedTags"
|
||||
@change="saveTags(image)"
|
||||
v-model="image.tags"
|
||||
/>
|
||||
<label class="btn btn--sm btn--primary" :for="`${tag}`">{{
|
||||
toPascalCase(tag)
|
||||
}}</label>
|
||||
<label
|
||||
class="btn btn--sm btn--primary"
|
||||
:for="`${tag}-image-edit`"
|
||||
>{{ toPascalCase(tag) }}</label
|
||||
>
|
||||
</template>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
@ -104,12 +108,61 @@ import AccordionHeader from "primevue/accordionheader";
|
|||
import AccordionContent from "primevue/accordioncontent";
|
||||
import { usePageStore } from "../../../stores/page";
|
||||
import { toPascalCase } from "../../../helpers";
|
||||
import debounce from "lodash/debounce";
|
||||
|
||||
const { images } = defineProps({
|
||||
images: Array,
|
||||
});
|
||||
|
||||
const { page } = usePageStore();
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
const saveDescription = debounce((image) => {
|
||||
const headers = {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
pageUri: page.uri,
|
||||
fileName: image.name,
|
||||
properties: [
|
||||
{
|
||||
name: "description",
|
||||
value: image.description,
|
||||
},
|
||||
],
|
||||
}),
|
||||
};
|
||||
fetch("/save-file.json", headers)
|
||||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
console.log(json);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Erreur lors de la sauvegarde :", error);
|
||||
});
|
||||
}, 1000);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue