Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Aug 7, 2023
2 parents f7afd08 + ab1de36 commit 73ac2f2
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 203 deletions.
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

\-

## [0.34.1] - 2023-08-07

### Fixed

- Missing organization tab in Owner panel on New image task
- BibTeX download shows incorrect results on New source task [#3510]
- Asserted distribution API endpoint crashing when count is above 50

[#3510]: https://github.com/SpeciesFileGroup/taxonworks/issues/3510

## [0.34.0] - 2023-08-04

### Added
Expand Down Expand Up @@ -3733,8 +3743,9 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

[#1532]: https://github.com/SpeciesFileGroup/taxonworks/issues/1532

[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.34.0...development
[0.34.0]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.34.0...v0.33.1
[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.34.1...development
[0.34.1]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.34.0...v0.34.1
[0.34.0]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.31.1...v0.34.0
[0.33.1]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.33.0...v0.33.1
[0.33.0]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.32.3...v0.33.0
[0.32.3]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.32.2...v0.32.3
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/asserted_distributions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def api_index
.per(params[:per])

if @asserted_distributions.all.count > 50
params['extend'].delete('geo_json')
params['extend']&.delete('geo_json')
end

render '/asserted_distributions/api/v1/index'
Expand Down
72 changes: 35 additions & 37 deletions app/javascript/vue/components/Filter/Facets/shared/FacetTags.vue
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
<template>
<FacetContainer>
<h3>Tags</h3>
<fieldset>
<legend>Keywords</legend>
<smart-selector
ref="smartSelectorRef"
autocomplete-url="/controlled_vocabulary_terms/autocomplete"
:autocomplete-params="{ 'type[]': 'Keyword' }"
get-url="/controlled_vocabulary_terms/"
model="keywords"
klass="Tags"
pin-section="Keywords"
pin-type="Keyword"
:add-tabs="['all']"
:target="target"
@selected="addKeyword"
>
<template #all>
<VModal @close="smartSelectorRef.setTab('quick')">
<template #header>
<h3>Tags - all</h3>
</template>
<template #body>
<VBtn
v-for="item in allFiltered"
:key="item.id"
class="margin-small-bottom margin-small-right"
color="primary"
pill
@click="addKeyword(item)"
>
{{ item.name }}
</VBtn>
</template>
</VModal>
</template>
</smart-selector>
</fieldset>

<SmartSelector
ref="smartSelectorRef"
autocomplete-url="/controlled_vocabulary_terms/autocomplete"
:autocomplete-params="{ 'type[]': 'Keyword' }"
get-url="/controlled_vocabulary_terms/"
model="keywords"
klass="Tags"
pin-section="Keywords"
pin-type="Keyword"
:add-tabs="['all']"
:target="target"
@selected="addKeyword"
>
<template #all>
<VModal @close="smartSelectorRef.setTab('quick')">
<template #header>
<h3>Tags - all</h3>
</template>
<template #body>
<VBtn
v-for="item in allFiltered"
:key="item.id"
class="margin-small-bottom margin-small-right"
color="primary"
pill
@click="addKeyword(item)"
>
{{ item.name }}
</VBtn>
</template>
</VModal>
</template>
</SmartSelector>
<table
v-if="keywords.length"
class="vue-table"
Expand All @@ -56,7 +54,7 @@
v-for="(item, index) in keywords"
:key="index"
>
<row-item
<RowItem
class="list-complete-item"
:item="item"
label="object_tag"
Expand Down
28 changes: 15 additions & 13 deletions app/javascript/vue/components/role_picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,46 @@
@get-input="setInput"
@get-item="addCreatedPerson"
/>
<default-pin
class="button-circle"
<DefaultPin
type="People"
@get-item="addCreatedPerson({ object_id: $event.id })"
section="People"
@get-item="addCreatedPerson({ object_id: $event.id })"
/>
</div>
<div
class="flex-wrap-column separate-left"
v-if="searchPerson.length > 0"
>
<div>
<div class="flexbox gap-xsmall">
<input
class="normal-input"
disabled
:value="newNamePerson"
/>
<button
<VBtn
type="button"
class="normal-input button button-submit"
color="create"
medium
@click="createPerson()"
>
Add new
</button>
<button
</VBtn>
<VBtn
type="button"
class="normal-input button button-default"
color="primary"
medium
@click="switchName(newNamePerson)"
>
Switch
</button>
<button
</VBtn>
<VBtn
type="button"
class="normal-input button button-default"
color="primary"
medium
@click="expandPerson = !expandPerson"
>
Expand
</button>
</VBtn>
</div>
<hr />
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,14 @@ export default {
},
methods: {
getNames(list) {
return list.map((item) => {
if (item.hasOwnProperty('cached')) {
return item.cached
} else if (item.hasOwnProperty('person_attributes')) {
return `${item.person_attributes?.last_name}, ${item.person_attributes?.first_name}`
} else {
return `${item.last_name}, ${item.first_name}`
}
})
return list.map(
(item) =>
item.cached ||
(item.person_attributes &&
`${item.person_attributes?.last_name}, ${item.person_attributes?.first_name}`) ||
item.name ||
`${item.last_name}, ${item.first_name}`
)
},
applyAttr() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,9 @@
v-model="view"
/>
<RolePicker
v-if="view === OPTIONS.People"
v-model="rolesAttributes"
:role-type="ROLE_ATTRIBUTION_COPYRIGHT_HOLDER"
/>
<VAutocomplete
v-else
placeholder="Select an organization"
url="/organizations/autocomplete"
param="term"
@get-item="setOrganization"
label="label_html"
:organization="view === OPTIONS.Organization"
/>
</div>
<div class="field label-above">
Expand All @@ -40,7 +32,6 @@
import BlockLayout from '@/components/layout/BlockLayout.vue'
import VSwitch from '@/components/switch'
import RolePicker from '@/components/role_picker'
import VAutocomplete from '@/components/ui/Autocomplete'
import { ROLE_ATTRIBUTION_COPYRIGHT_HOLDER } from '@/constants'
import { GetterNames } from '../../store/getters/getters.js'
import { MutationNames } from '../../store/mutations/mutations.js'
Expand Down Expand Up @@ -69,14 +60,4 @@ const year = computed({
})
const view = ref('Someone else')
function setOrganization(organization) {
rolesAttributes.value = [
{
type: ROLE_ATTRIBUTION_COPYRIGHT_HOLDER,
label: organization.label,
organization_id: organization.id
}
]
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
v-model="owners"
:role-type="ROLE_ATTRIBUTION_OWNER"
title="Owner"
organization
/>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,34 @@
<h3>{{ title }}</h3>
</template>
<template #body>
<RolePicker
v-model="rolesAttributes"
:role-type="roleType"
/>
<div class="margin-large-bottom">
<VSwitch
v-if="organization"
class="separate-bottom"
full-width
:options="Object.values(OPTIONS)"
v-model="view"
/>
<RolePicker
v-model="rolesAttributes"
:role-type="roleType"
:organization="view === OPTIONS.Organization"
/>
</div>
</template>
</BlockLayout>
</template>

<script setup>
import { ref, watch } from 'vue'
import { ref, computed } from 'vue'
import BlockLayout from '@/components/layout/BlockLayout.vue'
import RolePicker from '@/components/role_picker'
import VSwitch from '@/components/switch.vue'
const OPTIONS = {
People: 'Someone else',
Organization: 'An organization'
}
const props = defineProps({
title: {
Expand All @@ -31,26 +47,20 @@ const props = defineProps({
modelValue: {
type: Array,
required: true
},
organization: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['update:modelValue'])
const rolesAttributes = ref([])
const view = ref(OPTIONS.People)
watch(
rolesAttributes,
(newVal) => {
emit('update:modelValue', newVal)
},
{ deep: true }
)
watch(
props.modelValue,
(newVal) => {
rolesAttributes.value = newVal
},
{ deep: true }
)
const rolesAttributes = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default ({ state, commit }) => {
license: state.license,
attribution_object_type: item.base_class,
attribution_object_id: item.id,
roles_attributes: roles
roles_attributes: attributionRoles
}

const attributionCreated = state.attributionsCreated.find(
Expand All @@ -67,8 +67,11 @@ export default ({ state, commit }) => {
const createdRolesList = getRoleList(attributionCreated)
const newRoles = attributionRoles.filter(
(item) =>
!createdRolesList.find(
(role) => !!item?.person_id && role.person.id === item.person_id
!createdRolesList.some(
(role) =>
(!!item?.person_id && role.person?.id === item?.person_id) ||
(role.organization &&
role.organization.id === item.organization_id)
)
)

Expand Down
Loading

0 comments on commit 73ac2f2

Please sign in to comment.