Add 'clone template' feature to the templates UI
This commit is contained in:
parent
2587d67765
commit
818da1bb4d
|
@ -153,7 +153,7 @@
|
||||||
</b-tooltip>
|
</b-tooltip>
|
||||||
</a>
|
</a>
|
||||||
<a href="" @click.prevent="$utils.prompt(`Clone campaign`,
|
<a href="" @click.prevent="$utils.prompt(`Clone campaign`,
|
||||||
{ placeholder: 'Campaign name', value: `Copy of ${props.row.name}`},
|
{ placeholder: 'Name', value: `Copy of ${props.row.name}`},
|
||||||
(name) => cloneCampaign(name, props.row))">
|
(name) => cloneCampaign(name, props.row))">
|
||||||
<b-tooltip label="Clone" type="is-dark">
|
<b-tooltip label="Clone" type="is-dark">
|
||||||
<b-icon icon="file-multiple-outline" size="is-small" />
|
<b-icon icon="file-multiple-outline" size="is-small" />
|
||||||
|
|
|
@ -40,6 +40,13 @@
|
||||||
<b-icon icon="pencil-outline" size="is-small" />
|
<b-icon icon="pencil-outline" size="is-small" />
|
||||||
</b-tooltip>
|
</b-tooltip>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="" @click.prevent="$utils.prompt(`Clone template`,
|
||||||
|
{ placeholder: 'Name', value: `Copy of ${props.row.name}`},
|
||||||
|
(name) => cloneTemplate(name, props.row))">
|
||||||
|
<b-tooltip label="Clone" type="is-dark">
|
||||||
|
<b-icon icon="file-multiple-outline" size="is-small" />
|
||||||
|
</b-tooltip>
|
||||||
|
</a>
|
||||||
<a v-if="!props.row.isDefault" href="#"
|
<a v-if="!props.row.isDefault" href="#"
|
||||||
@click.prevent="$utils.confirm(null, () => makeTemplateDefault(props.row))">
|
@click.prevent="$utils.confirm(null, () => makeTemplateDefault(props.row))">
|
||||||
<b-tooltip label="Make default" type="is-dark">
|
<b-tooltip label="Make default" type="is-dark">
|
||||||
|
@ -126,6 +133,19 @@ export default Vue.extend({
|
||||||
this.previewItem = null;
|
this.previewItem = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cloneTemplate(name, t) {
|
||||||
|
const data = { name, body: t.body };
|
||||||
|
this.$api.createTemplate(data).then((d) => {
|
||||||
|
this.$api.getTemplates();
|
||||||
|
this.$emit('finished');
|
||||||
|
this.$buefy.toast.open({
|
||||||
|
message: `'${d.name}' created`,
|
||||||
|
type: 'is-success',
|
||||||
|
queue: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
makeTemplateDefault(tpl) {
|
makeTemplateDefault(tpl) {
|
||||||
this.$api.makeTemplateDefault(tpl.id).then(() => {
|
this.$api.makeTemplateDefault(tpl.id).then(() => {
|
||||||
this.$api.getTemplates();
|
this.$api.getTemplates();
|
||||||
|
|
Loading…
Reference in New Issue