Commit 7bc57029 authored by Anton Koch's avatar Anton Koch
Browse files

Merge branch '632-create-project-page' into 'master'

Resolve "create project-page"

See merge request !165
parents 7ebc36d7 8d5d37f8
......@@ -8,14 +8,15 @@
q-separator.bg-transparent.mb-border-b-light
.q-pa-md.cursor-pointer(
@click="changeRoute('timelineViewer')"
) {{ $t('general.timelineViewer') }}
.q-pa-md.cursor-pointer(
@click="changeRoute('liveAnnotate')"
) {{ $t('general.liveAnnotate') }}
.q-pa-md.cursor-pointer(
@click="$router.push({ name: `${resourceAlias || resource}.edit`, params: { id: props.row._id } })"
icon-name="edit"
@click="changeRoute('editProject')"
) {{ $t('general.edit') }}
q-separator.bg-transparent.mb-border-b-light
......@@ -31,8 +32,20 @@
<script>
export default {
name: 'ProjectsActionsContent',
props: ['props', 'noDelete'],
props: ['props', 'noDelete', 'resource', 'resourceAlias'],
methods: {
changeRoute (target) {
this.$router.push({
name: 'site.project',
params: {
id: this.props.key,
target: target,
props: this.props,
resource: this.resource,
resourceAlias: this.resourceAlias
}
})
},
itemInfo (obj) {
this.$emit('itemInfo', obj)
},
......
......@@ -19,7 +19,7 @@ export default {
this.$emit('itemInfo', props)
}
else if (this.currentPage === 'projects') {
// TODO: add route push
this.$router.push({ name: 'site.project', params: { id: props.key, props: props } })
}
}
}
......
......@@ -14,6 +14,8 @@
:is="`${currentPage}ActionsContent`"
:props="props"
:no-delete="noDelete"
:resource="resource"
:resourceAlias="resourceAlias"
@itemInfo="itemInfo"
@deleteItem="onDeleteItem"
)
......
<template lang="pug">
q-tabs(
v-if="showTabs"
v-model="tab"
inline-label
:dense="$q.screen.lt.sm"
:align="$q.screen.lt.sm ? 'right' : 'justify'"
class="mb-bg-bg mb-text-fg mb-subheadline mb-border-b-light"
)
q-tab.text-body2(name="timelineViewer" :label="$t('timelines.viewer.title')" :ripple="false" no-caps)
q-tab.text-body2(name="liveAnnotate" :label="$t('timelines.annotations.live')" :ripple="false" no-caps)
q-tab.text-body2(name="edit" :label="$t('timelines.edit.title')" :ripple="false" no-caps)
q-tab.text-body2(@click="onTab('timelineViewer')", name="timelineViewer" :label="$t('timelines.viewer.title')" :ripple="false" no-caps)
q-tab.text-body2(@click="onTab('liveAnnotate')", name="liveAnnotate" :label="$t('timelines.annotations.live')" :ripple="false" no-caps)
q-tab.text-body2(@click="onTab('editProject')", name="editProject" :label="$t('timelines.edit.title')" :ripple="false" no-caps)
</template>
<script>
......@@ -18,6 +19,18 @@ export default {
return {
tab: 'timelineViewer'
}
},
computed: {
showTabs () {
return this.$route.name === 'site.project' &&
this.$route.params.id
}
},
methods: {
onTab (val) {
// TODO: tab handling needs revision!!
this.$emit('tab', val)
}
}
}
</script>
......
......@@ -4,8 +4,8 @@ export default {
add_user: 'Add user',
administration: 'Administration',
assets: 'Assets',
avatar: 'Avatar',
author: 'Author',
avatar: 'Avatar',
back: 'Back',
cancel: 'Cancel',
change_acl: 'Change acl',
......@@ -16,6 +16,7 @@ export default {
edit: 'Edit',
groups: 'Groups',
invite: 'Invite',
liveAnnotate: 'Live Annotate',
login: 'Login',
logout: 'Logout',
media: 'Media',
......@@ -29,10 +30,12 @@ export default {
remove_selected: 'Remove Selected',
search: 'Search',
securitySettings: 'Security Settings',
systemSettings: 'System Settings',
share: 'Share',
submit: 'Submit',
systemSettings: 'System Settings',
theme: 'Theme',
timelineViewer: 'Timeline Viewer',
timelines: 'Timelines',
title: 'Title',
updated: 'Updated',
user: 'User',
......
......@@ -5,8 +5,14 @@
q-resize-observer(@resize="onHeaderResize")
nav-toolbar(v-model="left")
template(v-slot:tabs)
nav-tabs(v-if="$q.screen.gt.xs")
nav-tabs(v-if="$q.screen.lt.sm")
nav-tabs(
v-if="$q.screen.gt.xs"
@tab="onTab"
)
nav-tabs(
v-if="$q.screen.lt.sm"
@tab="onTab"
)
// DRAWER ----------------------------------------------------------------------------------------------------------
q-drawer(
......@@ -21,7 +27,10 @@
// PAGE ------------------------------------------------------------------------------------------------------------
q-page-container
q-page.q-px-md
router-view(:header="size.header")
router-view(
:header="size.header"
:tab="tab"
)
</template>
<script>
......@@ -41,6 +50,7 @@ export default {
data () {
return {
tab: undefined,
left: false,
size: {
header: { height: 0, width: 0 }
......@@ -56,6 +66,9 @@ export default {
},
methods: {
onTab (val) {
this.tab = val
},
onHeaderResize (size) {
this.size.header = size
},
......
<template lang="pug">
q-page.projects.q-py-lg
router-link(:to="'/projects'")
mb-icon-btn.rotate-180(
icon-name="east"
:outline="true"
)
q-tab-panels(
v-model="tab"
animated
)
q-tab-panel(
v-for="panel in panels"
:name="panel"
:key="panel"
)
component(
:is="panel || 'TimelineViewer'"
:props="$route.params.props"
)
</template>
<script>
import TimelineViewer from 'pages/projects/sub/timelineViewer'
import EditProject from 'pages/projects/sub/editProject'
import LiveAnnotate from 'pages/projects/sub/liveAnnotate'
export default {
name: 'project',
components: { LiveAnnotate, EditProject, TimelineViewer },
props: ['tab'],
data () {
return {
panels: ['timelineViewer', 'liveAnnotate', 'editProject']
}
}
}
</script>
<style scoped lang="stylus">
</style>
......@@ -49,7 +49,7 @@
</template>
<script>
import tableRequest from '../lib/table-request'
import tableRequest from '../../lib/table-request'
import { DateTime } from 'luxon'
import DialogCreateProject from 'components/MbComponents/MbDialog/DialogContents/Navigation/DialogCreateProject'
......
<template lang="pug">
.mb-edit-project-inner
// hedline ---------------------------------------------------------------------------------------------------------
.q-mb-xl
mb-headline(:title="$t('timelines.edit.title')")
// form ------------------------------------------------------------------------------------------------------------
q-form(v-if="payload")
mb-input-text(
:value="payload.title"
:label="$t('general.title')"
@input="onTitle"
)
.q-mt-md
mb-btn(
:label="$t('general.submit')"
@click.native="submit()"
)
</template>
<script>
import SubmitButtons from 'components/AntonPresets/SubmitButtons'
export default {
name: 'editProject',
components: { SubmitButtons },
props: ['props'],
data () {
return {
payload: {
title: this.props.row.title,
type: ['Timeline']
}
}
},
async mounted () {
if (this.$route.params.id) {
this.$q.loading.show({ delay: 400 })
const payload = await this.$store.dispatch('maps/get', this.$route.params.id)
Object.assign(this.payload, payload)
this.$q.loading.hide()
}
},
methods: {
onTitle (val) {
this.payload.title = val
},
async submit () {
this.$q.loading.show({ delay: 400 })
const { id } = this.$route.params
if (id) {
await this.$store.dispatch('maps/patch', [id, this.payload])
this.$q.notify({ message: this.$t('messages.update_success'), color: 'positive' })
}
else {
await this.$store.dispatch('maps/create', this.payload)
this.$q.notify({ message: this.$t('messages.create_success'), color: 'positive' })
}
this.$q.loading.hide()
}
}
}
</script>
<style scoped lang="stylus">
.mb-edit-project-inner
max-width 680px
margin 0 auto
border-radius $border-radius
</style>
<template lang="pug">
.live-annotate
| live annotate
</template>
<script>
export default {
name: 'liveAnnotate',
props: ['props']
}
</script>
<style scoped lang="stylus">
</style>
<template lang="pug">
.timeline-viewer
| timeline viewer
</template>
<script>
export default {
name: 'timelineViewer',
props: ['props']
}
</script>
<style scoped lang="stylus">
</style>
......@@ -6,7 +6,13 @@ export default {
path: '',
name: 'site.projects',
meta: { private: true },
component: () => import('pages/projects')
component: () => import('pages/projects/projects')
},
{
path: '/projects/:id',
name: 'site.project',
meta: { private: true },
component: () => import('pages/projects/project')
}
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment