From 678f6add5ee9803ab14a78731cf3edec5bb73aaf Mon Sep 17 00:00:00 2001 From: Rasta Date: Fri, 17 May 2019 12:03:20 +0200 Subject: [PATCH] add and manage container members --- package-lock.json | 11 +- package.json | 2 +- src/components/AddMember.vue | 222 ++++++++++++++++++++++++++++++++ src/components/Detail.vue | 33 ++++- src/components/SubmitEmpty.vue | 20 ++- src/components/SubmitKsaEda.vue | 13 ++ src/router/index.js | 6 + 7 files changed, 288 insertions(+), 19 deletions(-) create mode 100644 src/components/AddMember.vue diff --git a/package-lock.json b/package-lock.json index d532af6..a678184 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7673,9 +7673,9 @@ "dev": true }, "phaidra-vue-components": { - "version": "0.3.33", - "resolved": "https://registry.npmjs.org/phaidra-vue-components/-/phaidra-vue-components-0.3.33.tgz", - "integrity": "sha512-/Z6v5AIj1jQ4JTQPAWk/P7EoN/0uDFMm5vnylknrf4cjRM/2tVLQdH8la6XN29MhrrUFOidZUGAkCgx+lRubpA==", + "version": "0.3.34", + "resolved": "https://registry.npmjs.org/phaidra-vue-components/-/phaidra-vue-components-0.3.34.tgz", + "integrity": "sha512-t9pCq10fCHizS3cl7n5eurhnFqMw/9wSpBudkGPB9/4pM3sV6XdD8zOKd+gS5w5Owerk8j/vpmLN7j0FVBoGkw==", "requires": { "base-64": "^0.1.0", "moment": "^2.24.0", @@ -7691,11 +7691,6 @@ "version": "8.11.2", "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.11.2.tgz", "integrity": "sha512-STcpmxqBrG77SyWi7e0Yn/B3DjKR6mSDwYS4F/V7zoi+e/+CPbVb2TaBqFwnrkoDcPmRfjM7nTwsiRQQOGdifw==" - }, - "vuetify": { - "version": "1.5.14", - "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-1.5.14.tgz", - "integrity": "sha512-7iM+TfghR/wu/Gl+k37lKr0N8Ddr6SxzqHtoK1dIyHgCH6SJRkpaXPw2MC5/FsAg9aUDJbYNWrzSeu5eHw+Q/w==" } } }, diff --git a/package.json b/package.json index 43f0e38..6a2c995 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "es6-promise": "^4.2.5", "growl": "^1.10.5", "moment": "^2.24.0", - "phaidra-vue-components": "^0.3.33", + "phaidra-vue-components": "^0.3.34", "qs": "^6.6.0", "vue": "^2.6.6", "vue-i18n": "^7.8.1", diff --git a/src/components/AddMember.vue b/src/components/AddMember.vue new file mode 100644 index 0000000..10d4a27 --- /dev/null +++ b/src/components/AddMember.vue @@ -0,0 +1,222 @@ + + + + diff --git a/src/components/Detail.vue b/src/components/Detail.vue index d68b7bf..df439b1 100644 --- a/src/components/Detail.vue +++ b/src/components/Detail.vue @@ -28,7 +28,7 @@ @@ -53,9 +53,28 @@ + + + + {{ $t('View') }} + {{ $t('Download') }} + + + + + {{ $t('Edit metadata') }} + + + {{ $t('Manage object') }} + + + + @@ -219,7 +238,7 @@ - + @@ -229,6 +248,7 @@ {{ $t('Edit metadata') }} {{ $t('Manage object') }} + {{ $t('Upload container member') }} @@ -505,6 +525,13 @@ export default { .catch(function (error) { console.log(error) }) + }, + getMemberDownloadUrl: function (member) { + if (member.cmodel === 'Asset' || member.cmodel === 'Video') { + return this.instance.fedora + '/objects/' + member.pid + '/methods/bdef:Content/download' + } else { + return this.instance.api + '/object/' + member.pid + '/diss/Content/download' + } } }, beforeRouteEnter: function (to, from, next) { diff --git a/src/components/SubmitEmpty.vue b/src/components/SubmitEmpty.vue index 28564f1..b2ea800 100644 --- a/src/components/SubmitEmpty.vue +++ b/src/components/SubmitEmpty.vue @@ -19,6 +19,7 @@ :form="form" v-on:load-form="form = $event" v-on:object-created="objectCreated($event)" + v-on:add-phaidrasubject-section="addPhaidrasubjectSection($event)" > @@ -127,6 +128,17 @@ export default { return 'https://pid.phaidra.org/vocabulary/7AVS-Y482' } }, + addPhaidrasubjectSection: function (afterSection) { + let s = { + title: 'Subject', + type: 'phaidra:Subject', + id: this.form.sections.length + 1, + removable: true, + multiplicable: true, + fields: [] + } + this.form.sections.splice(this.form.sections.indexOf(afterSection) + 1, 0, s) + }, objectCreated: function (event) { this.$store.commit('setAlerts', [{ type: 'success', msg: 'Object ' + event + ' created' }]) this.$router.push({ name: 'detail', params: { pid: event } }) @@ -137,15 +149,9 @@ export default { sections: [ { title: 'Digital object', + type: 'digitalobject', id: 1, fields: [] - }, - { - title: 'Subject', - type: 'phaidra:Subject', - id: 2, - multiplicable: true, - fields: [] } ] } diff --git a/src/components/SubmitKsaEda.vue b/src/components/SubmitKsaEda.vue index 78631d2..d7ae76f 100644 --- a/src/components/SubmitKsaEda.vue +++ b/src/components/SubmitKsaEda.vue @@ -22,6 +22,7 @@ v-on:load-form="form = $event" v-on:object-created="objectCreated($event)" v-on:form-input-p-select="handleSelect($event)" + v-on:add-phaidrasubject-section="addPhaidrasubjectSection($event)" > @@ -203,6 +204,7 @@ export default { sections: [ { title: 'General metadata', + type: 'digitalobject', id: 1, fields: [] }, @@ -314,6 +316,17 @@ export default { this.form.sections[3].fields.push(fields.getField('role')) this.form.sections[3].fields.push(fields.getField('license')) this.form.sections[3].fields.push(fields.getField('rights')) + }, + addPhaidrasubjectSection: function (afterSection) { + let s = { + title: 'Subject', + type: 'phaidra:Subject', + id: this.form.sections.length + 1, + removable: true, + multiplicable: true, + fields: [] + } + this.form.sections.splice(this.form.sections.indexOf(afterSection) + 1, 0, s) } }, mounted: function () { diff --git a/src/router/index.js b/src/router/index.js index 429c943..be1b421 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -10,6 +10,7 @@ import MetadataEditor from '@/components/MetadataEditor' import Submit from '@/components/Submit' import SubmitKsaEda from '@/components/SubmitKsaEda' import SubmitEmpty from '@/components/SubmitEmpty' +import AddMember from '@/components/AddMember' Vue.use(Router) @@ -64,6 +65,11 @@ export default new Router({ path: '/submit/empty', name: 'submit-empty', component: SubmitEmpty + }, + { + path: '/addmember/:pid', + name: 'addmember', + component: AddMember } ] })