Add color picker to board edit mode

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-04-26 09:56:17 +02:00
parent b2d844c013
commit 74eb579474
2 changed files with 20 additions and 4 deletions

View File

@@ -74,6 +74,7 @@ export default {
display: block !important; display: block !important;
overflow: hidden; overflow: hidden;
border-radius: 3px; border-radius: 3px;
margin-bottom: 10px;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
@@ -101,7 +102,7 @@ export default {
border-radius: 0; border-radius: 0;
box-shadow: none; box-shadow: none;
background-color: transparent; background-color: transparent;
width: auto; width: 90%
} }
.vc-chrome { .vc-chrome {
@@ -118,9 +119,18 @@ export default {
.vc-compact-color-item { .vc-compact-color-item {
display: inline-flex; display: inline-flex;
height: $color-field-width; height: $color-field-width;
width: $color-field-width;
padding: 0; padding: 0;
margin: 0; margin: 0;
flex-grow: 1;
}
.vc-compact-dot {
width: 10px;
height: 10px;
position: unset;
border-radius: 50%;
opacity: 1;
background: #fff;
margin: auto;
} }
.vc-chrome-controls { .vc-chrome-controls {
display: flex; display: flex;

View File

@@ -57,6 +57,7 @@
<input type="submit" value="" class="icon-close" <input type="submit" value="" class="icon-close"
@click.stop.prevent="cancelEdit"> @click.stop.prevent="cancelEdit">
</form> </form>
<ColorPicker v-model="editColor" />
</div> </div>
</router-link> </router-link>
</template> </template>
@@ -64,10 +65,12 @@
<script> <script>
import { PopoverMenu } from 'nextcloud-vue' import { PopoverMenu } from 'nextcloud-vue'
import ClickOutside from 'vue-click-outside' import ClickOutside from 'vue-click-outside'
import ColorPicker from '../ColorPicker';
export default { export default {
name: 'AppNavigationBoard', name: 'AppNavigationBoard',
components: { components: {
ColorPicker,
PopoverMenu PopoverMenu
}, },
directives: { directives: {
@@ -87,7 +90,8 @@ export default {
editing: false, editing: false,
menuOpen: false, menuOpen: false,
undoTimeoutHandle: null, undoTimeoutHandle: null,
editTitle: '' editTitle: '',
editColor: '',
} }
}, },
computed: { computed: {
@@ -113,6 +117,7 @@ export default {
action: () => { action: () => {
this.hideMenu() this.hideMenu()
this.editTitle = this.board.title this.editTitle = this.board.title
this.editColor = '#' + this.board.color
this.editing = true this.editing = true
}, },
icon: 'icon-rename', icon: 'icon-rename',
@@ -194,10 +199,11 @@ export default {
}, },
applyEdit(e) { applyEdit(e) {
this.editing = false this.editing = false
if (this.editTitle) { if (this.editTitle || this.editColor) {
this.loading = true this.loading = true
const copy = JSON.parse(JSON.stringify(this.board)) const copy = JSON.parse(JSON.stringify(this.board))
copy.title = this.editTitle copy.title = this.editTitle
copy.color = (typeof this.editColor.hex !== 'undefined' ? this.editColor.hex : this.editColor).substring(1)
this.$store.dispatch('updateBoard', copy) this.$store.dispatch('updateBoard', copy)
.then(() => { .then(() => {
this.loading = false this.loading = false