diff --git a/src/components/namespace/namespace-search.vue b/src/components/namespace/namespace-search.vue new file mode 100644 index 00000000..ca6006d1 --- /dev/null +++ b/src/components/namespace/namespace-search.vue @@ -0,0 +1,67 @@ + + + diff --git a/src/models/listDuplicateModel.js b/src/models/listDuplicateModel.js new file mode 100644 index 00000000..28444185 --- /dev/null +++ b/src/models/listDuplicateModel.js @@ -0,0 +1,17 @@ +import AbstractModel from './abstractModel' +import ListModel from './list' + +export default class ListDuplicateModel extends AbstractModel { + constructor(data) { + super(data) + this.list = new ListModel(this.list) + } + + defaults() { + return { + listId: 0, + namespaceId: 0, + list: ListModel, + } + } +} \ No newline at end of file diff --git a/src/services/listDuplicateService.js b/src/services/listDuplicateService.js new file mode 100644 index 00000000..f34af5ca --- /dev/null +++ b/src/services/listDuplicateService.js @@ -0,0 +1,20 @@ +import AbstractService from './abstractService' +import listDuplicateModel from '../models/listDuplicateModel' + +export default class ListDuplicateService extends AbstractService { + constructor() { + super({ + create: '/lists/{listId}/duplicate', + }) + } + + beforeCreate(model) { + + model.list = null + return model + } + + modelFactory(data) { + return new listDuplicateModel(data) + } +} \ No newline at end of file diff --git a/src/views/list/EditList.vue b/src/views/list/EditList.vue index 4ebcf8ef..23d54bf5 100644 --- a/src/views/list/EditList.vue +++ b/src/views/list/EditList.vue @@ -98,6 +98,32 @@ +
+
+

+ Duplicate this list +

+
+
+
+

Select a namespace which should hold the duplicated list:

+
+

+ +

+

+ +

+
+
+
+
+ { + this.$store.commit('namespaces/addListToNamespace', r.list) + this.success({message: 'The list was successfully duplicated.'}, this) + router.push({name: 'list.index', params: {listId: r.list.id}}) + }) + .catch(e => { + this.error(e, this) + }) + }, } }