+
-
-
- {{ config.summary }}
-
+
+
+
+
+ Annuler
+
+
+
+ Valider
+
+
+
+
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+
+ Pas de titre
+
+
+
+
+
+
+
+ Annuler
+
+
+
+ Valider
+
+
+
+
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+ {{ page.config.summary }}
+
+
+ Pas de résumé
+
+
Publiée le {{ page.publishedAt | date('L') }} par {{ page.created.name }}
-
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
-
-
+ Valider
+
+
-
- Jeux de données associés
-
-
-
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+
+ Pas d'image
+
+
+
+
+
+
+
+ Annuler
+
+
+
-
-
+ Valider
+
+
-
+
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+
+ Pas de description
+
+
+
+
+
+
+
+
+ Annuler
+
+
+
+ Valider
+
+
+
+
+
+
+ mdi-pencil
+
+
+
+
+ mdi-dots-vertical
+
+
+
+
+
+ mdi-menu-up
+
+ Monter
+
+
+
+ mdi-menu-down
+
+ Descendre
+
+
+
+
+ mdi-delete
+
+
+ Supprimer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Jeux de données associés
+
+
+
+
+
+
+
+
+
+
+ mdi-plus
+
diff --git a/public/components/pages/thematic.vue b/public/components/pages/thematic.vue
index 8e43a039..6eeef325 100644
--- a/public/components/pages/thematic.vue
+++ b/public/components/pages/thematic.vue
@@ -1,83 +1,398 @@
-
-
-
-
+
+
-
+
+
+ Annuler
+
+
+
+ Valider
+
+
+
+
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
+ Valider
+
+
-
- Jeux de données associés
-
-
-
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+
+ Pas de titre
+
+
+
+
+
+
+
-
-
+ Annuler
+
+
+
+ Valider
+
+
-
+
+
+
+ mdi-pencil
+
+
+ mdi-delete
+
+
+
+ Pas de description
+
+
+
+
+
+
+
+
+ Annuler
+
+
+
+ Valider
+
+
+
+
+
+
+ mdi-pencil
+
+
+
+
+ mdi-dots-vertical
+
+
+
+
+
+ mdi-menu-up
+
+ Monter
+
+
+
+ mdi-menu-down
+
+ Descendre
+
+
+
+
+ mdi-delete
+
+
+ Supprimer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Jeux de données associés
+
+
+
+
+
+
+
+
+
+
+ mdi-plus
+
diff --git a/public/pages/manager/portals/_portalId/pages/_id/edit.vue b/public/pages/manager/portals/_portalId/pages/_id/edit.vue
index b5182f2c..687b66f6 100644
--- a/public/pages/manager/portals/_portalId/pages/_id/edit.vue
+++ b/public/pages/manager/portals/_portalId/pages/_id/edit.vue
@@ -18,50 +18,39 @@
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
@@ -71,7 +60,6 @@ import Thematic from '~/components/pages/thematic.vue'
import News from '~/components/pages/news.vue'
const { mapState } = require('vuex')
-const context = require.context('../../../../../../assets/templates', true, /\.json$/)
const pageSchema = require('~/../contract/page.json')
Object.keys(pageSchema.properties).forEach(p => {
if (pageSchema.properties[p].readOnly) delete pageSchema.properties[p]
@@ -88,9 +76,6 @@ export default {
}),
computed: {
...mapState(['config', 'portal']),
- template () {
- return this.page.template && context(`./${this.page.template}.json`)
- },
dataFairUrl () {
return this.$store.getters.dataFairUrl
},
@@ -137,14 +122,23 @@ export default {
this.pageConfig = this.page.config || {}
delete this.page.config
if (this.config.owner) this.owner = this.config.owner.type + ':' + this.config.owner.id
-
this.htmlPage = await this.$axios.$get(this.$store.state.publicUrl + `/api/v1/portals/${this.portal._id}/pages/${this.$route.params.id}`, { params: { html: true } })
+ this.htmlPage.config = this.htmlPage.config || {}
},
methods: {
- async update (patch) {
+ async updatePage (patch) {
+ try {
+ this.page = await this.$axios.$patch(this.$store.state.publicUrl + `/api/v1/portals/${this.portal._id}/pages/${this.$route.params.id}`, patch)
+ delete this.page.config
+ delete this.page.id
+ } catch (error) {
+ console.error(error)
+ }
+ },
+ async updateConfig (config) {
+ this.pageConfig = { ...this.pageConfig, ...config }
try {
- this.htmlPage = await this.$axios.$patch(this.$store.state.publicUrl + `/api/v1/portals/${this.portal._id}/pages/${this.$route.params.id}`, patch, { params: { html: true } })
- // this.$router.push({ name: 'pages' })
+ this.htmlPage = await this.$axios.$patch(this.$store.state.publicUrl + `/api/v1/portals/${this.portal._id}/pages/${this.$route.params.id}`, { config: this.pageConfig }, { params: { html: true } })
} catch (error) {
console.error(error)
}
diff --git a/public/pages/pages/_id.vue b/public/pages/pages/_id.vue
index d5157704..9dcfe6dc 100644
--- a/public/pages/pages/_id.vue
+++ b/public/pages/pages/_id.vue
@@ -7,12 +7,12 @@
{
+ for await (const page of db.collection('pages').find({ template: 'thematic' })) {
+ const config = page.config
+ if (config.banner || config.localBanner) {
+ debug('update page', page._id, page.title)
+ config.banner = {
+ url: config.banner,
+ local: config.localBanner
+ }
+ delete config.localBanner
+ await db.collection('pages').updateOne({ _id: page._id }, { $set: { config } })
+ }
+ }
+}