Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Feb 3, 2020
2 parents 8f38bf4 + aaaa31f commit ed1bd30
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/shared/quick_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Object.assign(TW.views.shared.quick_bar, {
$('body').append("<div class='button-collapse-header'></div>");
}

Mousetrap.bind('alt+ctrl+h', function(e) {
Mousetrap.bind((navigator.platform.indexOf('Mac') > -1 ? 'ctrl' : 'alt')+ '+h', function(e) {
window.location = "/hub";
});

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/workbench/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Object.assign(TW.workbench.keyboard, {
</thead> \
<tbody data-shortcut-section="General shortcuts"> \
<tr> \
<td><div class="key">alt+ctrl+h</div></td> \
<td><div class="key">'+ (navigator.platform.indexOf('Mac') > -1 ? 'ctrl' : 'alt') +'+h</div></td> \
<td>Go to hub</td> \
</tr> \
<tr> \
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/base/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}

// see navigation_emphasis in palette
a {
a, .link {
transition: background-color 0.4s ease,
color 0.4s ease;
color: $color-secondary-2-4;
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/vue/components/defaultTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
animation="scale"
placement="bottom"
size="small"
arrow-size="small"
:inertia="true"
:arrow="true"
:content="`<p>Create tag: ${getDefaultElement().firstChild.firstChild.textContent}.${showCount ? `<br>Used already on ${countTag} ${countTag > 200 ? 'or more' : '' } objects</p>` : ''}`">
Expand All @@ -22,7 +21,6 @@
animation="scale"
placement="bottom"
size="small"
arrow-size="small"
:inertia="true"
:arrow="true"
:content="`<p>Remove tag: ${getDefaultElement().firstChild.firstChild.textContent}.${showCount ? `<br>Used already on ${countTag} ${countTag > 200 ? 'or more' : '' } objects</p>` : ''}`">
Expand Down
40 changes: 36 additions & 4 deletions app/javascript/vue/tasks/digitize/components/taskHeader/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
label="label_html"
param="term"
:clear-after="true"
@getItem="loadAssessionCode"
@getItem="loadAssessionCode($event.id)"
min="1"/>
<template>
<a
Expand All @@ -19,14 +19,31 @@
v-html="collectionObject.object_tag"/>
<span v-else>New record</span>
</template>
<div v-if="collectionObject.id">
<ul class="context-menu">
<li>
<span
v-if="navigation.previous"
@click="loadAssessionCode(navigation.previous)"
class="link cursor-pointer">Previous</span>
<span v-else>Previous</span>
</li>
<li>
<span
v-if="navigation.next"
@click="loadAssessionCode(navigation.next)"
class="link cursor-pointer">Next</span>
<span v-else>Next</span>
</li>
</ul>
</div>
</div>
<div class="horizontal-left-content">
<tippy-component
v-if="hasChanges"
animation="scale"
placement="bottom"
size="small"
arrow-size="small"
:inertia="true"
:arrow="true"
:content="`<p>You have unsaved changes.</p>`">
Expand Down Expand Up @@ -73,6 +90,7 @@
import GetMacKey from 'helpers/getMacKey.js'
import { TippyComponent } from 'vue-tippy'
import NavBar from 'components/navBar'
import AjaxCall from 'helpers/ajaxCall'
export default {
components: {
Expand Down Expand Up @@ -103,10 +121,24 @@
return this.settings.lastChange > this.settings.lastSave
}
},
data () {
return {
navigation: {
next: undefined,
previous: undefined
}
}
},
watch: {
collectionObject: {
handler(newVal) {
this.settings.lastChange = Date.now()
if(newVal.id) {
AjaxCall('get', `/metadata/object_navigation/${encodeURIComponent(newVal.global_id)}`).then(response => {
this.navigation.next = response.headers.map['navigation-next']
this.navigation.previous = response.headers.map['navigation-previous']
})
}
},
deep: true
},
Expand Down Expand Up @@ -144,9 +176,9 @@
this.$store.commit(MutationNames.SetTaxonDeterminations, [])
})
},
loadAssessionCode(object) {
loadAssessionCode(id) {
this.$store.dispatch(ActionNames.ResetWithDefault)
this.$store.dispatch(ActionNames.LoadDigitalization, object.id)
this.$store.dispatch(ActionNames.LoadDigitalization, id)
},
loadCollectionObject(co) {
this.resetStore()
Expand Down
10 changes: 9 additions & 1 deletion app/javascript/vue/tasks/loan/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@
},
mounted: function () {
let that = this
let loanId = location.pathname.split('/')[4]
let id = location.pathname.split('/')[4]
let urlParams = new URLSearchParams(window.location.search)
let loanId = urlParams.get('loan_id')
if (/^\d+$/.test(loanId)) {
that.$store.dispatch(ActionNames.LoadLoan, loanId).then(response => {
}, () => {
window.location.href = '/tasks/loans/edit_loan/'
})
} else if (/^\d+$/.test(id)) {
that.$store.dispatch(ActionNames.LoadLoan, id).then(response => {
}, () => {
window.location.href = '/tasks/loans/edit_loan/'
})
}
}
}
Expand Down
18 changes: 7 additions & 11 deletions app/javascript/vue/tasks/loan/components/dateDetermination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
</div>
<div class="field">
<label>OTU</label>
<autocomplete
min="2"
placeholder="Select an OTU"
label="label"
@getItem="determination.otu_id = $event.id"
url="/otus/autocomplete"
param="term"/>
<otu-picker
:clear-after="true"
@getItem="determination.otu_id = $event.id"/>
</div>
<div class="field">
<label>Date made</label>
Expand Down Expand Up @@ -54,12 +50,12 @@
import { createTaxonDetermination } from '../request/resources'
import { MutationNames } from '../store/mutations/mutations'
import autocomplete from 'components/autocomplete.vue'
import rolePicker from 'components/role_picker.vue'
import OtuPicker from 'components/otu/otu_picker/otu_picker'
export default {
components: {
autocomplete,
OtuPicker,
rolePicker
},
props: {
Expand All @@ -80,7 +76,7 @@ export default {
return []
},
set (value) {
determination.roles_attributes
this.determination.roles_attributes
}
}
},
Expand Down Expand Up @@ -109,7 +105,7 @@ export default {
})
Promise.all(promises).then(() => {
this.$store.commit(MutationNames.SetSaving, false)
TW.workbench.alert.create('Loan item was successfully created.', 'notice')
TW.workbench.alert.create('Loan item was successfully updated.', 'notice')
})
}
}
Expand Down
8 changes: 7 additions & 1 deletion app/javascript/vue/tasks/loan/components/displayList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<th>Collection object status</th>
<th>Total</th>
<th>Pin</th>
<th>Radial</th>
<th>Delete</th>
</tr>
</thead>
Expand Down Expand Up @@ -67,6 +68,9 @@
:object-id="item.loan_item_object_id"
:type="item.loan_item_object_type"/>
</td>
<td>
<radial-annotator :global-id="item.global_id"/>
</td>
<td>
<span
class="circle-button btn-delete"
Expand All @@ -89,12 +93,14 @@
import Spinner from 'components/spinner.vue'
import Expand from './expand.vue'
import PinComponent from 'components/pin.vue'
import RadialAnnotator from 'components/annotator/annotator'
export default {
components: {
Spinner,
Expand,
PinComponent
PinComponent,
RadialAnnotator
},
computed: {
list() {
Expand Down

0 comments on commit ed1bd30

Please sign in to comment.