Skip to content

Commit

Permalink
Added key shortcut to lock everything #337
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Dec 13, 2018
1 parent 8987c80 commit 81e10d1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/javascript/vue/tasks/digitize/app.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div id="#vue-all-in-one">
<div
id="#vue-all-in-one"
v-shortkey="[getMacKey(), 'l']"
@shortkey="setLockAll">
<task-header/>
<collection-object class="separate-bottom"/>
<div class="horizontal-left-content align-start separate-top">
Expand Down Expand Up @@ -33,6 +36,14 @@
GetUserPreferences().then(response => {
this.$store.commit(MutationNames.SetPreferences, response)
})
},
methods: {
getMacKey() {
return (navigator.platform.indexOf('Mac') > -1 ? 'ctrl' : 'alt')
},
setLockAll() {
this.$store.commit(MutationNames.LockAll)
}
}
}
</script>
Expand Down
11 changes: 11 additions & 0 deletions app/javascript/vue/tasks/digitize/store/mutations/lockAll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function(state) {
state.settings.locked = {
biocuration: true,
collection_object: {
buffered_determinations: true,
buffered_collecting_event: true,
buffered_other_labels: true,
repository_id: true
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import setLocked from './setLocked'
import lockAll from './lockAll'

import setContainer from './Container/SetContainer'
import addContainerItem from './Container/AddContainerItem'
Expand Down Expand Up @@ -104,6 +105,7 @@ const MutationNames = {
RemoveTaxonDetermination: 'removeTaxonDetermination',

SetLocked: 'setLocked',
LockAll: 'lockAll',

SetContainer: 'setContainer',
AddContainerItem: 'addContainerItem',
Expand Down Expand Up @@ -206,6 +208,7 @@ const MutationNames = {

const MutationFunctions = {
[MutationNames.SetLocked]: setLocked,
[MutationNames.LockAll]: lockAll,

[MutationNames.SetContainer]: setContainer,
[MutationNames.AddContainerItem]: addContainerItem,
Expand Down

0 comments on commit 81e10d1

Please sign in to comment.