Skip to content

Commit

Permalink
Fix #2118
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Mar 12, 2021
1 parent 7650e19 commit f2760d7
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
- Georeferences coordinates in label generate on New collecting event [#2107]
- Lock buttons on New image [#2101]
- Open PDF slider in all tabs [#2106]
- Preparation type and with/out facets [#2118]

### Changed
- Nexus output file was modified to present full name of the of the taxon. TNT export was not changed.
Expand All @@ -24,6 +25,7 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
[#2106]: https://github.com/SpeciesFileGroup/taxonworks/issues/2101
[#2107]: https://github.com/SpeciesFileGroup/taxonworks/issues/2107
[#2112]: https://github.com/SpeciesFileGroup/taxonworks/issues/2112
[#2118]: https://github.com/SpeciesFileGroup/taxonworks/issues/2118

## [0.16.4] - 2020-03-09

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<identifier-component
class="margin-large-bottom"
v-model="params.identifier"/>
<preparation-types v-model="params.preparation_type_id"/>
<types-component
class="margin-large-bottom"
v-model="params.types"/>
Expand All @@ -72,7 +73,7 @@
class="margin-large-bottom"
v-for="(item, key) in params.byRecordsWith"
:key="key"
:title="key"
:title="key.replace('with_', '')"
:param="key"
v-model="params.byRecordsWith[key]"/>
</div>
Expand All @@ -94,6 +95,7 @@ import BiocurationsComponent from './filters/biocurations'
import RepositoryComponent from './filters/repository.vue'
import WithComponent from 'tasks/sources/filter/components/filters/with'
import BufferedComponent from './filters/buffered.vue'
import PreparationTypes from './filters/preparationTypes'
import { GetCollectionObjects, GetCODWCA } from '../request/resources.js'
import SpinnerComponent from 'components/spinner'
Expand All @@ -115,14 +117,15 @@ export default {
InRelationship,
BiocurationsComponent,
RepositoryComponent,
WithComponent
WithComponent,
PreparationTypes
},
computed: {
getMacKey () {
return GetMacKey()
},
parseParams () {
return Object.assign({}, this.params.settings, this.params.buffered.text, this.params.buffered.exact, this.params.byRecordsWith, this.params.biocurations, this.params.relationships, this.params.loans, this.params.types, this.params.determination, this.params.identifier, this.params.keywords, this.params.geographic, this.params.repository, this.flatObject(this.params.collectingEvents, 'fields'), this.filterEmptyParams(this.params.user))
return Object.assign({}, { preparation_type_id: this.params.preparation_type_id }, this.params.settings, this.params.buffered.text, this.params.buffered.exact, this.params.byRecordsWith, this.params.biocurations, this.params.relationships, this.params.loans, this.params.types, this.params.determination, this.params.identifier, this.params.keywords, this.params.geographic, this.params.repository, this.flatObject(this.params.collectingEvents, 'fields'), this.filterEmptyParams(this.params.user))
},
emptyParams () {
if (!this.params) return
Expand All @@ -139,6 +142,7 @@ export default {
!this.params.repository.repository_id &&
!this.params.collectingEvents.fields.length &&
!this.params.collectingEvents.collecting_event_ids.length &&
!this.params.preparation_type_id.length &&
Object.keys(this.params.collectingEvents.fields).length <= 1 &&
!Object.values(this.params.collectingEvents).find(item => item && item.length) &&
!Object.values(this.params.user).find(item => { return item !== undefined }) &&
Expand Down Expand Up @@ -215,15 +219,18 @@ export default {
biocuration_class_ids: []
},
byRecordsWith: {
collecting_events: undefined,
collecting_event: undefined,
depictions: undefined,
geographic_area: undefined,
georeference: undefined,
georeferences: undefined,
identifiers: undefined,
taxon_determinations: undefined,
type_material: undefined,
repository: undefined,
dwc_indexed: undefined
dwc_indexed: undefined,
with_buffered_collecting_event: undefined,
with_buffered_determinations: undefined,
with_buffered_other_labels: undefined
},
buffered: {
text: {
Expand All @@ -245,6 +252,7 @@ export default {
loaned: undefined,
never_loaned: undefined
},
preparation_type_id: [],
types: {
is_type: [],
type_type: []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<div>
<h3>Preparation</h3>
<div class="horizontal-left-content align-start">
<template v-for="(itemsGroup, index) in preparationTypes.chunk(Math.ceil(preparationTypes.length/2))">
<ul
class="no_bullets preparation-list"
:key="index">
<li
v-for="type in itemsGroup"
:key="type.id">
<label>
<input
type="checkbox"
:value="type.id"
v-model="selected"
name="collection-object-type">
{{ type.name }}
</label>
</li>
</ul>
</template>
</div>
</div>
</template>

<script>
import { GetPreparationTypes } from '../../request/resources'
import { URLParamsToJSON } from 'helpers/url/parse.js'
export default {
props: {
value: {
type: Array,
required: true
}
},
data () {
return {
preparationTypes: []
}
},
computed: {
selected: {
get () {
return this.value
},
set (value) {
this.$emit('input', value)
}
}
},
async created () {
this.preparationTypes = (await GetPreparationTypes()).body
this.selected = URLParamsToJSON(location.href).preparation_type_id || []
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const GetPerson = (id) => ajaxCall('get', `/people/${id}.json`)

const GetRepository = (id) => ajaxCall('get', `/repositories/${id}.json`)

const GetPreparationTypes = () => ajaxCall('get', '/preparation_types.json')

const GetTaxonName = (id) => ajaxCall('get', `/taxon_names/${id}.json`)

const GetTypes = () => ajaxCall('get', '/type_materials/type_types.json')
Expand All @@ -49,6 +51,7 @@ export {
GetNamespace,
GetOtu,
GetPerson,
GetPreparationTypes,
GetRepository,
GetTaxonName,
GetTypes,
Expand Down

0 comments on commit f2760d7

Please sign in to comment.