Skip to content
Snippets Groups Projects
Commit e29ab062 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix project_type title instead of slug in route params & get project infos and...

fix project_type title instead of slug in route params & get project infos and modify new project fields
parent c7bd77ac
No related branches found
No related tags found
No related merge requests found
......@@ -501,10 +501,10 @@ export default {
}
if (this.action === "duplicate") {
//* replace original name with new default title
this.form.title.value += ` (Copie ${new Date()
this.form.title.value += ` (Copie-${new Date()
.toLocaleString()
.slice(0, -3)
.replace(",", "")} )`;
.replace(",", "")})`;
this.updateStore(); // * initialize form in store in case this.form would not be modified
}
}
......
......@@ -382,15 +382,23 @@ export default {
created() {
this.definePageType();
console.log(this.action);
if (this.action === "create") {
this.thumbnailFileSrc = require("@/assets/img/default.png");
} else if (this.action === "edit") {
} else if (this.action === "edit" || this.action === "create_from") {
if (!this.project) {
this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
}
this.form = this.project;
/* this.form.thumbnail = //* add api base to display image src
configuration.VUE_APP_DJANGO_BASE + this.form.thumbnail; */
this.form = { ...this.project }; //* create a new object to avoid modifying original one
if (this.action === "create_from") {
this.form.title =
this.project.title +
` (Copie-${new Date()
.toLocaleString()
.slice(0, -3)
.replace(",", "")})`;
this.form.is_project_type = false;
}
//* transform string values to objects for dropdowns display (could be in a computed)
this.form.access_level_pub_feature = {
name: this.project.access_level_pub_feature,
......
......@@ -21,7 +21,7 @@
:to="{
name: 'project_create_from',
params: {
slug: project.title,
slug: project.slug,
},
}"
>{{ project.title }}</router-link
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment