Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Jun 29, 2020
2 parents ff26059 + a2f6d43 commit 3381034
Show file tree
Hide file tree
Showing 86 changed files with 537 additions and 213 deletions.
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

\-

## [0.12.8] - 2020-06-29

### Added
- Set autofocus on source and geographic area in OTU radial asserted distribution form
- `/otus/123/coordinate.json` endpoint - all OTUs coordinate with this one (refs [#1585])
- Autosave on new asserted distribution task

### Changed
- Unauthorized json response
- Better error handle for vue-autocomplete
- Replaced old method to handle ajax call in all tasks
- Updated relationships filter param on new taxon name task (refs [#1584])
- ControlledVocabularyTerm model no longer requires SKOS with URI (refs [#1562], [#1561])
- Improved sorting of objects in the Browse Nomenclatue task
- Updated dwc-archive gem to version 1.1.1

### Fixed
- Topic `select_optimized` controller method crash
- Recent list of biological associations not working due to the use of incorrect table

[#1561]: https://github.com/SpeciesFileGroup/taxonworks/issues/1561
[#1562]: https://github.com/SpeciesFileGroup/taxonworks/issues/1562
[#1584]: https://github.com/SpeciesFileGroup/taxonworks/issues/1584
[#1585]: https://github.com/SpeciesFileGroup/taxonworks/issues/1585

## [0.12.7] - 2020-06-26

### Added
Expand Down Expand Up @@ -137,7 +162,8 @@ 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.12.7...development
[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.8...development
[0.12.8]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.7...v0.12.8
[0.12.7]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.6...v0.12.7
[0.12.6]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.5...v0.12.6
[0.12.5]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.4...v0.12.5
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ gem 'rgb'
# "Bio" and SFG gems
gem 'taxonifi', '~> 0.5.5'
gem 'sqed', '0.5.8'
gem 'dwc-archive', '~> 1.0.1'
gem 'dwc-archive', '~> 1.1.1'
gem 'biodiversity', '~> 4.0', '>= 4.0.3'
gem 'ruby-units', '~> 2.3.0', require: 'ruby_units/namespaced'

Expand Down
9 changes: 4 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ GEM
docile (1.3.2)
dropzonejs-rails (0.8.4)
rails (> 3.1)
dwc-archive (1.0.1)
nokogiri (~> 1.8)
parsley-store (~> 0.3)
dwc-archive (1.1.1)
biodiversity (~> 4)
nokogiri (~> 1.10)
erubi (1.9.0)
etc (1.1.0)
exception_notification (4.4.1)
Expand Down Expand Up @@ -300,7 +300,6 @@ GEM
parser (2.7.1.4)
ast (~> 2.4.1)
parslet (2.0.0)
parsley-store (0.3.4)
passenger (6.0.5)
etc
rack
Expand Down Expand Up @@ -580,7 +579,7 @@ DEPENDENCIES
database_cleaner (~> 1.8)
delayed_job_active_record (~> 4.1.3)
dropzonejs-rails (~> 0.8.1)
dwc-archive (~> 1.0.1)
dwc-archive (~> 1.1.1)
exception_notification (~> 4.4)
execjs (~> 2.7.0)
factory_bot_rails (~> 5.1, >= 5.1.1)
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/asserted_distributions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def set_asserted_distribution

def asserted_distribution_params
params.require(:asserted_distribution).permit(
:otu_id, :geographic_area_id,
:otu_id,
:geographic_area_id,
:is_absent,
otu_attributes: [:id, :_destroy, :name, :taxon_name_id],
origin_citation_attributes: [:id, :_destroy, :source_id, :pages],
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/otus_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class OtusController < ApplicationController
include DataControllerConfiguration::ProjectDataControllerConfiguration

before_action :set_otu, only: [:show, :edit, :update, :destroy, :collection_objects, :navigation, :breadcrumbs, :timeline]
before_action :set_otu, only: [:show, :edit, :update, :destroy, :collection_objects, :navigation, :breadcrumbs, :timeline, :coordinate]
after_action -> { set_pagination_headers(:otus) }, only: [:index], if: :json_request?

# GET /otus
Expand Down Expand Up @@ -45,6 +45,12 @@ def timeline
def navigation
end

# GET /otus/1/coordinate.json
def coordinate
@otus = Otu.coordinate_otus(@otu.id)
render :index
end

# GET /otus/1/navigation.json
def breadcrumbs
render json: :not_found and return if @otu.nil?
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/taxon_name_relationships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class TaxonNameRelationshipsController < ApplicationController
include DataControllerConfiguration::ProjectDataControllerConfiguration

before_action :set_taxon_name_relationship, only: [:show, :edit, :update, :destroy]
after_action -> { set_pagination_headers(:taxon_name_relationships) }, only: [:index], if: :json_request?

# GET /taxon_name_relationships
# GET /taxon_name_relationships.json
Expand All @@ -13,8 +14,7 @@ def index
render '/shared/data/all/index'
end
format.json {
@taxon_name_relationships = TaxonNameRelationship.where(filter_sql)
.with_project_id(sessions_current_project_id)
@taxon_name_relationships = Queries::TaxonNameRelationship::Filter.new(filter_params).all.page(params[:page]).per(params[:per] || 500)
}
end
end
Expand Down Expand Up @@ -121,9 +121,13 @@ def taxon_name_relationship_params
)
end

def filter_sql
h = params.permit(:taxon_name_id, :as_object, :as_subject, of_types: []).to_h.symbolize_keys
Queries::TaxonNameRelationshipsFilterQuery.new(**h).where_sql
def filter_params
params.permit(
:taxon_name_id,
:as_object, :as_subject,
taxon_name_relationship_type: [],
taxon_name_relationship_set: []
).to_h.symbolize_keys.merge(project_id: sessions_current_project_id)
end

end
2 changes: 1 addition & 1 deletion app/helpers/workbench/sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def require_sign_in_and_project_selection
unless (sessions_signed_in? or @api_request) && sessions_project_selected?
respond_to do |format|
format.html { redirect_to root_url, notice: 'Whoa there, sign in and select a project first.' }
format.json { render(json: {success: false}, status: :unauthorized) && return } # TODO: bad request, not unauthorized
format.json { render json: { error: 'Whoa there, sign in and select a project first.' }, status: :unauthorized } # TODO: bad request, not unauthorized
end
end
end
Expand Down
14 changes: 9 additions & 5 deletions app/javascript/vue/components/autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ Parameters:
</template>

<script>
import AjaxCall from 'helpers/ajaxCall'
export default {
data: function () {
return {
Expand Down Expand Up @@ -330,9 +333,8 @@ export default {
this.searchEnd = true
this.showList = (this.json.length > 0)
} else {
this.$http.get(this.ajaxUrl(), {
before (request) {
AjaxCall('get', this.ajaxUrl(), {
before: (request) => {
if(Object.keys(this.headers).length) {
request.headers.map = this.headers
}
Expand All @@ -341,8 +343,7 @@ export default {
}
this.previousRequest = request
}}).then(response => {
this.json = this.getNested(response.body, this.nested)
this.json = this.getNested(response.body, this.nested)
this.showList = (this.json.length > 0)
this.spinner = false
this.searchEnd = true
Expand All @@ -360,6 +361,9 @@ export default {
},
activeSpinner: function () {
return 'ui-autocomplete-loading'
},
setFocus () {
this.$refs.autofocus.focus()
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions app/javascript/vue/components/defaultCitation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

<script>
import { TippyComponent } from 'vue-tippy'
import AjaxCall from 'helpers/ajaxCall'
export default {
components: {
Expand Down Expand Up @@ -79,7 +80,7 @@ export default {
annotated_global_entity: this.globalId
}
}
this.$http.post('/citations', citationItem).then(response => {
AjaxCall('post', '/citations', citationItem).then(response => {
this.citationItem = response.body
this.created = true
TW.workbench.alert.create('Citation item was successfully created.', 'notice')
Expand All @@ -92,7 +93,7 @@ export default {
annotated_global_entity: this.globalId,
_destroy: true
}
this.$http.delete(`/citations/${this.citationItem.id}`, { citation: citation }).then(response => {
AjaxCall('delete', `/citations/${this.citationItem.id}`, { citation: citation }).then(response => {
this.created = false
TW.workbench.alert.create('Citation item was successfully destroyed.', 'notice')
})
Expand Down
9 changes: 5 additions & 4 deletions app/javascript/vue/components/defaultConfidence.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<script>
import { TippyComponent } from 'vue-tippy'
import AjaxCall from 'helpers/ajaxCall'
export default {
components: {
Expand Down Expand Up @@ -102,7 +103,7 @@ export default {
global_id: this.globalId,
confidence_level_id: this.keyId
}
this.$http.get('/confidences/exists', { params: params }).then(response => {
AjaxCall('get', '/confidences/exists', { params: params }).then(response => {
if(response.body) {
this.created = true
this.confidenceItem = response.body
Expand All @@ -118,7 +119,7 @@ export default {
confidence_level_id: [this.keyId],
per: 100
}
this.$http.get('/confidences', { params: params }).then(response => {
AjaxCall('get', '/confidences', { params: params }).then(response => {
this.confidenceCount = response.body.length
})
},
Expand All @@ -129,7 +130,7 @@ export default {
annotated_global_entity: this.globalId
}
}
this.$http.post('/confidences', ConfidenceItem).then(response => {
AjaxCall('post', '/confidences', ConfidenceItem).then(response => {
this.confidenceItem = response.body
this.created = true
TW.workbench.alert.create('Confidence item was successfully created.', 'notice')
Expand All @@ -140,7 +141,7 @@ export default {
annotated_global_entity: this.globalId,
_destroy: true
}
this.$http.delete(`/confidences/${this.confidenceItem.id}`, { confidence: confidence }).then(response => {
AjaxCall('delete', `/confidences/${this.confidenceItem.id}`, { confidence: confidence }).then(response => {
this.created = false
TW.workbench.alert.create('Confidence item was successfully destroyed.', 'notice')
})
Expand Down
9 changes: 5 additions & 4 deletions app/javascript/vue/components/defaultTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

<script>
import { TippyComponent } from 'vue-tippy'
import AjaxCall from 'helpers/ajaxCall'
export default {
components: {
Expand Down Expand Up @@ -101,7 +102,7 @@ export default {
global_id: this.globalId,
keyword_id: this.keyId
}
this.$http.get('/tags/exists', { params: params }).then(response => {
AjaxCall('get', '/tags/exists', { params: params }).then(response => {
if (response.body) {
this.created = true
} else {
Expand All @@ -115,7 +116,7 @@ export default {
keyword_id: [this.keyId],
per: 100
}
this.$http.get('/tags', { params: params }).then(response => {
AjaxCall('get', '/tags', { params: params }).then(response => {
this.countTag = response.body.length
})
},
Expand All @@ -126,7 +127,7 @@ export default {
annotated_global_entity: this.globalId
}
}
this.$http.post('/tags', tagItem).then(response => {
AjaxCall('post', '/tags', tagItem).then(response => {
this.tagItem = response.body
this.created = true
TW.workbench.alert.create('Tag item was successfully created.', 'notice')
Expand All @@ -137,7 +138,7 @@ export default {
annotated_global_entity: this.globalId,
_destroy: true
}
this.$http.delete(`/tags/${this.tagItem.id}`, { tag: tag }).then(response => {
AjaxCall('delete', `/tags/${this.tagItem.id}`, { tag: tag }).then(response => {
this.created = false
TW.workbench.alert.create('Tag item was successfully destroyed.', 'notice')
})
Expand Down
24 changes: 12 additions & 12 deletions app/javascript/vue/components/georeferences/georeferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import DisplayList from './list'
import convertDMS from 'helpers/parseDMS.js'
import ManuallyComponent from './manuallyComponent'
import GeolocateComponent from './geolocateComponent'
import AjaxCall from 'helpers/ajaxCall'
export default {
components: {
Expand Down Expand Up @@ -157,7 +158,7 @@ export default {
}
this.showSpinner = true
this.$http.patch(`/georeferences/${shape.id}.json`, { georeference: georeference }).then(response => {
AjaxCall('patch', `/georeferences/${shape.id}.json`, { georeference: georeference }).then(response => {
this.showSpinner = false
this.$emit('updated', response.body)
this.getGeoreferences()
Expand All @@ -176,7 +177,7 @@ export default {
}
}
this.showSpinner = true
this.$http.post('/georeferences.json', data).then(response => {
AjaxCall('post', '/georeferences.json', data).then(response => {
this.showSpinner = false
if(response.body.error_radius) {
response.body.geo_json.properties.radius = response.body.error_radius
Expand All @@ -201,7 +202,7 @@ export default {
this.showSpinner = true
this.$http.patch(`/georeferences/${georeference.id}.json`, { georeference: georeference }).then(response => {
AjaxCall('patch', `/georeferences/${georeference.id}.json`, { georeference: georeference }).then(response => {
const index = this.georeferences.findIndex(geo => { return geo.id == response.body.id })
this.showSpinner = false
this.georeferences[index] = response.body
Expand All @@ -212,7 +213,7 @@ export default {
},
getGeoreferences() {
this.$http.get(`/georeferences.json?collecting_event_id=${this.collectingEventId}`).then(response => {
AjaxCall('get', `/georeferences.json?collecting_event_id=${this.collectingEventId}`).then(response => {
this.georeferences = response.body
this.populateShapes()
this.$emit('onGeoreferences', this.georeferences)
Expand All @@ -231,7 +232,7 @@ export default {
})
},
removeGeoreference(geo) {
this.$http.delete(`/georeferences/${geo.id}.json`).then(() => {
AjaxCall('delete', `/georeferences/${geo.id}.json`).then(() => {
this.georeferences.splice(this.georeferences.findIndex((item => {
return item.id === geo.id
})), 1)
Expand All @@ -256,7 +257,7 @@ export default {
}
}
this.showSpinner = true
this.$http.post('/georeferences.json', data).then(response => {
AjaxCall('post', '/georeferences.json', data).then(response => {
this.showSpinner = false
this.georeferences.push(response.body)
this.populateShapes()
Expand All @@ -267,13 +268,12 @@ export default {
})
},
createGEOLocate(iframe_data) {
this.showSpinner = true
this.$http.post('/georeferences.json', { georeference: {
iframe_response: iframe_data,
collecting_event_id: this.collectingEventId,
type: 'Georeference::GeoLocate'
}}).then(response => {
AjaxCall('post', '/georeferences.json', { georeference: {
iframe_response: iframe_data,
collecting_event_id: this.collectingEventId,
type: 'Georeference::GeoLocate'
}}).then(response => {
this.showSpinner = false
this.georeferences.push(response.body)
this.populateShapes()
Expand Down
Loading

0 comments on commit 3381034

Please sign in to comment.