forked from frappe/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageOptions.vue
More file actions
49 lines (48 loc) · 1.7 KB
/
PageOptions.vue
File metadata and controls
49 lines (48 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<template>
<div>
<div class="flex flex-row flex-wrap gap-4">
<BuilderInput
label="Page Title"
type="text"
class="w-full text-sm [&>label]:w-[60%] [&>label]:min-w-[180px]"
:modelValue="page.page_title"
@update:modelValue="(val: string) => pageStore.updateActivePage('page_title', val)" />
<BuilderInput
type="text"
class="w-full text-sm [&>label]:w-[60%] [&>label]:min-w-[180px] [&>p]:text-p-xs"
label="Route"
description="The URL path for this page. For variables, use colon (e.g. /users/:id)"
@input="(val: string) => (page.route = val)"
:modelValue="page.route"
:hideClearButton="true"
@update:modelValue="(val: string) => pageStore.updateActivePage('route', val)" />
<!-- Dynamic Route Variables -->
<CollapsibleSection
sectionName="URL Variables"
v-if="dynamicVariables.length"
class="w-full [&>div>h3]:!text-xs [&>div>h3]:!text-ink-gray-5">
<BuilderInput
v-for="(variable, index) in dynamicVariables"
:key="index"
type="text"
:label="variable.replace(/_/g, ' ')"
:modelValue="pageStore.routeVariables[variable]"
@update:modelValue="(val: string) => pageStore.setRouteVariable(variable, val)" />
</CollapsibleSection>
</div>
</div>
</template>
<script setup lang="ts">
import usepageStore from "@/stores/pageStore";
import { BuilderPage } from "@/types/Builder/BuilderPage";
import { getRouteVariables } from "@/utils/helpers";
import { computed } from "vue";
import CollapsibleSection from "./CollapsibleSection.vue";
const pageStore = usepageStore();
const props = defineProps<{
page: BuilderPage;
}>();
const dynamicVariables = computed(() => {
return getRouteVariables(props.page.route || "");
});
</script>