Move all create views to better looking popups (#383)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/383 Co-authored-by: konrad <konrad@kola-entertainments.de> Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
0d34d01689
commit
ddadd89c64
16 changed files with 278 additions and 176 deletions
|
@ -95,6 +95,7 @@ steps:
|
||||||
CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB
|
CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB
|
||||||
YARN_CACHE_FOLDER: .cache/yarn/
|
YARN_CACHE_FOLDER: .cache/yarn/
|
||||||
CYPRESS_CACHE_FOLDER: .cache/cypress/
|
CYPRESS_CACHE_FOLDER: .cache/cypress/
|
||||||
|
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 10000
|
||||||
commands:
|
commands:
|
||||||
- sed -i 's/localhost/api/g' public/index.html
|
- sed -i 's/localhost/api/g' public/index.html
|
||||||
- yarn serve & npx wait-on http://localhost:8080
|
- yarn serve & npx wait-on http://localhost:8080
|
||||||
|
|
|
@ -25,12 +25,12 @@ describe('Lists', () => {
|
||||||
.click()
|
.click()
|
||||||
cy.url()
|
cy.url()
|
||||||
.should('contain', '/namespaces/1/list')
|
.should('contain', '/namespaces/1/list')
|
||||||
cy.get('h3')
|
cy.get('.card-header-title')
|
||||||
.contains('Create a new list')
|
.contains('Create a new list')
|
||||||
cy.get('input.input')
|
cy.get('input.input')
|
||||||
.type('New List')
|
.type('New List')
|
||||||
cy.get('.button')
|
cy.get('.button')
|
||||||
.contains('Add')
|
.contains('Create')
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.wait(1000) // Waiting until the request to create the new list is done
|
cy.wait(1000) // Waiting until the request to create the new list is done
|
||||||
|
@ -142,9 +142,8 @@ describe('Lists', () => {
|
||||||
})
|
})
|
||||||
cy.visit('/lists/1/table')
|
cy.visit('/lists/1/table')
|
||||||
|
|
||||||
cy.get('.table-view table.table a')
|
cy.get('.table-view table.table')
|
||||||
.contains(tasks[0].title)
|
.contains(tasks[0].title)
|
||||||
.first()
|
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.url()
|
cy.url()
|
||||||
|
@ -364,7 +363,6 @@ describe('Lists', () => {
|
||||||
|
|
||||||
cy.get('.kanban .bucket .tasks .task')
|
cy.get('.kanban .bucket .tasks .task')
|
||||||
.contains(tasks[0].title)
|
.contains(tasks[0].title)
|
||||||
.first()
|
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.url()
|
cy.url()
|
||||||
|
|
|
@ -26,12 +26,12 @@ describe('Namepaces', () => {
|
||||||
.click()
|
.click()
|
||||||
cy.url()
|
cy.url()
|
||||||
.should('contain', '/namespaces/new')
|
.should('contain', '/namespaces/new')
|
||||||
cy.get('h3')
|
cy.get('.card-header-title')
|
||||||
.should('contain', 'Create a new namespace')
|
.should('contain', 'Create a new namespace')
|
||||||
cy.get('input.input')
|
cy.get('input.input')
|
||||||
.type('New Namespace')
|
.type('New Namespace')
|
||||||
cy.get('.button')
|
cy.get('.button')
|
||||||
.contains('Add')
|
.contains('Create')
|
||||||
.click()
|
.click()
|
||||||
cy.url()
|
cy.url()
|
||||||
.should('contain', '/namespaces')
|
.should('contain', '/namespaces')
|
||||||
|
|
|
@ -15,12 +15,12 @@ describe('Team', () => {
|
||||||
.click()
|
.click()
|
||||||
cy.url()
|
cy.url()
|
||||||
.should('contain', '/teams/new')
|
.should('contain', '/teams/new')
|
||||||
cy.get('h3')
|
cy.get('.card-header-title')
|
||||||
.contains('Create a new team')
|
.contains('Create a new team')
|
||||||
cy.get('input.input')
|
cy.get('input.input')
|
||||||
.type(newTeamName)
|
.type(newTeamName)
|
||||||
cy.get('.button')
|
cy.get('.button')
|
||||||
.contains('Add')
|
.contains('Create')
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.get('.fullpage')
|
cy.get('.fullpage')
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
<div
|
<div
|
||||||
:class="[
|
:class="[
|
||||||
{
|
{
|
||||||
'fullpage-overlay': fullpage,
|
|
||||||
'is-menu-enabled': menuActive,
|
'is-menu-enabled': menuActive,
|
||||||
},
|
},
|
||||||
$route.name,
|
$route.name,
|
||||||
|
@ -23,6 +22,10 @@
|
||||||
|
|
||||||
<router-view/>
|
<router-view/>
|
||||||
|
|
||||||
|
<transition name="modal">
|
||||||
|
<router-view name="popup"/>
|
||||||
|
</transition>
|
||||||
|
|
||||||
<a @click="$store.commit('keyboardShortcutsActive', true)" class="keyboard-shortcuts-button">
|
<a @click="$store.commit('keyboardShortcutsActive', true)" class="keyboard-shortcuts-button">
|
||||||
<icon icon="keyboard"/>
|
<icon icon="keyboard"/>
|
||||||
</a>
|
</a>
|
||||||
|
@ -33,7 +36,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import {CURRENT_LIST, IS_FULLPAGE, MENU_ACTIVE} from '@/store/mutation-types'
|
import {CURRENT_LIST, MENU_ACTIVE} from '@/store/mutation-types'
|
||||||
import Navigation from '@/components/home/navigation'
|
import Navigation from '@/components/home/navigation'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -46,7 +49,6 @@ export default {
|
||||||
this.renewTokenOnFocus()
|
this.renewTokenOnFocus()
|
||||||
},
|
},
|
||||||
computed: mapState({
|
computed: mapState({
|
||||||
fullpage: IS_FULLPAGE,
|
|
||||||
namespaces(state) {
|
namespaces(state) {
|
||||||
return state.namespaces.namespaces.filter(n => !n.isArchived)
|
return state.namespaces.namespaces.filter(n => !n.isArchived)
|
||||||
},
|
},
|
||||||
|
@ -58,7 +60,6 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
doStuffAfterRoute() {
|
doStuffAfterRoute() {
|
||||||
// this.setTitle('') // Reset the title if the page component does not set one itself
|
// this.setTitle('') // Reset the title if the page component does not set one itself
|
||||||
this.$store.commit(IS_FULLPAGE, false)
|
|
||||||
this.hideMenuOnMobile()
|
this.hideMenuOnMobile()
|
||||||
this.resetCurrentList()
|
this.resetCurrentList()
|
||||||
},
|
},
|
||||||
|
|
|
@ -133,12 +133,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import {CURRENT_LIST, IS_FULLPAGE, MENU_ACTIVE, LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
import {CURRENT_LIST, MENU_ACTIVE, LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'navigation',
|
name: 'navigation',
|
||||||
computed: mapState({
|
computed: mapState({
|
||||||
fullpage: IS_FULLPAGE,
|
|
||||||
namespaces(state) {
|
namespaces(state) {
|
||||||
return state.namespaces.namespaces.filter(n => !n.isArchived)
|
return state.namespaces.namespaces.filter(n => !n.isArchived)
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="card">
|
<div class="card" :class="{'has-no-shadow': !shadow}">
|
||||||
<header class="card-header" v-if="title !== ''">
|
<header class="card-header" v-if="title !== ''">
|
||||||
<p class="card-header-title">
|
<p class="card-header-title">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</p>
|
</p>
|
||||||
<a @click="$emit('close')" class="card-header-icon" v-if="hasClose">
|
<a @click="$emit('close')" class="card-header-icon" v-if="hasClose">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<icon icon="angle-right"/>
|
<icon :icon="closeIcon"/>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</header>
|
</header>
|
||||||
|
@ -34,6 +34,14 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
closeIcon: {
|
||||||
|
type: String,
|
||||||
|
default: 'angle-right',
|
||||||
|
},
|
||||||
|
shadow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
55
src/components/misc/create.vue
Normal file
55
src/components/misc/create.vue
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<template>
|
||||||
|
<modal @close="$router.back()" :overflow="true">
|
||||||
|
<card
|
||||||
|
:title="title"
|
||||||
|
:shadow="false"
|
||||||
|
:padding="false"
|
||||||
|
class="has-text-left has-overflow"
|
||||||
|
:has-close="true"
|
||||||
|
close-icon="times"
|
||||||
|
@close="$router.back()"
|
||||||
|
>
|
||||||
|
<div class="p-4">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
<footer class="modal-card-foot is-flex is-justify-content-flex-end">
|
||||||
|
<x-button
|
||||||
|
:shadow="false"
|
||||||
|
type="secondary"
|
||||||
|
@click.prevent.stop="$router.back()"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</x-button>
|
||||||
|
<x-button
|
||||||
|
:shadow="false"
|
||||||
|
type="primary"
|
||||||
|
@click.prevent.stop="$emit('create')"
|
||||||
|
icon="plus"
|
||||||
|
:disabled="createDisabled"
|
||||||
|
>
|
||||||
|
{{ createLabel }}
|
||||||
|
</x-button>
|
||||||
|
</footer>
|
||||||
|
</card>
|
||||||
|
</modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'create',
|
||||||
|
props: {
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
createLabel: {
|
||||||
|
type: String,
|
||||||
|
default: 'Create',
|
||||||
|
},
|
||||||
|
createDisabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="modal">
|
<transition name="modal">
|
||||||
<div class="modal-mask">
|
<div class="modal-mask">
|
||||||
<div class="modal-container" @click.prevent.stop="$emit('close')">
|
<div class="modal-container" @click.self.prevent.stop="$emit('close')">
|
||||||
<div class="modal-content">
|
<div class="modal-content" :class="{'has-overflow': overflow}">
|
||||||
<slot>
|
<slot>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
|
@ -44,5 +44,11 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
overflow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -159,7 +159,9 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/namespaces/new',
|
path: '/namespaces/new',
|
||||||
name: 'namespace.create',
|
name: 'namespace.create',
|
||||||
component: NewNamespaceComponent,
|
components: {
|
||||||
|
popup: NewNamespaceComponent,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/namespaces/:id/edit',
|
path: '/namespaces/:id/edit',
|
||||||
|
@ -169,7 +171,9 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/namespaces/:id/list',
|
path: '/namespaces/:id/list',
|
||||||
name: 'list.create',
|
name: 'list.create',
|
||||||
component: NewListComponent,
|
components: {
|
||||||
|
popup: NewListComponent,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/lists/:id/edit',
|
path: '/lists/:id/edit',
|
||||||
|
@ -242,7 +246,9 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/teams/new',
|
path: '/teams/new',
|
||||||
name: 'teams.create',
|
name: 'teams.create',
|
||||||
component: NewTeamComponent,
|
components: {
|
||||||
|
popup: NewTeamComponent,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/teams/:id/edit',
|
path: '/teams/:id/edit',
|
||||||
|
@ -257,7 +263,9 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/labels/new',
|
path: '/labels/new',
|
||||||
name: 'labels.create',
|
name: 'labels.create',
|
||||||
component: NewLabelComponent,
|
components: {
|
||||||
|
popup: NewLabelComponent,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/migrate',
|
path: '/migrate',
|
||||||
|
@ -272,7 +280,9 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/filters/new',
|
path: '/filters/new',
|
||||||
name: 'filters.create',
|
name: 'filters.create',
|
||||||
component: CreateSavedFilter,
|
components: {
|
||||||
|
popup: CreateSavedFilter,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/auth/openid/:provider',
|
path: '/auth/openid/:provider',
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
CURRENT_LIST,
|
CURRENT_LIST,
|
||||||
ERROR_MESSAGE,
|
ERROR_MESSAGE,
|
||||||
HAS_TASKS,
|
HAS_TASKS,
|
||||||
IS_FULLPAGE,
|
|
||||||
KEYBOARD_SHORTCUTS_ACTIVE,
|
KEYBOARD_SHORTCUTS_ACTIVE,
|
||||||
LOADING,
|
LOADING,
|
||||||
LOADING_MODULE,
|
LOADING_MODULE,
|
||||||
|
@ -39,7 +38,6 @@ export const store = new Vuex.Store({
|
||||||
loadingModule: null,
|
loadingModule: null,
|
||||||
errorMessage: '',
|
errorMessage: '',
|
||||||
online: true,
|
online: true,
|
||||||
isFullpage: false,
|
|
||||||
// This is used to highlight the current list in menu for all list related views
|
// This is used to highlight the current list in menu for all list related views
|
||||||
currentList: {id: 0},
|
currentList: {id: 0},
|
||||||
background: '',
|
background: '',
|
||||||
|
@ -60,9 +58,6 @@ export const store = new Vuex.Store({
|
||||||
[ONLINE](state, online) {
|
[ONLINE](state, online) {
|
||||||
state.online = online
|
state.online = online
|
||||||
},
|
},
|
||||||
[IS_FULLPAGE](state, fullpage) {
|
|
||||||
state.isFullpage = fullpage
|
|
||||||
},
|
|
||||||
[CURRENT_LIST](state, currentList) {
|
[CURRENT_LIST](state, currentList) {
|
||||||
|
|
||||||
setTitle(currentList.title)
|
setTitle(currentList.title)
|
||||||
|
|
|
@ -2,7 +2,6 @@ export const LOADING = 'loading'
|
||||||
export const LOADING_MODULE = 'loadingModule'
|
export const LOADING_MODULE = 'loadingModule'
|
||||||
export const ERROR_MESSAGE = 'errorMessage'
|
export const ERROR_MESSAGE = 'errorMessage'
|
||||||
export const ONLINE = 'online'
|
export const ONLINE = 'online'
|
||||||
export const IS_FULLPAGE = 'isFullpage'
|
|
||||||
export const CURRENT_LIST = 'currentList'
|
export const CURRENT_LIST = 'currentList'
|
||||||
export const HAS_TASKS = 'hasTasks'
|
export const HAS_TASKS = 'hasTasks'
|
||||||
export const MENU_ACTIVE = 'menuActive'
|
export const MENU_ACTIVE = 'menuActive'
|
||||||
|
|
|
@ -1,42 +1,46 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="fullpage">
|
<create
|
||||||
<a @click="back()" class="close">
|
title="Create a new label"
|
||||||
<icon :icon="['far', 'times-circle']"/>
|
@create="newLabel()"
|
||||||
</a>
|
:create-disabled="label.title === ''"
|
||||||
<h3>Create a new label</h3>
|
>
|
||||||
<form @keyup.esc="back()" @submit.prevent="newlabel">
|
<div class="field">
|
||||||
<div class="field is-grouped">
|
<label class="label" for="labelTitle">Label Title</label>
|
||||||
<p class="control is-expanded" v-bind:class="{ 'is-loading': labelService.loading }">
|
<div
|
||||||
<input
|
class="control is-expanded"
|
||||||
:class="{ 'disabled': labelService.loading }"
|
:class="{ 'is-loading': labelService.loading }"
|
||||||
class="input"
|
>
|
||||||
placeholder="The label title goes here..." type="text"
|
<input
|
||||||
v-focus
|
:class="{ disabled: labelService.loading }"
|
||||||
v-model="label.title"/>
|
class="input"
|
||||||
</p>
|
placeholder="The label title goes here..."
|
||||||
<p class="control">
|
type="text"
|
||||||
<x-button
|
id="labelTitle"
|
||||||
:shadow="false"
|
v-focus
|
||||||
icon="plus"
|
v-model="label.title"
|
||||||
@click="newlabel"
|
@keyup.enter="newLabel()"
|
||||||
>
|
/>
|
||||||
Add
|
|
||||||
</x-button>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="help is-danger" v-if="showError && label.title === ''">
|
</div>
|
||||||
Please specify a title.
|
<p class="help is-danger" v-if="showError && label.title === ''">
|
||||||
</p>
|
Please specify a title.
|
||||||
</form>
|
</p>
|
||||||
</div>
|
<div class="field">
|
||||||
|
<label class="label">Color</label>
|
||||||
|
<div class="control">
|
||||||
|
<color-picker v-model="label.hexColor" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</create>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import labelModel from '../../models/label'
|
import labelModel from '../../models/label'
|
||||||
import labelService from '../../services/label'
|
import labelService from '../../services/label'
|
||||||
import {IS_FULLPAGE} from '@/store/mutation-types'
|
|
||||||
import LabelModel from '../../models/label'
|
import LabelModel from '../../models/label'
|
||||||
import LabelService from '../../services/label'
|
import LabelService from '../../services/label'
|
||||||
|
import Create from '@/components/misc/create'
|
||||||
|
import ColorPicker from '../../components/input/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NewLabel',
|
name: 'NewLabel',
|
||||||
|
@ -47,35 +51,41 @@ export default {
|
||||||
showError: false,
|
showError: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
Create,
|
||||||
|
ColorPicker,
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.labelService = new LabelService()
|
this.labelService = new LabelService()
|
||||||
this.label = new LabelModel()
|
this.label = new LabelModel()
|
||||||
this.$store.commit(IS_FULLPAGE, true)
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setTitle('Create a new label')
|
this.setTitle('Create a new label')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
newlabel() {
|
newLabel() {
|
||||||
|
|
||||||
if (this.label.title === '') {
|
if (this.label.title === '') {
|
||||||
this.showError = true
|
this.showError = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.showError = false
|
this.showError = false
|
||||||
|
|
||||||
this.labelService.create(this.label)
|
this.labelService
|
||||||
.then(response => {
|
.create(this.label)
|
||||||
this.$router.push({name: 'labels.index', params: {id: response.id}})
|
.then((response) => {
|
||||||
this.success({message: 'The label was successfully created.'}, this)
|
this.$router.push({
|
||||||
|
name: 'labels.index',
|
||||||
|
params: { id: response.id },
|
||||||
|
})
|
||||||
|
this.success(
|
||||||
|
{ message: 'The label was successfully created.' },
|
||||||
|
this
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
back() {
|
|
||||||
this.$router.go(-1)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,44 +1,41 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="fullpage">
|
<create title="Create a new list" @create="newList()" :create-disabled="list.title === ''">
|
||||||
<a @click="back()" class="close">
|
<div class="field">
|
||||||
<icon :icon="['far', 'times-circle']">
|
<label class="label" for="listTitle">List Title</label>
|
||||||
</icon>
|
<div
|
||||||
</a>
|
:class="{ 'is-loading': listService.loading }"
|
||||||
<h3>Create a new list</h3>
|
class="control"
|
||||||
<div class="field is-grouped">
|
>
|
||||||
<p :class="{ 'is-loading': listService.loading}" class="control is-expanded">
|
|
||||||
<input
|
<input
|
||||||
:class="{ 'disabled': listService.loading}"
|
:class="{ disabled: listService.loading }"
|
||||||
@keyup.enter="newList()"
|
@keyup.enter="newList()"
|
||||||
@keyup.esc="back()"
|
@keyup.esc="$router.back()"
|
||||||
class="input"
|
class="input"
|
||||||
placeholder="The list's name goes here..."
|
placeholder="The list's title goes here..."
|
||||||
type="text"
|
type="text"
|
||||||
|
name="listTitle"
|
||||||
v-focus
|
v-focus
|
||||||
v-model="list.title"/>
|
v-model="list.title"
|
||||||
</p>
|
/>
|
||||||
<p class="control">
|
</div>
|
||||||
<x-button
|
|
||||||
:disabled="list.title === ''"
|
|
||||||
@click="newList()"
|
|
||||||
icon="plus"
|
|
||||||
:shadow="false"
|
|
||||||
>
|
|
||||||
Add
|
|
||||||
</x-button>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="help is-danger" v-if="showError && list.title === ''">
|
<p class="help is-danger" v-if="showError && list.title === ''">
|
||||||
Please specify a title.
|
Please specify a title.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
<div class="field">
|
||||||
|
<label class="label">Color</label>
|
||||||
|
<div class="control">
|
||||||
|
<color-picker v-model="list.hexColor" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</create>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import router from '../../router'
|
|
||||||
import ListService from '../../services/list'
|
import ListService from '../../services/list'
|
||||||
import ListModel from '../../models/list'
|
import ListModel from '../../models/list'
|
||||||
import {IS_FULLPAGE} from '@/store/mutation-types'
|
import Create from '@/components/misc/create'
|
||||||
|
import ColorPicker from '../../components/input/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NewList',
|
name: 'NewList',
|
||||||
|
@ -49,10 +46,13 @@ export default {
|
||||||
listService: ListService,
|
listService: ListService,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
Create,
|
||||||
|
ColorPicker,
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.list = new ListModel()
|
this.list = new ListModel()
|
||||||
this.listService = new ListService()
|
this.listService = new ListService()
|
||||||
this.$store.commit(IS_FULLPAGE, true)
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setTitle('Create a new list')
|
this.setTitle('Create a new list')
|
||||||
|
@ -66,18 +66,22 @@ export default {
|
||||||
this.showError = false
|
this.showError = false
|
||||||
|
|
||||||
this.list.namespaceId = this.$route.params.id
|
this.list.namespaceId = this.$route.params.id
|
||||||
this.$store.dispatch('lists/createList', this.list)
|
this.$store
|
||||||
.then(r => {
|
.dispatch('lists/createList', this.list)
|
||||||
this.success({message: 'The list was successfully created.'}, this)
|
.then((r) => {
|
||||||
router.push({name: 'list.index', params: {listId: r.id}})
|
this.success(
|
||||||
|
{ message: 'The list was successfully created.' },
|
||||||
|
this
|
||||||
|
)
|
||||||
|
this.$router.push({
|
||||||
|
name: 'list.index',
|
||||||
|
params: { listId: r.id },
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
back() {
|
|
||||||
router.go(-1)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -1,48 +1,52 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="fullpage">
|
<create
|
||||||
<a @click="back()" class="close">
|
title="Create a new namespace"
|
||||||
<icon :icon="['far', 'times-circle']">
|
@create="newNamespace()"
|
||||||
</icon>
|
:create-disabled="namespace.title === ''"
|
||||||
</a>
|
>
|
||||||
<h3>Create a new namespace</h3>
|
<div class="field">
|
||||||
<div class="field is-grouped">
|
<label class="label" for="namespaceTitle">Namespace Title</label>
|
||||||
<p class="control is-expanded" v-bind:class="{ 'is-loading': namespaceService.loading}">
|
<div
|
||||||
|
class="control is-expanded"
|
||||||
|
:class="{ 'is-loading': namespaceService.loading }"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
@keyup.enter="newNamespace()"
|
@keyup.enter="newNamespace()"
|
||||||
@keyup.esc="back()"
|
@keyup.esc="back()"
|
||||||
class="input"
|
class="input"
|
||||||
placeholder="The namespace's name goes here..."
|
placeholder="The namespace's name goes here..."
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ 'disabled': namespaceService.loading}"
|
:class="{ disabled: namespaceService.loading }"
|
||||||
v-focus
|
v-focus
|
||||||
v-model="namespace.title"/>
|
v-model="namespace.title"
|
||||||
</p>
|
/>
|
||||||
<p class="control">
|
</div>
|
||||||
<x-button
|
|
||||||
:disabled="namespace.title === ''"
|
|
||||||
@click="newNamespace()"
|
|
||||||
:shadow="false"
|
|
||||||
icon="plus"
|
|
||||||
>
|
|
||||||
Add
|
|
||||||
</x-button>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="help is-danger" v-if="showError && namespace.title === ''">
|
<p class="help is-danger" v-if="showError && namespace.title === ''">
|
||||||
Please specify a title.
|
Please specify a title.
|
||||||
</p>
|
</p>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">Color</label>
|
||||||
|
<div class="control">
|
||||||
|
<color-picker v-model="namespace.hexColor" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<p
|
<p
|
||||||
class="small"
|
class="is-small has-text-centered"
|
||||||
v-tooltip.bottom="'A namespace is a collection of lists you can share and use to organize your lists with. In fact, every list belongs to a namepace.'">
|
v-tooltip.bottom="
|
||||||
What's a namespace?</p>
|
'A namespace is a collection of lists you can share and use to organize your lists with. In fact, every list belongs to a namepace.'
|
||||||
</div>
|
"
|
||||||
|
>
|
||||||
|
What's a namespace?
|
||||||
|
</p>
|
||||||
|
</create>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import router from '../../router'
|
|
||||||
import NamespaceModel from '../../models/namespace'
|
import NamespaceModel from '../../models/namespace'
|
||||||
import NamespaceService from '../../services/namespace'
|
import NamespaceService from '../../services/namespace'
|
||||||
import {IS_FULLPAGE} from '@/store/mutation-types'
|
import Create from '@/components/misc/create'
|
||||||
|
import ColorPicker from '../../components/input/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NewNamespace',
|
name: 'NewNamespace',
|
||||||
|
@ -53,10 +57,13 @@ export default {
|
||||||
namespaceService: NamespaceService,
|
namespaceService: NamespaceService,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
ColorPicker,
|
||||||
|
Create,
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.namespace = new NamespaceModel()
|
this.namespace = new NamespaceModel()
|
||||||
this.namespaceService = new NamespaceService()
|
this.namespaceService = new NamespaceService()
|
||||||
this.$store.commit(IS_FULLPAGE, true)
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setTitle('Create a new namespace')
|
this.setTitle('Create a new namespace')
|
||||||
|
@ -69,19 +76,20 @@ export default {
|
||||||
}
|
}
|
||||||
this.showError = false
|
this.showError = false
|
||||||
|
|
||||||
this.namespaceService.create(this.namespace)
|
this.namespaceService
|
||||||
.then(r => {
|
.create(this.namespace)
|
||||||
|
.then((r) => {
|
||||||
this.$store.commit('namespaces/addNamespace', r)
|
this.$store.commit('namespaces/addNamespace', r)
|
||||||
this.success({message: 'The namespace was successfully created.'}, this)
|
this.success(
|
||||||
router.back()
|
{ message: 'The namespace was successfully created.' },
|
||||||
|
this
|
||||||
|
)
|
||||||
|
this.$router.back()
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
back() {
|
|
||||||
router.go(-1)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="fullpage">
|
<create
|
||||||
<a @click="back()" class="close">
|
title="Create a new team"
|
||||||
<icon :icon="['far', 'times-circle']">
|
@create="newTeam()"
|
||||||
</icon>
|
:create-disabled="team.name === ''"
|
||||||
</a>
|
>
|
||||||
<h3>Create a new team</h3>
|
<div class="field">
|
||||||
<form @keyup.esc="back()" @submit.prevent="newTeam">
|
<label class="label" for="teamName">Team Name</label>
|
||||||
<div class="field is-grouped">
|
<div
|
||||||
<p class="control is-expanded" v-bind:class="{ 'is-loading': teamService.loading}">
|
class="control is-expanded"
|
||||||
<input
|
:class="{ 'is-loading': teamService.loading }"
|
||||||
:class="{ 'disabled': teamService.loading}"
|
>
|
||||||
class="input"
|
<input
|
||||||
placeholder="The team's name goes here..." type="text"
|
:class="{ 'disabled': teamService.loading }"
|
||||||
v-focus
|
class="input"
|
||||||
v-model="team.name"/>
|
id="teamName"
|
||||||
</p>
|
placeholder="The team's name goes here..."
|
||||||
<p class="control">
|
type="text"
|
||||||
<x-button :shadow="false" @click="newTeam" icon="plus">
|
v-focus
|
||||||
Add
|
v-model="team.name"
|
||||||
</x-button>
|
@keyup.enter="newTeam"
|
||||||
</p>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p class="help is-danger" v-if="showError && team.name === ''">
|
</div>
|
||||||
Please specify a name.
|
<p class="help is-danger" v-if="showError && team.name === ''">
|
||||||
</p>
|
Please specify a name.
|
||||||
</form>
|
</p>
|
||||||
</div>
|
</create>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import TeamModel from '../../models/team'
|
import TeamModel from '../../models/team'
|
||||||
import TeamService from '../../services/team'
|
import TeamService from '../../services/team'
|
||||||
import {IS_FULLPAGE} from '@/store/mutation-types'
|
import Create from '@/components/misc/create'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NewTeam',
|
name: 'NewTeam',
|
||||||
|
@ -43,29 +43,37 @@ export default {
|
||||||
showError: false,
|
showError: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
Create,
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.teamService = new TeamService()
|
this.teamService = new TeamService()
|
||||||
this.team = new TeamModel()
|
this.team = new TeamModel()
|
||||||
this.$store.commit(IS_FULLPAGE, true)
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setTitle('Create a new Team')
|
this.setTitle('Create a new Team')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
newTeam() {
|
newTeam() {
|
||||||
|
|
||||||
if (this.team.name === '') {
|
if (this.team.name === '') {
|
||||||
this.showError = true
|
this.showError = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.showError = false
|
this.showError = false
|
||||||
|
|
||||||
this.teamService.create(this.team)
|
this.teamService
|
||||||
.then(response => {
|
.create(this.team)
|
||||||
router.push({name: 'teams.edit', params: {id: response.id}})
|
.then((response) => {
|
||||||
this.success({message: 'The team was successfully created.'}, this)
|
router.push({
|
||||||
|
name: 'teams.edit',
|
||||||
|
params: { id: response.id },
|
||||||
|
})
|
||||||
|
this.success(
|
||||||
|
{ message: 'The team was successfully created.' },
|
||||||
|
this
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue