generated from druxt/module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
example/nuxt/components/druxt/layout-builder/component/ExtraFieldBlock.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<div v-if="field === 'links'"> | ||
@TODO - Node page links | ||
</div> | ||
<div v-else /> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
entity: { | ||
type: Object, | ||
required: true, | ||
}, | ||
item: { | ||
type: Object, | ||
required: true, | ||
} | ||
}, | ||
computed: { | ||
field: ({ item }) => item.configuration.id.split(':').pop(), | ||
} | ||
} | ||
</script> |
29 changes: 29 additions & 0 deletions
29
example/nuxt/components/druxt/layout-builder/component/FieldBlock.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<div v-html="html" /> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
entity: { | ||
type: Object, | ||
required: true, | ||
}, | ||
item: { | ||
type: Object, | ||
required: true, | ||
} | ||
}, | ||
computed: { | ||
field: ({ item }) => item.configuration.id.split(':').pop(), | ||
html: ({ entity, field }) => { | ||
if (!entity.attributes[field]) return undefined | ||
if (typeof entity.attributes[field] === 'string') return entity.attributes[field] | ||
if (typeof entity.attributes[field] === 'object' && entity.attributes[field].processed) return entity.attributes[field].processed | ||
return undefined | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ export default { | |
'druxt-router/nuxt', | ||
'@druxt-contrib/layout-builder' | ||
], | ||
components: true, | ||
druxt: { baseUrl } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
<template> | ||
<DruxtRouter path="/node/1"> | ||
<template #default="{ route }"> | ||
<DruxtEntity v-bind="route.props"> | ||
<template #default="{ entity }"> | ||
<DruxtLayoutBuilder :entity="entity" /> | ||
</template> | ||
</DruxtEntity> | ||
<h1>@druxt-contrib/layout-builder module example:</h1> | ||
<details open> | ||
<summary><DruxtLayoutBulder :entity="entity" /></summary> | ||
<DruxtEntity v-bind="route.props"> | ||
<template #default="{ entity }"> | ||
<DruxtLayoutBuilder :entity="entity" /> | ||
</template> | ||
</DruxtEntity> | ||
</details> | ||
</template> | ||
</DruxtRouter> | ||
</template> | ||
|
||
<style scoped> | ||
details { | ||
border: 1px dashed lightgrey; | ||
padding: 1rem; | ||
} | ||
summary { | ||
font-weight: bold; | ||
margin-bottom: 2rem; | ||
} | ||
</style> |