diff --git a/.travis.yml b/.travis.yml index 960f1b4d7f..dcf796af97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ branches: only: - master - development - - /v\d+\.\d+\.\d+/ + - /v\d+\.\d+\.\d+(-.+)?/ env: global: - TEST_WORKERS=5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ffc97cb9b..1cbd7cde2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,76 @@ This project does not yet adheres to [Semantic Versioning](https://semv \- +## [0.12.7] - 2020-06-26 + +### Added +- Taxon name status and relationships soft validations display in Browse Nomenclature task +- Interface to select OTUs and create rows in Observation Matrices Dashboard task +- Autosave system in New Taxon Name task (refs [#649]) +- Etymology filter in Nomenclature Filter task (refs [#1549]) +- Added new shortcuts for Comprehensive Digitization, New Type Specimen, New Taxon Name and Browse Nomenclature tasks +- Classification section in New Taxon Name task +- Spec to test md5 of multi-line verbatim labels (refs [#1572]) +- Display classifications alongside relationships in Browse Nomenclature task +- Add children and add sibling buttons in New Taxon Name task (refs [#1503]) +- Link to create new serial on smart selector of New Source tast +- Semantic section coloration in Browse OTU task (refs [#1571]) +- Rank prediction in New Taxon Name task (refs [#1054]) + +### Changed +- Optimized recently used geographic area and sources search +- Improved part of speech and etymology soft validation messages +- Year suffix and pages are now also used when sorting citations in Browse Nomenclature task +- Replaced old geographic area smart selector with newer version +- Swapped 'Masculine' and 'Femenine' positions in New Taxon Name task (refs [#660]) +- Replaced uses of `find_each` with `each` (refs [#1548]) +- Refactored New Taxon Name front end code +- Display text of some taxon name relationships +- Autocomplete visible in all tabs of smart selector +- OTU autocomplete searches now also matches by common names (refs [#869]) +- Browse Taxa task renamed to Browse OTU +- Using unreleased closure_tree code from official repo to address deprecation warning messages +- "valid by default" no longer displayed when a relationship exists in New Taxon Name task (refs [#1525]) +- Improvements in BibTex and New Source task UI +- Improvements in role picker and smart selectors in Comprehensive Collection Object Form and New Source tasks +- Optimized some filters for some smart selectors (refs [#1534]) +- Smart selector for sources no longer ordered by name +- Some minor UI tweaks in some places +- Updated ruby gems + +### Fixed +- Recently used objects code on some models +- Collection Object Filter task not filternig by type material type ([#1551]) +- Forms not being cleared when pressing `new` on Compose Biological Relationships task ([#1563]) +- Not getting the full list of topics when clicking all in `Radial annotator -> Citation -> Topic` ([#1566]) +- Showing name instead of the short name in `Radial Annotator -> Identifiers -> Preview` ([#1567]) +- `create` button keeps disabled when creating a new citation fails in `Radial annotator -> Citation` ([#1568]) +- Incorrect method call in Match Georeference task view +- Display of misspellings on taxon name relationships +- Femenine and neuter names ending in '-or' not being accepted ([#1575]) +- Spinner not disabled when entering malformed URIs in Manage Controlled Vocabulary task form ([#1561]) +- "--None--" results obscuring buttons until clicking off the record ([#1558]) + +[#649]: https://github.com/SpeciesFileGroup/taxonworks/issues/649 +[#660]: https://github.com/SpeciesFileGroup/taxonworks/issues/660 +[#869]: https://github.com/SpeciesFileGroup/taxonworks/issues/869 +[#1054]: https://github.com/SpeciesFileGroup/taxonworks/issues/1054 +[#1503]: https://github.com/SpeciesFileGroup/taxonworks/issues/1503 +[#1525]: https://github.com/SpeciesFileGroup/taxonworks/issues/1525 +[#1534]: https://github.com/SpeciesFileGroup/taxonworks/issues/1534 +[#1548]: https://github.com/SpeciesFileGroup/taxonworks/issues/1548 +[#1549]: https://github.com/SpeciesFileGroup/taxonworks/issues/1549 +[#1551]: https://github.com/SpeciesFileGroup/taxonworks/issues/1551 +[#1558]: https://github.com/SpeciesFileGroup/taxonworks/issues/1558 +[#1561]: https://github.com/SpeciesFileGroup/taxonworks/issues/1561 +[#1563]: https://github.com/SpeciesFileGroup/taxonworks/issues/1563 +[#1566]: https://github.com/SpeciesFileGroup/taxonworks/issues/1566 +[#1567]: https://github.com/SpeciesFileGroup/taxonworks/issues/1567 +[#1568]: https://github.com/SpeciesFileGroup/taxonworks/issues/1568 +[#1571]: https://github.com/SpeciesFileGroup/taxonworks/issues/1571 +[#1572]: https://github.com/SpeciesFileGroup/taxonworks/issues/1572 +[#1575]: https://github.com/SpeciesFileGroup/taxonworks/issues/1575 + ## [0.12.6] - 2020-06-12 ### Added - CHANGELOG.md @@ -67,7 +137,8 @@ This project does not yet adheres to [Semantic Versioning](https://semv [#1532]: https://github.com/SpeciesFileGroup/taxonworks/issues/1532 -[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.5...development +[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.7...development +[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 [0.12.4]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.12.3...v0.12.4 diff --git a/Gemfile b/Gemfile index bac324d324..38ec208040 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,8 @@ gem 'exception_notification', '~> 4.4' # Models gem 'bcrypt', '~> 3.1.11' -gem 'closure_tree', '~> 7.0' +gem 'closure_tree', github: 'ClosureTree/closure_tree', ref: '15b253e' # '~> 7.0' + gem 'delayed_job_active_record', '~> 4.1.3' gem 'validates_timeliness', '~> 4.1', '>= 4.1.1' gem 'paper_trail', '~> 10.3', '>= 10.3.1' diff --git a/Gemfile.lock b/Gemfile.lock index 61b36bbff2..f90fced725 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: https://github.com/ClosureTree/closure_tree.git + revision: 15b253eab350321ac83668ab2228276eea450db8 + ref: 15b253e + specs: + closure_tree (7.1.0) + activerecord (>= 4.2.10) + with_advisory_lock (>= 4.0.0) + GIT remote: https://github.com/james2m/seedbank revision: 58d19b0c5c2afd139b3d395f2a516dd399eef57b @@ -9,59 +18,59 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (1.0.3) - actioncable (6.0.3.1) - actionpack (= 6.0.3.1) + actioncable (6.0.3.2) + actionpack (= 6.0.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3.1) - actionpack (= 6.0.3.1) - activejob (= 6.0.3.1) - activerecord (= 6.0.3.1) - activestorage (= 6.0.3.1) - activesupport (= 6.0.3.1) + actionmailbox (6.0.3.2) + actionpack (= 6.0.3.2) + activejob (= 6.0.3.2) + activerecord (= 6.0.3.2) + activestorage (= 6.0.3.2) + activesupport (= 6.0.3.2) mail (>= 2.7.1) - actionmailer (6.0.3.1) - actionpack (= 6.0.3.1) - actionview (= 6.0.3.1) - activejob (= 6.0.3.1) + actionmailer (6.0.3.2) + actionpack (= 6.0.3.2) + actionview (= 6.0.3.2) + activejob (= 6.0.3.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3.1) - actionview (= 6.0.3.1) - activesupport (= 6.0.3.1) + actionpack (6.0.3.2) + actionview (= 6.0.3.2) + activesupport (= 6.0.3.2) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.3.1) - actionpack (= 6.0.3.1) - activerecord (= 6.0.3.1) - activestorage (= 6.0.3.1) - activesupport (= 6.0.3.1) + actiontext (6.0.3.2) + actionpack (= 6.0.3.2) + activerecord (= 6.0.3.2) + activestorage (= 6.0.3.2) + activesupport (= 6.0.3.2) nokogiri (>= 1.8.5) - actionview (6.0.3.1) - activesupport (= 6.0.3.1) + actionview (6.0.3.2) + activesupport (= 6.0.3.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.3.1) - activesupport (= 6.0.3.1) + activejob (6.0.3.2) + activesupport (= 6.0.3.2) globalid (>= 0.3.6) - activemodel (6.0.3.1) - activesupport (= 6.0.3.1) - activerecord (6.0.3.1) - activemodel (= 6.0.3.1) - activesupport (= 6.0.3.1) + activemodel (6.0.3.2) + activesupport (= 6.0.3.2) + activerecord (6.0.3.2) + activemodel (= 6.0.3.2) + activesupport (= 6.0.3.2) activerecord-postgis-adapter (6.0.0) activerecord (~> 6.0) rgeo-activerecord (~> 6.0) - activestorage (6.0.3.1) - actionpack (= 6.0.3.1) - activejob (= 6.0.3.1) - activerecord (= 6.0.3.1) + activestorage (6.0.3.2) + actionpack (= 6.0.3.2) + activejob (= 6.0.3.2) + activerecord (= 6.0.3.2) marcel (~> 0.3.1) - activesupport (6.0.3.1) + activesupport (6.0.3.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -74,7 +83,7 @@ GEM afm (0.2.2) archive-zip (0.12.0) io-like (~> 0.3.0) - ast (2.4.0) + ast (2.4.1) awesome_print (1.8.0) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -98,7 +107,7 @@ GEM brakeman (4.8.2) builder (3.2.4) byebug (11.1.3) - capybara (3.32.2) + capybara (3.33.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -116,9 +125,6 @@ GEM citeproc (~> 1.0, >= 1.0.9) csl (~> 1.5) climate_control (0.2.0) - closure_tree (7.1.0) - activerecord (>= 4.2.10) - with_advisory_lock (>= 4.0.0) coderay (1.1.3) concurrent-ruby (1.1.6) coveralls (0.8.23) @@ -142,7 +148,7 @@ GEM delayed_job_active_record (4.1.4) activerecord (>= 3.0, < 6.1) delayed_job (>= 3.0, < 5) - diff-lcs (1.3) + diff-lcs (1.4.2) docile (1.3.2) dropzonejs-rails (0.8.4) rails (> 3.1) @@ -151,23 +157,23 @@ GEM parsley-store (~> 0.3) erubi (1.9.0) etc (1.1.0) - exception_notification (4.4.0) + exception_notification (4.4.1) actionmailer (>= 4.0, < 7) activesupport (>= 4.0, < 7) - excon (0.73.0) + excon (0.75.0) execjs (2.7.0) factory_bot (5.2.0) activesupport (>= 4.2.0) factory_bot_rails (5.2.0) factory_bot (~> 5.2.0) railties (>= 4.2.0) - faker (2.12.0) + faker (2.13.0) i18n (>= 1.6, < 2) faraday (0.17.3) multipart-post (>= 1.2, < 3) faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) - ffi (1.13.0) + ffi (1.13.1) ffi-geos (2.1.0) ffi (>= 1.0.0) formatador (0.2.5) @@ -248,10 +254,10 @@ GEM parslet logical_query_parser (0.3.1) treetop (~> 1.6.8) - loofah (2.5.0) + loofah (2.6.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.2.5) + lumberjack (1.2.6) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) @@ -288,11 +294,11 @@ GEM terrapin (~> 0.6.0) paperclip-meta (3.1.0) paperclip (>= 5.0) - parallel (1.19.1) - parallel_tests (2.32.0) + parallel (1.19.2) + parallel_tests (3.0.0) parallel - parser (2.7.1.3) - ast (~> 2.4.0) + parser (2.7.1.4) + ast (~> 2.4.1) parslet (2.0.0) parsley-store (0.3.4) passenger (6.0.5) @@ -318,32 +324,32 @@ GEM method_source (~> 1.0) psych (3.1.0) public_suffix (4.0.5) - rack (2.2.2) + rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) rack-proxy (0.6.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.3.1) - actioncable (= 6.0.3.1) - actionmailbox (= 6.0.3.1) - actionmailer (= 6.0.3.1) - actionpack (= 6.0.3.1) - actiontext (= 6.0.3.1) - actionview (= 6.0.3.1) - activejob (= 6.0.3.1) - activemodel (= 6.0.3.1) - activerecord (= 6.0.3.1) - activestorage (= 6.0.3.1) - activesupport (= 6.0.3.1) + rails (6.0.3.2) + actioncable (= 6.0.3.2) + actionmailbox (= 6.0.3.2) + actionmailer (= 6.0.3.2) + actionpack (= 6.0.3.2) + actiontext (= 6.0.3.2) + actionview (= 6.0.3.2) + activejob (= 6.0.3.2) + activemodel (= 6.0.3.2) + activerecord (= 6.0.3.2) + activestorage (= 6.0.3.2) + activesupport (= 6.0.3.2) bundler (>= 1.3.0) - railties (= 6.0.3.1) + railties (= 6.0.3.2) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -351,9 +357,9 @@ GEM loofah (~> 2.3) rails-jquery-autocomplete (1.0.5) rails (>= 3.2) - railties (6.0.3.1) - actionpack (= 6.0.3.1) - activesupport (= 6.0.3.1) + railties (6.0.3.2) + actionpack (= 6.0.3.2) + activesupport (= 6.0.3.2) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -362,13 +368,13 @@ GEM rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - rdf (3.1.2) + rdf (3.1.3) hamster (~> 3.0) link_header (~> 0.0, >= 0.0.8) rdoc (6.2.1) redcarpet (3.5.0) redis (4.1.4) - regexp_parser (1.7.0) + regexp_parser (1.7.1) request_store (1.5.0) rack (>= 1.4) require_all (3.0.0) @@ -413,24 +419,24 @@ GEM rspec-support (3.9.3) rtesseract (3.0.5) nokogiri - rubocop (0.85.0) + rubocop (0.86.0) parallel (~> 1.10) parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.7) rexml - rubocop-ast (>= 0.0.3) + rubocop-ast (>= 0.0.3, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) rubocop-ast (0.0.3) parser (>= 2.7.0.1) rubocop-faker (0.2.0) rubocop (>= 0.74) - rubocop-rails (2.5.2) - activesupport + rubocop-rails (2.6.0) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.72.0) - rubocop-rspec (1.39.0) + rubocop (>= 0.82.0) + rubocop-rspec (1.40.0) rubocop (>= 0.68.1) ruby-prof (1.4.1) ruby-progressbar (1.10.1) @@ -517,7 +523,7 @@ GEM rack (>= 1.4, < 3.0) waxy (0.1.0) tilt (~> 2.0.9) - web-console (4.0.2) + web-console (4.0.3) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -566,7 +572,7 @@ DEPENDENCIES chronic (~> 0.10.2) chunky_png (~> 1.3.11) citeproc-ruby (~> 1.1.10) - closure_tree (~> 7.0) + closure_tree! coveralls (~> 0.8.22) csl (~> 1.5.0) csl-styles (~> 1.0.1.8) diff --git a/app/assets/images/create_child_icon.svg b/app/assets/images/create_child_icon.svg new file mode 100644 index 0000000000..e95da1fb62 --- /dev/null +++ b/app/assets/images/create_child_icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/app/assets/images/create_sister_icon.svg b/app/assets/images/create_sister_icon.svg new file mode 100644 index 0000000000..3028e08577 --- /dev/null +++ b/app/assets/images/create_sister_icon.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff --git a/app/assets/javascripts/views/tasks/nomenclature/browse.js b/app/assets/javascripts/views/tasks/nomenclature/browse.js index bfc814e6b4..50cc62d6a6 100644 --- a/app/assets/javascripts/views/tasks/nomenclature/browse.js +++ b/app/assets/javascripts/views/tasks/nomenclature/browse.js @@ -53,6 +53,19 @@ Object.assign(TW.views.tasks.nomenclature.browse, { window.open('/tasks/nomenclature/new_taxon_name?taxon_name_id=' + taxonId, '_self'); } }); + if (/^\d+$/.test(taxonId)) { + TW.workbench.keyboard.createShortcut((navigator.platform.indexOf('Mac') > -1 ? 'ctrl' : 'alt') + "+m", "New type specimen", "Browse nomenclature", function () { + window.open('/tasks/nomenclature/new_taxon_name?taxon_name_id=' + taxonId, '_self'); + }); + + TW.workbench.keyboard.createShortcut((navigator.platform.indexOf('Mac') > -1 ? 'ctrl' : 'alt') + "+c", "Comprehensive specimen digitization", "Browse nomenclature", function () { + window.open('/tasks/accessions/comprehensive?taxon_name_id=' + taxonId, '_self'); + }); + + TW.workbench.keyboard.createShortcut((navigator.platform.indexOf('Mac') > -1 ? 'ctrl' : 'alt') + "+o", "Browse OTU", "Browse nomenclature", function () { + window.open('/tasks/otus/browse?taxon_name_id=' + taxonId, '_self'); + }); + } } $('.filter .open').on('click', function () { diff --git a/app/assets/stylesheets/base/buttons.scss b/app/assets/stylesheets/base/buttons.scss index a32e08481c..2a76a16e8e 100644 --- a/app/assets/stylesheets/base/buttons.scss +++ b/app/assets/stylesheets/base/buttons.scss @@ -207,6 +207,12 @@ background-image: image-url("w_hexagon.svg"); } +.btn-hexagon-arrow-flip-w { + background-size: 16px; + transform: scaleX(-1); + background-image: image-url("hexagon_empty_w.svg"); +} + .btn-hexagon-empty-w { background-size: 16px; background-image: image-url("hexagon_empty_w.svg"); @@ -253,6 +259,16 @@ background-image: image-url('removefromproject.svg'); } +.btn-create-child { + background-size: 14px, 14px; + background-image: image-url('create_child_icon.svg'); +} + +.btn-create-sister { + background-size: 14px, 16px; + background-image: image-url('create_sister_icon.svg'); +} + .circle-button-big { width: 30px; height: 30px; diff --git a/app/assets/stylesheets/base/lists.scss b/app/assets/stylesheets/base/lists.scss index a22fe0cd2b..8a5b174bfe 100644 --- a/app/assets/stylesheets/base/lists.scss +++ b/app/assets/stylesheets/base/lists.scss @@ -73,3 +73,38 @@ .red { color: red; } + + +ul.tree, ul.tree ul { + list-style: none; + margin: 0; + padding: 0; + } + ul.tree ul { + margin-left: 10px; + } + ul.tree li { + margin: 0; + padding: 0 7px; + line-height: 20px; + color: #369; + border-left:1px solid rgb(100,100,100); + + } + ul.tree li:last-child { + border-left:none; + } + ul.tree li:before { + position:relative; + top:-0.3em; + height:1em; + width:12px; + color:white; + border-bottom:1px solid rgb(100,100,100); + content:""; + display:inline-block; + left:-7px; + } + ul.tree li:last-child:before { + border-left:1px solid rgb(100,100,100); + } \ No newline at end of file diff --git a/app/assets/stylesheets/base/navigation.scss b/app/assets/stylesheets/base/navigation.scss index af462e2cd0..d855cc7efe 100644 --- a/app/assets/stylesheets/base/navigation.scss +++ b/app/assets/stylesheets/base/navigation.scss @@ -269,3 +269,27 @@ a, .link { align-items: center; } } + +.overflow-auto { + overflow: auto; +} + +.overflow-x-auto { + overflow-x: auto; +} + +.overflow-y-auto { + overflow-y: auto; +} + +.overflow-scroll { + overflow: scroll; +} + +.overflow-x-scroll { + overflow-x: scroll; +} + +.overflow-y-scroll { + overflow-y: scroll; +} \ No newline at end of file diff --git a/app/assets/stylesheets/base/panels.scss b/app/assets/stylesheets/base/panels.scss index 2018e41f9e..2b64ad5d2a 100644 --- a/app/assets/stylesheets/base/panels.scss +++ b/app/assets/stylesheets/base/panels.scss @@ -18,15 +18,13 @@ a { text-decoration: none; } + h3 { padding: $standard_padding*.2 0; margin: $standard_padding*.2 0; display: flex; flex-direction: row; } - h2 { - border-bottom: 1px solid $navigation_border; - } .subtitle { display: flex; diff --git a/app/assets/stylesheets/vendor/vue/vue-autocomplete.scss b/app/assets/stylesheets/vendor/vue/vue-autocomplete.scss index 979b00dcd8..5a525ca501 100644 --- a/app/assets/stylesheets/vendor/vue/vue-autocomplete.scss +++ b/app/assets/stylesheets/vendor/vue/vue-autocomplete.scss @@ -13,6 +13,7 @@ background-size: 18px; background-position: right 4px center; background-repeat: no-repeat; + width: 100%; } .vue-autocomplete-input-search { @@ -54,3 +55,7 @@ .vue-autocomplete ul:hover { display: block; } + +.vue-autocomplete-empty-list { + min-width: auto !important; +} \ No newline at end of file diff --git a/app/controllers/collection_objects_controller.rb b/app/controllers/collection_objects_controller.rb index 142976f1f2..9a4ca0634b 100644 --- a/app/controllers/collection_objects_controller.rb +++ b/app/controllers/collection_objects_controller.rb @@ -385,6 +385,7 @@ def filter_params :user_target, :validity, :wkt, + is_type: [], otu_ids: [], keyword_ids: [], collecting_event_ids: [], diff --git a/app/controllers/serials_controller.rb b/app/controllers/serials_controller.rb index 68eddead4b..ac87011118 100644 --- a/app/controllers/serials_controller.rb +++ b/app/controllers/serials_controller.rb @@ -6,11 +6,28 @@ class SerialsController < ApplicationController # GET /serials # GET /serials.json + def index - @recent_objects = Serial.order(updated_at: :desc).limit(10) - render '/shared/data/all/index' + respond_to do |format| + format.html do + @recent_objects = Serial.order(updated_at: :desc).limit(10) + render '/shared/data/all/index' + end + format.json { + #@serials = Serial.order(updated_at: :desc).limit(10) + @serials = Queries::Serial::Filter.new(filter_params).all.page(params[:page]).per(params[:per] || 500) + } + end end + def filter_params + params.permit( + :name, :id, + data_attributes_attributes: [ :id, :_destroy, :controlled_vocabulary_term_id, :type, :attribute_subject_id, :attribute_subject_type, :value ] + ) + end + + def list @serials = Serial.order(:id).page(params[:page]) end diff --git a/app/controllers/taxon_name_relationships_controller.rb b/app/controllers/taxon_name_relationships_controller.rb index b4a552d1ca..5604b39dab 100644 --- a/app/controllers/taxon_name_relationships_controller.rb +++ b/app/controllers/taxon_name_relationships_controller.rb @@ -122,7 +122,7 @@ def taxon_name_relationship_params end def filter_sql - h = params.permit(:taxon_name_id, :as_object, :as_subject, of_type: []).to_h.symbolize_keys + h = params.permit(:taxon_name_id, :as_object, :as_subject, of_types: []).to_h.symbolize_keys Queries::TaxonNameRelationshipsFilterQuery.new(**h).where_sql end diff --git a/app/controllers/taxon_names_controller.rb b/app/controllers/taxon_names_controller.rb index b77cedc1a6..ce2734ff78 100644 --- a/app/controllers/taxon_names_controller.rb +++ b/app/controllers/taxon_names_controller.rb @@ -127,6 +127,19 @@ def ranks render json: RANKS_JSON.to_json end + def predicted_rank + if params[:parent_id] + p = TaxonName.find_by(id: params[:parent_id]) + if p.nil? + render json: {predicted_rank: ''}.to_json + else + render json: {predicted_rank: p.predicted_child_rank(params[:name]).to_s}.to_json + end + else + render json: {predicted_rank: ''}.to_json + end + end + def random redirect_to browse_nomenclature_task_path( taxon_name_id: TaxonName.where(project_id: sessions_current_project_id).order('random()').limit(1).pluck(:id).first @@ -281,6 +294,7 @@ def filter_params :nomenclature_group, # !! different than autocomplete :nomenclature_code, :taxon_name_type, + :etymology, type: [], taxon_name_id: [], parent_id: [], diff --git a/app/javascript/vue/components/autocomplete.vue b/app/javascript/vue/components/autocomplete.vue index 6380ecc6a1..b766968670 100644 --- a/app/javascript/vue/components/autocomplete.vue +++ b/app/javascript/vue/components/autocomplete.vue @@ -58,7 +58,9 @@ Parameters:
  • Results may be truncated
  • -