Skip to content

Commit

Permalink
Fix #1599
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Aug 18, 2020
1 parent c5416fb commit 3411002
Show file tree
Hide file tree
Showing 20 changed files with 306 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ export default {
specimen: 'Specimen',
stage: 'Stage'
},
scale: 1,
style: {
viewer: {
position: 'relative',
Expand Down Expand Up @@ -240,7 +239,7 @@ export default {
let sledId = urlParams.get('sled_image_id')
if(imageId && /^\d+$/.test(imageId)) {
this.loadImage(imageId).then(response => {
this.loadSled(response.sled_image_id)
this.loadSled(response.sled_image_id)
})
}
if(sledId && /^\d+$/.test(sledId)) {
Expand Down Expand Up @@ -295,7 +294,7 @@ export default {
},
createImage(imageId) {
this.loadImage(imageId).then(response => {
this.loadSled(response.sled_image_id)
this.loadSled(response.sled_image_id)
})
},
processCells (cells) {
Expand All @@ -307,13 +306,9 @@ export default {
this.savePreferences()
this.$store.dispatch(ActionNames.UpdateSled).then(() => {
this.isSaving = false
if(load) {
if(Number.isInteger(id)) {
window.open(`/tasks/collection_objects/grid_digitize/index?sled_image_id=${id}`, '_self')
}
else {
window.open('/tasks/collection_objects/grid_digitize/index', '_self')
}
if (load) {
SetParam('/tasks/collection_objects/grid_digitize/index', 'sled_image_id', id)
this.$store.dispatch(ActionNames.ResetStore)
}
}, () => {
this.isSaving = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
</label>
</li>
</ul>
<smart-selector
class="margin-medium-top"
model="namespaces"
klass="CollectionObject"
pin-section="Namespaces"
pin-type="Namespace"
@selected="setValue"/>
<div class="align-start margin-medium-top">
<smart-selector
model="namespaces"
klass="CollectionObject"
pin-section="Namespaces"
pin-type="Namespace"
@selected="setValue"/>
<lock-component
class="margin-small-left"
v-model="lock.identifier"/>
</div>
<p
v-if="identifier.namespace_id"
class="middle">
Expand Down Expand Up @@ -55,8 +59,10 @@
import SmartSelector from 'components/smartSelector'
import { GetterNames } from '../../store/getters/getters'
import { MutationNames } from '../../store/mutations/mutations'
import SharedComponent from '../shared/lock.js'
export default {
mixins: [SharedComponent],
components: {
SmartSelector
},
Expand Down Expand Up @@ -111,11 +117,8 @@ export default {
]
}
},
created () {
this.resetIdentifier()
},
methods: {
setValue(value) {
setValue (value) {
this.identifier.namespace_id = value.id
this.identifier.label = value.name
},
Expand All @@ -130,7 +133,7 @@ export default {
identifier_object_type: 'CollectionObject'
}
},
removeNamespace() {
removeNamespace () {
this.identifier.namespace_id = undefined
this.identifier.label = undefined
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
<template>
<fieldset>
<legend>Collecting Event</legend>
<smart-selector
model="collecting_events"
klass="CollectingEvent"
pin-section="CollectingEvents"
pin-type="CollectingEvent"
@selected="setValue"/>
<p
v-if="collectingEvent"
class="middle">
<span
class="margin-small-right"
v-html="label"/>
<span
class="button-circle button-default btn-undo"
@click="removeCE"/>
</p>
<div class="align-start">
<smart-selector
model="collecting_events"
klass="CollectingEvent"
pin-section="CollectingEvents"
pin-type="CollectingEvent"
@selected="setValue"/>
<lock-component
class="margin-small-left"
v-model="lock.collecting_event_id"/>
</div>
<p
v-if="collectingEvent"
class="middle">
<span
class="margin-small-right"
v-html="label"/>
<span
class="button-circle button-default btn-undo"
@click="removeCE"/>
</p>
</fieldset>
</template>

Expand All @@ -25,8 +30,11 @@
import SmartSelector from 'components/smartSelector'
import { MutationNames } from '../../store/mutations/mutations'
import { GetterNames } from '../../store/getters/getters'
import { GetCollectingEvent } from '../../request/resource'
import SharedComponent from '../shared/lock.js'
export default {
mixins: [SharedComponent],
components: {
SmartSelector
},
Expand All @@ -52,6 +60,13 @@ export default {
collectingEvent: undefined
}
},
mounted () {
if (this.collectionObject.collecting_event_id) {
GetCollectingEvent(this.collectionObject.collecting_event_id).then(response => {
this.collectingEvent = response.body
})
}
},
methods: {
setValue(value) {
this.collectingEvent = value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<template>
<fieldset>
<legend>Note</legend>
<textarea
v-model="text"
class="full_width"
rows="5">
</textarea>
<div class="align-start">
<textarea
v-model="text"
class="full_width margin-small-right"
rows="5">
</textarea>
<lock-component
v-model="lock.notes_attributes"/>
</div>
<button
@click="addNote"
:disabled="!text"
Expand All @@ -25,8 +29,10 @@
import { GetterNames } from '../../store/getters/getters'
import { MutationNames } from '../../store/mutations/mutations'
import ListComponent from 'components/displayList'
import SharedComponent from '../shared/lock.js'
export default {
mixins: [SharedComponent],
components: {
ListComponent
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<div class="horizontal-left-content align-start">
<ul
v-for="itemsGroup in coTypes.chunk(Math.ceil(coTypes.length/2))"
class="no_bullets preparation-list">
<li v-for="type in itemsGroup">
class="no_bullets full_width">
<li
v-for="type in itemsGroup"
:key="type.id">
<label>
<input
type="radio"
Expand All @@ -17,43 +19,39 @@
</label>
</li>
</ul>
<lock-component v-model="lock.preparation_type_id"/>
</div>
</fieldset>
</template>

<script>
import { MutationNames } from '../../store/mutations/mutations.js'
import { GetterNames } from '../../store/getters/getters.js'
import { GetPreparationTypes } from '../../request/resource'
import { MutationNames } from '../../store/mutations/mutations.js'
import { GetterNames } from '../../store/getters/getters.js'
import { GetPreparationTypes } from '../../request/resource'
import SharedComponent from '../shared/lock.js'
export default {
computed: {
collectionObject: {
get() {
return this.$store.getters[GetterNames.GetCollectionObject]
},
set(value) {
this.$store.commit(MutationNames.SetCollectionObject, value)
}
export default {
mixins: [SharedComponent],
computed: {
collectionObject: {
get () {
return this.$store.getters[GetterNames.GetCollectionObject]
},
set (value) {
this.$store.commit(MutationNames.SetCollectionObject, value)
}
},
data () {
return {
coTypes: []
}
},
mounted() {
GetPreparationTypes().then(response => {
this.coTypes = response.body
})
}
},
data () {
return {
coTypes: []
}
},
mounted() {
GetPreparationTypes().then(response => {
this.coTypes = response.body
})
}
}
</script>

<style scoped>
.preparation-list {
width: 100%;
}
</style>

Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<template>
<fieldset>
<legend>Repository</legend>
<autocomplete
url="/repositories/autocomplete"
param="term"
placeholder="Search a repository"
label="label"
:clear-after="true"
@getItem="setRepository"/>
<p
v-if="label"
<div class="horizontal-left-content align-start">
<smart-selector
model="repositories"
klass="CollectionObject"
pin-section="Repositories"
pin-type="Repository"
@selected="setRepository"/>
<lock-component
class="margin-small-left"
v-model="lock.repository_id"/>
</div>
<p
v-if="repository"
class="horizontal-left-content middle">
<span v-html="label"/>
<span v-html="repository.name"/>
<span
class="circle-button btn-undo button-default"
@click="removeRepository"/>
Expand All @@ -23,34 +27,44 @@
import { MutationNames } from '../../store/mutations/mutations'
import { GetterNames } from '../../store/getters/getters'
import Autocomplete from 'components/autocomplete'
import { GetRepository } from '../../request/resource'
import SmartSelector from 'components/smartSelector'
import SharedComponent from '../shared/lock.js'
export default {
mixins: [SharedComponent],
components: {
Autocomplete
SmartSelector
},
computed: {
collectionObject: {
get () {
return this.$store.getters[GetterNames.GetCollectionObject]
},
set(newVal) {
set (value) {
this.$store.commit(MutationNames.SetCollectionObject, value)
}
}
},
data () {
return {
label: undefined
repository: undefined
}
},
mounted () {
if (this.collectionObject.repository_id) {
GetRepository(this.collectionObject.repository_id).then(response => {
this.setRepository(response.body)
})
}
},
methods: {
setRepository(repository) {
this.label = repository.label
setRepository (repository) {
this.repository = repository
this.collectionObject.repository_id = repository.id
},
removeRepository () {
this.label = undefined
this.repository_id = undefined
this.collectionObject.repository_id = undefined
}
}
Expand Down
Loading

0 comments on commit 3411002

Please sign in to comment.