Skip to content

Commit

Permalink
Update project template pages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed May 28, 2018
1 parent 467856b commit d689b41
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
19 changes: 14 additions & 5 deletions layouts/admin-template-dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:to="{
name: 'admin-template-short_name-id-task',
params: {
short_name: currentCollection.short_name,
id: currentTemplate.id
}
}">
Expand Down Expand Up @@ -39,31 +40,33 @@ export default {
return this.$store.state.currentTemplate
},
currentTemplate () {
return this.$store.state.currentCollection
},
taskNotConfigured () {
const isTaskPage = (
this.$route.name === 'admin-template-short_name-id-task'
)
return (
!isEmpty(this.currentCollection) &&
!isEmpty(this.currentTemplate) &&
!this.currentTemplate.task &&
!isTaskPage
)
},
currentUser () {
return this.$store.state.currentUser
},
navItems () {
const items = {}
if (!isEmpty(this.currentTemplate)) {
if (!isEmpty(this.currentTemplate) && !isEmpty(this.currentCollection)) {
items[this.currentTemplate.name] = [
{
label: 'Core Details',
exact: true,
link: {
name: 'admin-template-short_name-id',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand All @@ -73,6 +76,7 @@ export default {
link: {
name: 'admin-template-short_name-id-task',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand All @@ -82,6 +86,7 @@ export default {
link: {
name: 'admin-template-short_name-id-redundancy',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand All @@ -91,6 +96,7 @@ export default {
link: {
name: 'admin-template-short_name-id-parent',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand All @@ -100,6 +106,7 @@ export default {
link: {
name: 'admin-template-short_name-id-analysis',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand All @@ -109,6 +116,7 @@ export default {
link: {
name: 'admin-template-short_name-id-tutorial',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand All @@ -118,6 +126,7 @@ export default {
link: {
name: 'admin-template-short_name-id-delete',
params: {
short_name: this.currentCollection.short_name,
id: this.currentTemplate.id
}
}
Expand Down
1 change: 1 addition & 0 deletions pages/admin/project/_short_name/template.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
:to="{
name: 'admin-template-short_name-id',
params: {
short_name: currentCollection.short_name,
id: tmpl.item.id
}
}">
Expand Down
3 changes: 2 additions & 1 deletion pages/admin/template/_short_name/_id/delete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default {
* Delete the template.
*/
deleteTemplate () {
const endpoint = `/api/category/${this.currentCollection.id}`
const infoClone = JSON.parse(JSON.stringify(this.currentCollection.info))
infoClone.templates = infoClone.templates.filter(tmpl => {
return tmpl.id !== this.currentTemplate.id
Expand All @@ -99,7 +100,7 @@ export default {
reverseButtons: true,
showLoaderOnConfirm: true,
preConfirm: () => {
return this.$axios.$post('/api/category', {
return this.$axios.$put(endpoint, {
info: infoClone
})
}
Expand Down
9 changes: 4 additions & 5 deletions pages/admin/template/_short_name/_id/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

<b-card-body v-if="!currentCollection.info.presenter">
<b-alert show variant="warning" class="mb-0">
This collection has an invalid, or non-existant task presenter and
therefore the task template cannot be updated. Before designing the
task, please
This collection does not have a task presenter and therefore the
task details cannot be updated. Before designing the task, please
<nuxt-link
:to="{
name: 'admin-collection-short_name-presenter',
Expand Down Expand Up @@ -262,7 +261,7 @@ export default {
label: 'Database',
type: 'select',
values: this.templateData.z3950_databases.map(db => {
return { id: db[0], name: db[1] }
return { id: db, name: db }
}),
hint: 'The Z39.50 database that to search for matching records.'
}
Expand All @@ -276,7 +275,7 @@ export default {
endpoint: '',
method: 'post',
model: Object.assign(
this.templateData.task,
this.templateData.task[presenter],
currentTaskData
),
schema: {
Expand Down
6 changes: 5 additions & 1 deletion pages/admin/template/_short_name/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
size="sm"
variant="success"
:to="{
name: 'admin-template-short_name-new'
name: 'admin-template-short_name-new',
params: {
short_name: currentCollection.short_name,
}
}">
New
</b-btn>
Expand All @@ -36,6 +39,7 @@
:to="{
name: 'admin-template-short_name-id',
params: {
short_name: currentCollection.short_name,
id: template.item.id
}
}">
Expand Down
3 changes: 2 additions & 1 deletion pages/admin/template/_short_name/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export default {
this.$router.push({
name: 'admin-template-short_name-id',
params: {
id: this.currentCollection.id
short_name: this.currentCollection.short_name,
id: formData.id
}
})
}).catch(err => {
Expand Down

0 comments on commit d689b41

Please sign in to comment.