Add option to remove color from label, task, namespace or list (#157)
Add reset to color picker Move all usages of verte to seperate component Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/157
This commit is contained in:
parent
f10eaf9b28
commit
e266c69acd
8 changed files with 87 additions and 50 deletions
59
src/components/global/colorPicker.vue
Normal file
59
src/components/global/colorPicker.vue
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<template>
|
||||||
|
<div class="color-picker-container">
|
||||||
|
<verte
|
||||||
|
v-model="color"
|
||||||
|
menuPosition="top"
|
||||||
|
picker="square"
|
||||||
|
model="hex"
|
||||||
|
:enableAlpha="false"
|
||||||
|
:rgbSliders="true"/>
|
||||||
|
<a @click="reset" class="reset">
|
||||||
|
Reset Color
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import verte from 'verte'
|
||||||
|
import 'verte/dist/verte.css'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'colorPicker',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
color: '',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
verte,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(newVal) {
|
||||||
|
this.color = newVal
|
||||||
|
},
|
||||||
|
color() {
|
||||||
|
this.update()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.color = this.value
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
update() {
|
||||||
|
this.$emit('input', this.color)
|
||||||
|
this.$emit('change')
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
// FIXME: I havn't found a way to make it clear to the user the color war reset.
|
||||||
|
// Not sure if verte is capable of this - it does not show the change when setting this.color = ''
|
||||||
|
this.color = ''
|
||||||
|
this.update()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -64,14 +64,7 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Color</label>
|
<label class="label">Color</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<verte
|
<color-picker v-model="labelEditLabel.hexColor"/>
|
||||||
v-model="labelEditLabel.hexColor"
|
|
||||||
menuPosition="top"
|
|
||||||
picker="square"
|
|
||||||
model="hex"
|
|
||||||
:enableAlpha="false"
|
|
||||||
:rgbSliders="true">
|
|
||||||
</verte>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
|
@ -100,17 +93,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import verte from 'verte'
|
|
||||||
import 'verte/dist/verte.css'
|
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
|
||||||
import LabelService from '../../services/label'
|
import LabelService from '../../services/label'
|
||||||
import LabelModel from '../../models/label'
|
import LabelModel from '../../models/label'
|
||||||
|
import ColorPicker from '../global/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ListLabels',
|
name: 'ListLabels',
|
||||||
components: {
|
components: {
|
||||||
verte,
|
ColorPicker,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -73,13 +73,7 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Color</label>
|
<label class="label">Color</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<verte
|
<color-picker v-model="list.hexColor"/>
|
||||||
v-model="list.hexColor"
|
|
||||||
menuPosition="top"
|
|
||||||
picker="square"
|
|
||||||
model="hex"
|
|
||||||
:enableAlpha="false"
|
|
||||||
:rgbSliders="true"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -133,9 +127,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import verte from 'verte'
|
|
||||||
import 'verte/dist/verte.css'
|
|
||||||
|
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import manageSharing from '../sharing/userTeam'
|
import manageSharing from '../sharing/userTeam'
|
||||||
import LinkSharing from '../sharing/linkSharing'
|
import LinkSharing from '../sharing/linkSharing'
|
||||||
|
@ -145,6 +136,7 @@
|
||||||
import Fancycheckbox from '../global/fancycheckbox'
|
import Fancycheckbox from '../global/fancycheckbox'
|
||||||
import Background from './settings/background'
|
import Background from './settings/background'
|
||||||
import {CURRENT_LIST} from '../../store/mutation-types'
|
import {CURRENT_LIST} from '../../store/mutation-types'
|
||||||
|
import ColorPicker from '../global/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EditList",
|
name: "EditList",
|
||||||
|
@ -160,11 +152,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
ColorPicker,
|
||||||
Background,
|
Background,
|
||||||
Fancycheckbox,
|
Fancycheckbox,
|
||||||
LinkSharing,
|
LinkSharing,
|
||||||
manageSharing,
|
manageSharing,
|
||||||
verte,
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.listService = new ListService()
|
this.listService = new ListService()
|
||||||
|
|
|
@ -52,13 +52,7 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Color</label>
|
<label class="label">Color</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<verte
|
<color-picker v-model="namespace.hexColor"/>
|
||||||
v-model="namespace.hexColor"
|
|
||||||
menuPosition="top"
|
|
||||||
picker="square"
|
|
||||||
model="hex"
|
|
||||||
:enableAlpha="false"
|
|
||||||
:rgbSliders="true"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -108,15 +102,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import verte from 'verte'
|
|
||||||
import 'verte/dist/verte.css'
|
|
||||||
|
|
||||||
import router from '../../router'
|
import router from '../../router'
|
||||||
import manageSharing from '../sharing/userTeam'
|
import manageSharing from '../sharing/userTeam'
|
||||||
|
|
||||||
import NamespaceService from '../../services/namespace'
|
import NamespaceService from '../../services/namespace'
|
||||||
import NamespaceModel from '../../models/namespace'
|
import NamespaceModel from '../../models/namespace'
|
||||||
import Fancycheckbox from '../global/fancycheckbox'
|
import Fancycheckbox from '../global/fancycheckbox'
|
||||||
|
import ColorPicker from '../global/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EditNamespace",
|
name: "EditNamespace",
|
||||||
|
@ -131,9 +123,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
ColorPicker,
|
||||||
Fancycheckbox,
|
Fancycheckbox,
|
||||||
manageSharing,
|
manageSharing,
|
||||||
verte,
|
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.namespace.id = this.$route.params.id
|
this.namespace.id = this.$route.params.id
|
||||||
|
|
|
@ -88,15 +88,7 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Color</label>
|
<label class="label">Color</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<verte
|
<color-picker v-model="taskEditTask.hexColor"/>
|
||||||
v-model="taskEditTask.hexColor"
|
|
||||||
menuPosition="top"
|
|
||||||
picker="square"
|
|
||||||
model="hex"
|
|
||||||
:enableAlpha="false"
|
|
||||||
:rgbSliders="true"
|
|
||||||
@change="editTaskSubmit()"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -142,8 +134,6 @@
|
||||||
<script>
|
<script>
|
||||||
import flatPickr from 'vue-flatpickr-component'
|
import flatPickr from 'vue-flatpickr-component'
|
||||||
import 'flatpickr/dist/flatpickr.css'
|
import 'flatpickr/dist/flatpickr.css'
|
||||||
import verte from 'verte'
|
|
||||||
import 'verte/dist/verte.css'
|
|
||||||
|
|
||||||
import ListService from '../../services/list'
|
import ListService from '../../services/list'
|
||||||
import TaskService from '../../services/task'
|
import TaskService from '../../services/task'
|
||||||
|
@ -156,6 +146,7 @@
|
||||||
import RelatedTasks from './reusable/relatedTasks'
|
import RelatedTasks from './reusable/relatedTasks'
|
||||||
import RepeatAfter from './reusable/repeatAfter'
|
import RepeatAfter from './reusable/repeatAfter'
|
||||||
import Reminders from './reusable/reminders'
|
import Reminders from './reusable/reminders'
|
||||||
|
import ColorPicker from '../global/colorPicker'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'edit-task',
|
name: 'edit-task',
|
||||||
|
@ -181,6 +172,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
ColorPicker,
|
||||||
Reminders,
|
Reminders,
|
||||||
RepeatAfter,
|
RepeatAfter,
|
||||||
RelatedTasks,
|
RelatedTasks,
|
||||||
|
@ -189,7 +181,6 @@
|
||||||
PercentDoneSelect,
|
PercentDoneSelect,
|
||||||
PrioritySelect,
|
PrioritySelect,
|
||||||
flatPickr,
|
flatPickr,
|
||||||
verte,
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
task: {
|
task: {
|
||||||
|
|
|
@ -17,3 +17,4 @@
|
||||||
@import 'kanban';
|
@import 'kanban';
|
||||||
@import 'modal';
|
@import 'modal';
|
||||||
@import 'list-backgrounds';
|
@import 'list-backgrounds';
|
||||||
|
@import 'color-picker';
|
||||||
|
|
15
src/styles/components/color-picker.scss
Normal file
15
src/styles/components/color-picker.scss
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
.color-picker-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.verte__guide {
|
||||||
|
border-radius: 100%;
|
||||||
|
border: 1px solid $grey-light;
|
||||||
|
box-shadow: $card-shadow;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.reset {
|
||||||
|
font-size: .9em;
|
||||||
|
padding-left: .5rem;
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,8 +61,3 @@ button.table {
|
||||||
.pagination {
|
.pagination {
|
||||||
padding-bottom: 1em;
|
padding-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.verte__guide {
|
|
||||||
border: 2px dashed $dark;
|
|
||||||
border-radius: 100%;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue