diff --git a/Gemfile b/Gemfile index 0e7367e834..641f523bff 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'rswag-api' gem 'rswag-ui' # CSS framework -gem "bootstrap", ">= 4.6.2" +gem "bootstrap", ">= 5.0.0" gem 'material-sass', '4.1.1' # Icons used by bootstrap/material-sass diff --git a/Gemfile.lock b/Gemfile.lock index 92149b2548..f1339a28ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -120,7 +120,7 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.4.7.0) + autoprefixer-rails (10.4.16.0) execjs (~> 2) axe-core-api (4.8.2) dumb_delegator @@ -154,15 +154,14 @@ GEM bonsai-elasticsearch-rails (7.0.1) elasticsearch-model (< 8) elasticsearch-rails (< 8) - bootstrap (4.6.2) + bootstrap (5.3.2) autoprefixer-rails (>= 9.1.0) - popper_js (>= 1.16.1, < 2) - sassc-rails (>= 2.0.0) + popper_js (>= 2.11.8, < 3) bootstrap-datepicker-rails (1.9.0.1) railties (>= 3.0) - bootstrap_form (4.5.0) - actionpack (>= 5.2) - activemodel (>= 5.2) + bootstrap_form (5.4.0) + actionpack (>= 6.1) + activemodel (>= 6.1) builder (3.2.4) bullet (7.1.6) activesupport (>= 3.0.0) @@ -253,7 +252,7 @@ GEM erubi (1.12.0) erubis (2.7.0) excon (0.109.0) - execjs (2.8.1) + execjs (2.9.1) factory_bot (6.4.5) activesupport (>= 5.0.0) factory_bot_rails (6.4.3) @@ -439,7 +438,7 @@ GEM heroics (~> 0.1.1) moneta (~> 1.0.0) rate_throttle_client (~> 0.1.0) - popper_js (1.16.1) + popper_js (2.11.8) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -698,7 +697,7 @@ DEPENDENCIES better_errors bluecloth bonsai-elasticsearch-rails - bootstrap (>= 4.6.2) + bootstrap (>= 5.0.0) bootstrap-datepicker-rails bootstrap_form (>= 4.5.0) bullet diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 253c02f55f..15dfe1b24f 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -18,6 +18,17 @@ // = require jquery-ui/widgets/autocomplete // = require bootstrap-sprockets // = require bootstrap-datepicker -// = require bootstrap // = require material // = require_tree . + +document.addEventListener('DOMContentLoaded', function(event) { + var popoverTrigger = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')); + popoverTrigger.map(function(popoverTrigger2) { + return new bootstrap.Popover(popoverTrigger2); + }); + + var tooltipTrigger = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); + tooltipTrigger.map(function(tooltipTrigger2) { + return new bootstrap.Tooltip(tooltipTrigger2); + }); + }); diff --git a/app/assets/javascripts/bootstrap-accessibility.min.js b/app/assets/javascripts/bootstrap-accessibility.min.js deleted file mode 100644 index 41a37c453c..0000000000 --- a/app/assets/javascripts/bootstrap-accessibility.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! bootstrap-accessibility-plugin - v1.0.5 - 2016-07-19 -* https://github.com/paypal/bootstrap-accessibility-plugin -* Copyright (c) 2016 PayPal Accessibility Team; Licensed BSD */ -!function($){"use strict";var uniqueId=function(prefix){return(prefix||"ui-id")+"-"+Math.floor(1e3*Math.random()+1)},focusable=function(element,isTabIndexNotNaN){var map,mapName,img,nodeName=element.nodeName.toLowerCase();return"area"===nodeName?(map=element.parentNode,mapName=map.name,element.href&&mapName&&"map"===map.nodeName.toLowerCase()?(img=$("img[usemap='#"+mapName+"']")[0],!!img&&visible(img)):!1):(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"===nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&visible(element)},visible=function(element){return $.expr.filters.visible(element)&&!$(element).parents().addBack().filter(function(){return"hidden"===$.css(this,"visibility")}).length};$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName)}}):function(elem,i,match){return!!$.data(elem,match[3])},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")))},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN)}}),$(".modal-dialog").attr({role:"document"});var modalhide=$.fn.modal.Constructor.prototype.hide;$.fn.modal.Constructor.prototype.hide=function(){modalhide.apply(this,arguments),$(document).off("keydown.bs.modal")};var modalfocus=$.fn.modal.Constructor.prototype.enforceFocus;$.fn.modal.Constructor.prototype.enforceFocus=function(){var $content=this.$element.find(".modal-content"),focEls=$content.find(":tabbable"),$lastEl=$(focEls[focEls.length-1]),$firstEl=$(focEls[0]);$lastEl.on("keydown.bs.modal",$.proxy(function(ev){9!==ev.keyCode||ev.shiftKey|ev.ctrlKey|ev.metaKey|ev.altKey||(ev.preventDefault(),$firstEl.focus())},this)),$firstEl.on("keydown.bs.modal",$.proxy(function(ev){9===ev.keyCode&&ev.shiftKey&&(ev.preventDefault(),$lastEl.focus())},this)),modalfocus.apply(this,arguments)};var $par,firstItem,toggle="[data-toggle=dropdown]",focusDelay=200,menus=$(toggle).parent().find("ul").attr("role","menu"),lis=menus.find("li").attr("role","presentation");lis.find("a").attr({role:"menuitem",tabIndex:"-1"}),$(toggle).attr({"aria-haspopup":"true","aria-expanded":"false"}),$(toggle).parent().on("shown.bs.dropdown",function(e){$par=$(this);var $toggle=$par.find(toggle);$toggle.attr("aria-expanded","true"),$toggle.on("keydown.bs.dropdown",$.proxy(function(ev){setTimeout(function(){firstItem=$(".dropdown-menu [role=menuitem]:visible",$par)[0];try{firstItem.focus()}catch(ex){}},focusDelay)},this))}).on("hidden.bs.dropdown",function(e){$par=$(this);var $toggle=$par.find(toggle);$toggle.attr("aria-expanded","false")}),$(document).on("focusout.dropdown.data-api",".dropdown-menu",function(e){var $this=$(this),that=this;$this.parent().hasClass("open")&&setTimeout(function(){$.contains(that,document.activeElement)||$this.parent().find("[data-toggle=dropdown]").dropdown("toggle")},150)}).on("keydown.bs.dropdown.data-api",toggle+", [role=menu]",$.fn.dropdown.Constructor.prototype.keydown);var $tablist=$(".nav-tabs, .nav-pills"),$lis=$tablist.children("li"),$tabs=$tablist.find('[data-toggle="tab"], [data-toggle="pill"]');$tabs&&($tablist.attr("role","tablist"),$lis.attr("role","presentation"),$tabs.attr("role","tab")),$tabs.each(function(index){var tabpanel=$($(this).attr("href")),tab=$(this),tabid=tab.attr("id")||uniqueId("ui-tab");tab.attr("id",tabid),tab.parent().hasClass("active")?(tab.attr({tabIndex:"0","aria-selected":"true","aria-controls":tab.attr("href").substr(1)}),tabpanel.attr({role:"tabpanel",tabIndex:"0","aria-hidden":"false","aria-labelledby":tabid})):(tab.attr({tabIndex:"-1","aria-selected":"false","aria-controls":tab.attr("href").substr(1)}),tabpanel.attr({role:"tabpanel",tabIndex:"-1","aria-hidden":"true","aria-labelledby":tabid}))}),$.fn.tab.Constructor.prototype.keydown=function(e){var $items,index,$this=$(this),$ul=$this.closest("ul[role=tablist] "),k=e.which||e.keyCode;if($this=$(this),/(37|38|39|40)/.test(k)){$items=$ul.find("[role=tab]:visible"),index=$items.index($items.filter(":focus")),(38==k||37==k)&&index--,(39==k||40==k)&&index++,0>index&&(index=$items.length-1),index==$items.length&&(index=0);var nextTab=$items.eq(index);"tab"===nextTab.attr("role")&&nextTab.tab("show").focus(),e.preventDefault(),e.stopPropagation()}},$(document).on("keydown.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',$.fn.tab.Constructor.prototype.keydown);var tabactivate=$.fn.tab.Constructor.prototype.activate;$.fn.tab.Constructor.prototype.activate=function(element,container,callback){var $active=container.find("> .active");$active.find("[data-toggle=tab], [data-toggle=pill]").attr({tabIndex:"-1","aria-selected":!1}),$active.filter(".tab-pane").attr({"aria-hidden":!0,tabIndex:"-1"}),tabactivate.apply(this,arguments),element.addClass("active"),element.find("[data-toggle=tab], [data-toggle=pill]").attr({tabIndex:"0","aria-selected":!0}),element.filter(".tab-pane").attr({"aria-hidden":!1,tabIndex:"0"})};var $colltabs=$('[data-toggle="collapse"]');$colltabs.each(function(index){var colltab=$(this),collpanel=$(colltab.attr("data-target")?colltab.attr("data-target"):colltab.attr("href")),parent=colltab.attr("data-parent"),collparent=parent&&$(parent),collid=colltab.attr("id")||uniqueId("ui-collapse");colltab.attr("id",collid),collparent&&(colltab.attr({role:"tab","aria-selected":"false","aria-expanded":"false"}),$(collparent).find("div:not(.collapse,.panel-body), h4").attr("role","presentation"),collparent.attr({role:"tablist","aria-multiselectable":"true"}),collpanel.hasClass("in")?(colltab.attr({"aria-controls":collpanel.attr("id"),"aria-selected":"true","aria-expanded":"true",tabindex:"0"}),collpanel.attr({role:"tabpanel",tabindex:"0","aria-labelledby":collid,"aria-hidden":"false"})):(colltab.attr({"aria-controls":collpanel.attr("id"),tabindex:"-1"}),collpanel.attr({role:"tabpanel",tabindex:"-1","aria-labelledby":collid,"aria-hidden":"true"})))});var collToggle=$.fn.collapse.Constructor.prototype.toggle;$.fn.collapse.Constructor.prototype.toggle=function(){var href,prevTab=this.$parent&&this.$parent.find('[aria-expanded="true"]');if(prevTab){var curTab,prevPanel=prevTab.attr("data-target")||(href=prevTab.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,""),$prevPanel=$(prevPanel),$curPanel=this.$element;this.$parent;this.$parent&&(curTab=this.$parent.find('[data-toggle=collapse][href="#'+this.$element.attr("id")+'"]')),collToggle.apply(this,arguments),$.support.transition&&this.$element.one($.support.transition.end,function(){prevTab.attr({"aria-selected":"false","aria-expanded":"false",tabIndex:"-1"}),$prevPanel.attr({"aria-hidden":"true",tabIndex:"-1"}),curTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:"0"}),$curPanel.hasClass("in")?$curPanel.attr({"aria-hidden":"false",tabIndex:"0"}):(curTab.attr({"aria-selected":"false","aria-expanded":"false"}),$curPanel.attr({"aria-hidden":"true",tabIndex:"-1"}))})}else collToggle.apply(this,arguments)},$.fn.collapse.Constructor.prototype.keydown=function(e){var $items,index,$this=$(this),$tablist=$this.closest("div[role=tablist] "),k=e.which||e.keyCode;$this=$(this),/(32|37|38|39|40)/.test(k)&&(32==k&&$this.click(),$items=$tablist.find("[role=tab]"),index=$items.index($items.filter(":focus")),(38==k||37==k)&&index--,(39==k||40==k)&&index++,0>index&&(index=$items.length-1),index==$items.length&&(index=0),$items.eq(index).focus(),e.preventDefault(),e.stopPropagation())},$(document).on("keydown.collapse.data-api",'[data-toggle="collapse"]',$.fn.collapse.Constructor.prototype.keydown),$(".carousel").each(function(index){function setTablistHighlightBox(){var $tab,offset,height,width,highlightBox={};highlightBox.top=0,highlightBox.left=32e3,highlightBox.height=0,highlightBox.width=0;for(var i=0;i<$tabs.length;i++){$tab=$tabs[i],offset=$($tab).offset(),height=$($tab).height(),width=$($tab).width(),highlightBox.topoffset.left&&(highlightBox.left=Math.round(offset.left));var w=offset.left-highlightBox.left+Math.round(width);highlightBox.widthA carousel is a rotating set of images, rotation stops on keyboard focus on carousel tab controls or hovering the mouse pointer over images. Use the tabs or the previous and next buttons to change the displayed slide.

'),$this.prepend('

Carousel content with '+$tabpanels.length+" slides.

")),i=0;i<$tabs.length;i++){$tab=$tabs[i],$tab.setAttribute("role","tab"),$tab.setAttribute("id","tab-"+index+"-"+i),$tab.setAttribute("aria-controls","tabpanel-"+index+"-"+i);var tpId="#tabpanel-"+index+"-"+i,caption=$this.find(tpId).find("h1").text();("string"!=typeof caption||0===caption.length)&&(caption=$this.find(tpId).text()),("string"!=typeof caption||0===caption.length)&&(caption=$this.find(tpId).find("h3").text()),("string"!=typeof caption||0===caption.length)&&(caption=$this.find(tpId).find("h4").text()),("string"!=typeof caption||0===caption.length)&&(caption=$this.find(tpId).find("h5").text()),("string"!=typeof caption||0===caption.length)&&(caption=$this.find(tpId).find("h6").text()),("string"!=typeof caption||0===caption.length)&&(caption="no title");var tabName=document.createElement("span");tabName.setAttribute("class","sr-only"),tabName.innerHTML="Slide "+(i+1),caption&&(tabName.innerHTML+=": "+caption),$tab.appendChild(tabName)}$tablistHighlight=document.createElement("div"),$tablistHighlight.className="carousel-tablist-highlight",document.body.appendChild($tablistHighlight),$complementaryLandmark=document.createElement("aside"),$complementaryLandmark.setAttribute("class","carousel-aside-pause"),$complementaryLandmark.setAttribute("aria-label","carousel pause/play control"),$this.prepend($complementaryLandmark),$pauseCarousel=document.createElement("button"),$pauseCarousel.className="carousel-pause-button",$pauseCarousel.innerHTML="Pause Carousel",$pauseCarousel.setAttribute("title","Pause/Play carousel button can be used by screen reader users to stop carousel animations"),$($complementaryLandmark).append($pauseCarousel),$($pauseCarousel).click(function(){$is_paused?($pauseCarousel.innerHTML="Pause Carousel",$this.carousel("cycle"),$is_paused=!1):($pauseCarousel.innerHTML="Play Carousel",$this.carousel("pause"),$is_paused=!0)}),$($pauseCarousel).focus(function(){$(this).addClass("focus")}),$($pauseCarousel).blur(function(){$(this).removeClass("focus")}),setTablistHighlightBox(),$(window).resize(function(){setTablistHighlightBox()}),$prev.attr("aria-label","Previous Slide"),$prev.keydown(function(e){var k=e.which||e.keyCode;/(13|32)/.test(k)&&(e.preventDefault(),e.stopPropagation(),$prev.trigger("click"))}),$prev.focus(function(){$(this).parents(".carousel").addClass("contrast")}),$prev.blur(function(){$(this).parents(".carousel").removeClass("contrast")}),$next.attr("aria-label","Next Slide"),$next.keydown(function(e){var k=e.which||e.keyCode;/(13|32)/.test(k)&&(e.preventDefault(),e.stopPropagation(),$next.trigger("click"))}),$next.focus(function(){$(this).parents(".carousel").addClass("contrast")}),$next.blur(function(){$(this).parents(".carousel").removeClass("contrast")}),$(".carousel-inner a").focus(function(){$(this).parents(".carousel").addClass("contrast")}),$(".carousel-inner a").blur(function(){$(this).parents(".carousel").removeClass("contrast")}),$tabs.each(function(){var item=$(this);item.hasClass("active")?item.attr({"aria-selected":"true",tabindex:"0"}):item.attr({"aria-selected":"false",tabindex:"-1"})})});var slideCarousel=$.fn.carousel.Constructor.prototype.slide;$.fn.carousel.Constructor.prototype.slide=function(type,next){var $id,$element=this.$element,$active=$element.find("[role=tabpanel].active"),$next=next||$active[type](),$tab_count=$element.find("[role=tabpanel]").size(),$prev_side=$element.find('[data-slide="prev"]'),$next_side=$element.find('[data-slide="next"]'),$index=0,$prev_index=$tab_count-1,$next_index=1;$next&&$next.attr("id")&&($id=$next.attr("id"),$index=$id.lastIndexOf("-"),$index>=0&&($index=parseInt($id.substring($index+1),10)),$prev_index=$index-1,1>$prev_index&&($prev_index=$tab_count-1),$next_index=$index+1,$next_index>=$tab_count&&($next_index=0)),$prev_side.attr("aria-label","Show slide "+($prev_index+1)+" of "+$tab_count),$next_side.attr("aria-label","Show slide "+($next_index+1)+" of "+$tab_count),slideCarousel.apply(this,arguments),$active.one("bsTransitionEnd",function(){var $tab;$tab=$element.find('li[aria-controls="'+$active.attr("id")+'"]'),$tab&&$tab.attr({"aria-selected":!1,tabIndex:"-1"}),$tab=$element.find('li[aria-controls="'+$next.attr("id")+'"]'),$tab&&$tab.attr({"aria-selected":!0,tabIndex:"0"})})};var $this;$.fn.carousel.Constructor.prototype.keydown=function(e){function selectTab(index){index>=$tabs.length||0>index||($carousel.carousel(index),setTimeout(function(){$tabs[index].focus()},150))}$this=$this||$(this),this instanceof Node&&($this=$(this));var index,$carousel=$(e.target).closest(".carousel"),$tabs=$carousel.find("[role=tab]"),k=e.which||e.keyCode;/(37|38|39|40)/.test(k)&&(index=$tabs.index($tabs.filter(".active")),(37==k||38==k)&&(index--,selectTab(index)),(39==k||40==k)&&(index++,selectTab(index)),e.preventDefault(),e.stopPropagation())},$(document).on("keydown.carousel.data-api","li[role=tab]",$.fn.carousel.Constructor.prototype.keydown)}(jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee deleted file mode 100644 index c9404a8e2f..0000000000 --- a/app/assets/javascripts/bootstrap.js.coffee +++ /dev/null @@ -1,4 +0,0 @@ -jQuery -> - $("a[rel=popover]").popover() - $(".tooltip").tooltip() - $("a[rel=tooltip]").tooltip() \ No newline at end of file diff --git a/app/assets/javascripts/nav.js b/app/assets/javascripts/nav.js deleted file mode 100644 index eb3d7297a7..0000000000 --- a/app/assets/javascripts/nav.js +++ /dev/null @@ -1 +0,0 @@ -$('.dropdown-toggle').dropdown(); diff --git a/app/assets/javascripts/tooltips.js b/app/assets/javascripts/tooltips.js index fe6e698300..e69de29bb2 100644 --- a/app/assets/javascripts/tooltips.js +++ b/app/assets/javascripts/tooltips.js @@ -1,3 +0,0 @@ -$(function() { - $('[data-toggle="tooltip"]').tooltip(); -}); diff --git a/app/views/comments/_single.html.haml b/app/views/comments/_single.html.haml index bcd1460c15..1d3cd0ed04 100644 --- a/app/views/comments/_single.html.haml +++ b/app/views/comments/_single.html.haml @@ -6,7 +6,7 @@ - if can?(:edit, comment) || can?(:destroy, comment) %hr/ .dropdown - %button#comment-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button"} Actions + %button#comment-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button"} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "comment-edit-button"} - if can? :edit, comment = link_to edit_comment_path(comment), class: 'dropdown-item' do diff --git a/app/views/crops/_alternate_names.html.haml b/app/views/crops/_alternate_names.html.haml index 04c4314fc8..310e2dd0ca 100644 --- a/app/views/crops/_alternate_names.html.haml +++ b/app/views/crops/_alternate_names.html.haml @@ -4,7 +4,7 @@ - crop.alternate_names.each do |an| - if can? :edit, an .dropdown.planting-actions - %a#crop-actions-altnames.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button", :href => '#'} + %a#crop-actions-altnames.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", :href => '#'} = an.name .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-altnames"} - if can? :edit, an diff --git a/app/views/crops/_image_with_popover.html.haml b/app/views/crops/_image_with_popover.html.haml index 6176c6bba7..6deb844f4c 100644 --- a/app/views/crops/_image_with_popover.html.haml +++ b/app/views/crops/_image_with_popover.html.haml @@ -3,7 +3,8 @@ alt: "Image of #{crop.name}", class: 'image-responsive crop-image'), crop.name, rel: "popover", - 'data-trigger': 'hover', - 'data-title': crop.name, - 'data-content': render(partial: 'crops/popover', locals: { crop: crop }), - 'data-html': true + 'data-bs-toggle': 'popover', + 'data-bs-trigger': 'hover', + 'data-bs-title': crop.name, + 'data-bs-content': render(partial: 'crops/popover', locals: { crop: crop }), + 'data-bs-html': true diff --git a/app/views/crops/_scientific_names.html.haml b/app/views/crops/_scientific_names.html.haml index fcdfd4c3f7..a55dc967f0 100644 --- a/app/views/crops/_scientific_names.html.haml +++ b/app/views/crops/_scientific_names.html.haml @@ -6,7 +6,7 @@ - crop.scientific_names.each do |sn| - if can? :edit, sn .dropdown.planting-actions - %a#planting-actions-scinames.dropdown-toggle.card-link{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button", :href => '#'}= sn.name + %a#planting-actions-scinames.dropdown-toggle.card-link{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", :href => '#'}= sn.name .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"} = link_to edit_scientific_name_path(sn), class: 'dropdown-item' do = edit_icon diff --git a/app/views/crops/_wrangle.html.haml b/app/views/crops/_wrangle.html.haml index 6129d46c4a..f9ea9ede18 100644 --- a/app/views/crops/_wrangle.html.haml +++ b/app/views/crops/_wrangle.html.haml @@ -4,7 +4,7 @@ You are a %strong CROP WRANGLER .dropdown.crop-actions - %a#crop-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button", href: '#'} Actions + %a#crop-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", href: '#'} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-button"} = link_to edit_crop_path(crop), class: 'dropdown-item' do = edit_icon diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 3a3fe90b4f..7a6c9829c7 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -10,15 +10,15 @@ .card %ul#myTab.nav.nav-tabs{role: "tablist"} %li.nav-item - %a#profile-tab.nav-link.active{"aria-controls" => "profile", "aria-selected" => "true", "data-toggle" => "tab", href: "#profile", role: "tab"} Profile + %a#profile-tab.nav-link.active{"aria-controls" => "profile", "aria-selected" => "true", "data-bs-toggle" => "tab", href: "#profile", role: "tab"} Profile %li.nav-item - %a#email-tab.nav-link{"aria-controls" => "email", "aria-selected" => "false", "data-toggle" => "tab", href: "#email", role: "tab"} Email + %a#email-tab.nav-link{"aria-controls" => "email", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#email", role: "tab"} Email %li.nav-item - %a#apps-tab.nav-link{"aria-controls" => "apps", "aria-selected" => "false", "data-toggle" => "tab", href: "#apps", role: "tab"} Apps + %a#apps-tab.nav-link{"aria-controls" => "apps", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#apps", role: "tab"} Apps %li.nav-item - %a#password-tab.nav-link{"aria-controls" => "password", "aria-selected" => "false", "data-toggle" => "tab", href: "#password", role: "tab"} Password + %a#password-tab.nav-link{"aria-controls" => "password", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#password", role: "tab"} Password %li.nav-item - %a#delete-tab.nav-link.text-danger{"aria-controls" => "delete", "aria-selected" => "false", "data-toggle" => "tab", href: "#delete", role: "tab"} Delete Account + %a#delete-tab.nav-link.text-danger{"aria-controls" => "delete", "aria-selected" => "false", "data-bs-toggle" => "tab", href: "#delete", role: "tab"} Delete Account .card-body #myTabContent.tab-content #profile.tab-pane.fade.show.active{"aria-labelledby" => "profile-tab", role: "tabpanel"} diff --git a/app/views/forums/_form.html.haml b/app/views/forums/_form.html.haml index ba4382749e..81955ef70b 100644 --- a/app/views/forums/_form.html.haml +++ b/app/views/forums/_form.html.haml @@ -14,8 +14,8 @@ - @forum.errors.full_messages.each do |msg| %li= msg - = f.text_field :name - = f.text_area :description, rows: 6 - = f.select(:owner_id, Member.all.order(:login_name).pluck(:login_name, :id)) + = f.text_field :name, required: true + = f.text_area :description, rows: 6, required: true + = f.select(:owner_id, Member.all.order(:login_name).pluck(:login_name, :id), required: true) .card-footer .text-right= f.submit 'Save' diff --git a/app/views/gardens/_actions.html.haml b/app/views/gardens/_actions.html.haml index 3d5b5905ef..0a1024f604 100644 --- a/app/views/gardens/_actions.html.haml +++ b/app/views/gardens/_actions.html.haml @@ -1,6 +1,6 @@ - if can?(:edit, garden) .dropdown.garden-actions - %a#garden-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} Actions + %a#garden-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "garden-actions-button"} - if can?(:edit, garden) - if garden.active diff --git a/app/views/harvests/_actions.html.haml b/app/views/harvests/_actions.html.haml index cafe428114..c3dbfa8369 100644 --- a/app/views/harvests/_actions.html.haml +++ b/app/views/harvests/_actions.html.haml @@ -1,6 +1,6 @@ - if can?(:edit, harvest) .dropdown.harvest-actions - %a#harvest-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} Actions + %a#harvest-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "harvest-actions-button"} = harvest_edit_button(harvest, classes: 'dropdown-item') = add_photo_button(harvest, classes: 'dropdown-item') diff --git a/app/views/harvests/_image_with_popover.haml b/app/views/harvests/_image_with_popover.haml index ebfb187f62..9dd870f5bf 100644 --- a/app/views/harvests/_image_with_popover.haml +++ b/app/views/harvests/_image_with_popover.haml @@ -3,7 +3,8 @@ class: 'image-responsive crop-image'), harvest, rel: "popover", - 'data-trigger': 'hover', - 'data-title': harvest.to_s, - 'data-content': render('harvests/popover', harvest: harvest), - 'data-html': true + 'data-bs-toggle': 'popover', + 'data-bs-trigger': 'hover', + 'data-bs-title': harvest.to_s, + 'data-bs-content': render('harvests/popover', harvest: harvest), + 'data-bs-html': true diff --git a/app/views/harvests/_modal.html.haml b/app/views/harvests/_modal.html.haml index 79f9ada06c..d1ce63f620 100644 --- a/app/views/harvests/_modal.html.haml +++ b/app/views/harvests/_modal.html.haml @@ -3,7 +3,7 @@ .modal-content .modal-header.text-center %h4.modal-title.w-100.font-weight-bold Record #{harvest.crop.name} harvest - %button.close{"aria-label" => "Close", "data-dismiss" => "modal", type: "button"} + %button.close{"aria-label" => "Close", "data-bs-dismiss" => "modal", type: "button"} %span{"aria-hidden" => "true"} × .modal-body %p Select which plant part you have havested @@ -26,6 +26,6 @@ = plant_part_icon(plant_part.name) = plant_part -%a.btn#modalHarvestButton{"data-target" => "#modelHarvestForm", "data-toggle" => "modal", href: ""} +%a.btn#modalHarvestButton{"data-bs-target" => "#modelHarvestForm", "data-bs-toggle" => "modal", href: ""} = harvest_icon Record harvest diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 86e2110f9e..b761945cd9 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -6,6 +6,6 @@ %span.site-name Growstuff .nav= render 'crops/search_bar' .nav - %button.navbar-toggler{ "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#navbarSupportedContent", "data-toggle" => "collapse", type: "button" } + %button.navbar-toggler{ "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-bs-target" => "#navbarSupportedContent", "data-bs-toggle" => "collapse", type: "button" } %i.fas.fa-ellipsis-v.navbar-toggler-icon = render 'layouts/menu' diff --git a/app/views/layouts/_menu.haml b/app/views/layouts/_menu.haml index 9ae4f3006c..2846249018 100644 --- a/app/views/layouts/_menu.haml +++ b/app/views/layouts/_menu.haml @@ -8,7 +8,7 @@ = link_to member_gardens_path(current_member), class: 'nav-link text-white', title: "My gardens" do = image_icon 'gardens' %li.nav-item.dropdown - %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"} + %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"} = image_tag "icons/gardener.svg", class: 'img img-icon', alt: t('.record'), aria: { hidden: "true" } = t('.record') .dropdown-menu @@ -30,7 +30,7 @@ - cache("everyone-menu", expires_in: 1.week) do %li.nav-item.dropdown - %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}= t('.crops') + %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}= t('.crops') .dropdown-menu = link_to crops_path, class: 'dropdown-item' do = t('.browse_crops') @@ -44,7 +44,7 @@ = harvest_icon = t('.harvests') %li.nav-item.dropdown - %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}= t('.community') + %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}= t('.community') .dropdown-menu{"aria-labelledby" => "navbarDropdown"} = link_to t('.community_map'), places_path, class: 'dropdown-item' = link_to t('.browse_members'), members_path, class: 'dropdown-item' @@ -54,7 +54,7 @@ - if member_signed_in? - if current_member.role?(:crop_wrangler) || current_member.role?(:admin) %li.nav-item.dropdown - %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"}= t('.admin') + %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}= t('.admin') .dropdown-menu{"aria-labelledby" => "navbarDropdown"} - if current_member.role?(:crop_wrangler) = link_to t('.crop_wrangling'), wrangle_crops_path, class: 'dropdown-item' @@ -62,7 +62,7 @@ = link_to t('.admin'), admin_path, class: 'dropdown-item' %li.nav-item.dropdown - %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#", role: "button"} + %a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"} = image_tag(avatar_uri(current_member, 50), alt: 'Avatar of current member', height: 25, width: 25, aria: { hidden: "true" }) = current_member.login_name - if current_member.unread_count.positive? diff --git a/app/views/layouts/modal.html.haml b/app/views/layouts/modal.html.haml index 8468a6b4c9..d77cbba9ca 100644 --- a/app/views/layouts/modal.html.haml +++ b/app/views/layouts/modal.html.haml @@ -2,7 +2,7 @@ .modal-dialog .modal-content .modal-header - %button.close{"data-dismiss" => "modal", type: "button"} + %button.close{"data-bs-dismiss" => "modal", type: "button"} %span{"aria-hidden" => "true"} × %span.sr-only Close %h4#mainModalLabel.modal-title diff --git a/app/views/photos/_actions.html.haml b/app/views/photos/_actions.html.haml index 1329e04f51..1ab3e14bd4 100644 --- a/app/views/photos/_actions.html.haml +++ b/app/views/photos/_actions.html.haml @@ -1,6 +1,6 @@ - if can?(:edit, @photo) && can?(:destroy, @photo) .dropdown.float-right.photo-actions - %a#harvest-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} Actions + %a#harvest-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "harvest-actions-button"} = edit_button(edit_photo_path(@photo), classes: 'dropdown-item') .dropdown-divider diff --git a/app/views/plantings/_actions.html.haml b/app/views/plantings/_actions.html.haml index 5463894a9b..ef852088a0 100644 --- a/app/views/plantings/_actions.html.haml +++ b/app/views/plantings/_actions.html.haml @@ -1,6 +1,6 @@ - if can?(:edit, planting) .dropdown.planting-actions - %a#planting-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} Actions + %a#planting-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"} = planting_edit_button(planting, classes: 'dropdown-item') = add_photo_button(planting, classes: 'dropdown-item') diff --git a/app/views/plantings/_badges.html.haml b/app/views/plantings/_badges.html.haml index e01d72d5f8..842c22977e 100644 --- a/app/views/plantings/_badges.html.haml +++ b/app/views/plantings/_badges.html.haml @@ -10,8 +10,8 @@ // Harvest times - unless planting.super_late? - if planting.harvest_time? - %span.badge.badge-info.badge-harvest{'data-toggle': "tooltip", 'data-placement': "top", title: 'Planting is ready for harvesting now'} + %span.badge.badge-info.badge-harvest{'data-bs-toggle': "tooltip", 'data-bs-placement': "top", title: 'Planting is ready for harvesting now'} = t('label.harvesting_now') - elsif planting.before_harvest_time? - %span.badge.badge-info{'data-toggle': "tooltip", 'data-placement': "top", title: 'Predicted weeks until harvest'} + %span.badge.badge-info{'data-bs-toggle': "tooltip", 'data-bs-placement': "top", title: 'Predicted weeks until harvest'} = t('label.weeks_until_harvest', number: in_weeks(days_from_now_to_first_harvest(planting))) diff --git a/app/views/plantings/_card.html.haml b/app/views/plantings/_card.html.haml index 1c593fbd8c..ded3b6773e 100644 --- a/app/views/plantings/_card.html.haml +++ b/app/views/plantings/_card.html.haml @@ -7,7 +7,7 @@ = link_to planting_path(slug: planting.slug) do .planting-quick-actions .dropdown - %a.planting-menu.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} + %a.planting-menu.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} .dropdown-menu{"aria-labelledby" => "planting-menu"} = link_to edit_planting_path(slug: planting.slug), class: 'dropdown-item' do diff --git a/app/views/plantings/_descendants.html.haml b/app/views/plantings/_descendants.html.haml index 2dd31b8d00..81bf3dedea 100644 --- a/app/views/plantings/_descendants.html.haml +++ b/app/views/plantings/_descendants.html.haml @@ -1,6 +1,6 @@ %h2 Seeds saved -%a.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", role: "button"} +%a.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", role: "button"} = seed_icon = t('buttons.save_seeds') .dropdown-menu.dropdown-secondary diff --git a/app/views/plantings/_image_with_popover.html.haml b/app/views/plantings/_image_with_popover.html.haml index 41a5c3b26f..ce99413718 100644 --- a/app/views/plantings/_image_with_popover.html.haml +++ b/app/views/plantings/_image_with_popover.html.haml @@ -4,7 +4,8 @@ class: 'image-responsive'), planting, rel: "popover", - 'data-trigger': 'hover', - 'data-title': planting.crop.name, - 'data-content': render('plantings/popover', planting: planting), - 'data-html': true + 'data-bs-toggle': 'popover', + 'data-bs-trigger': 'hover', + 'data-bs-title': planting.crop.name, + 'data-bs-content': render('plantings/popover', planting: planting), + 'data-bs-html': true diff --git a/app/views/plantings/_modal.html.haml b/app/views/plantings/_modal.html.haml index c27a4fceff..d00c6d3f46 100644 --- a/app/views/plantings/_modal.html.haml +++ b/app/views/plantings/_modal.html.haml @@ -3,7 +3,7 @@ .modal-content .modal-header.text-center %h4.modal-title.w-100.font-weight-bold Record #{planting.crop.name} planting - %button.close{"aria-label" => "Close", "data-dismiss" => "modal", type: "button"} + %button.close{"aria-label" => "Close", "data-bs-dismiss" => "modal", type: "button"} %span{"aria-hidden" => "true"} × .modal-body %p Which garden is the planting in? @@ -23,6 +23,6 @@ = link_to 'add new garden', new_garden_path -%a.btn{"data-target" => "#modelPlantingForm", "data-toggle" => "modal", href: "", id: 'planting-button'} +%a.btn{"data-bs-target" => "#modelPlantingForm", "data-bs-toggle" => "modal", href: "", id: 'planting-button'} = planting_icon Add to my garden diff --git a/app/views/plantings/_quick_actions.haml b/app/views/plantings/_quick_actions.haml index 74ac39314c..71947a9ffc 100644 --- a/app/views/plantings/_quick_actions.haml +++ b/app/views/plantings/_quick_actions.haml @@ -1,5 +1,5 @@ - if can?(:edit, planting) - %a#planting-actions-menu.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", href: "#"} + %a#planting-actions-menu.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#"} /=icon('fas', 'ellipsis-v') %ul.dropdown-menu.dropdown-menu-left{"aria-labelledby" => "planting-actions-menu"} %li= link_to t('view'), planting, class: 'dropdown-item' diff --git a/app/views/plantings/_timeline.html.haml b/app/views/plantings/_timeline.html.haml index ee317f299d..227799ec9b 100644 --- a/app/views/plantings/_timeline.html.haml +++ b/app/views/plantings/_timeline.html.haml @@ -15,7 +15,7 @@ .progress-bar{"aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => planting.percentage_grown, role: "progressbar", style: "width: #{planting.percentage_grown}%"} %ul.list-unstyled.d-flex.justify-content-between - in_weeks(planting.expected_lifespan).times do |week_number| - %li{class: planting.planted_at + week_number.weeks > Time.zone.today ? 'text-muted progress-fade' : '', 'data-toggle': "tooltip", 'data-placement': "top", title: I18n.l(planting.planted_at + week_number.weeks)} + %li{class: planting.planted_at + week_number.weeks > Time.zone.today ? 'text-muted progress-fade' : '', 'data-bs-toggle': "tooltip", 'data-bs-placement': "top", title: I18n.l(planting.planted_at + week_number.weeks)} = render 'timeline_icon', planting: planting, week_number: week_number, diff --git a/app/views/posts/_actions.html.haml b/app/views/posts/_actions.html.haml index 30617062f2..0302dfdfd4 100644 --- a/app/views/posts/_actions.html.haml +++ b/app/views/posts/_actions.html.haml @@ -1,6 +1,6 @@ - if can? :edit, post .dropdown.float-right - %button#post-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"} Actions + %button#post-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button"} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "post-edit-button"} - if can? :edit, post = link_to edit_post_path(post), class: 'dropdown-item' do diff --git a/app/views/seeds/_actions.html.haml b/app/views/seeds/_actions.html.haml index 1d337eea41..3aff5f45b9 100644 --- a/app/views/seeds/_actions.html.haml +++ b/app/views/seeds/_actions.html.haml @@ -1,6 +1,6 @@ - if can?(:edit, seed) .dropdown.seed-actions - %a#seed-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button", href: '#'} + %a#seed-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "seed-actions-button"} - if can?(:create, Planting) && can?(:update, seed) && seed.active diff --git a/app/views/seeds/_modal.html.haml b/app/views/seeds/_modal.html.haml index fd216dfaa7..d08c348d8a 100644 --- a/app/views/seeds/_modal.html.haml +++ b/app/views/seeds/_modal.html.haml @@ -5,7 +5,7 @@ %h4.modal-title.w-100.font-weight-bold = seed_icon Save #{seed.crop.name} seeds - %button.close{"aria-label" => "Close", "data-dismiss" => "modal", type: "button"} + %button.close{"aria-label" => "Close", "data-bs-dismiss" => "modal", type: "button"} %span{"aria-hidden" => "true"} × .modal-body @@ -30,6 +30,6 @@ Save #{seed.crop_name} seeds. -%a.btn{"data-target" => "#modelSeedForm", "data-toggle" => "modal", href: ""} +%a.btn{"data-bs-target" => "#modelSeedForm", "data-bs-toggle" => "modal", href: ""} = seed_icon Save seeds diff --git a/app/views/shared/_flash_messages.html.haml b/app/views/shared/_flash_messages.html.haml index abea6b9aca..9575184666 100644 --- a/app/views/shared/_flash_messages.html.haml +++ b/app/views/shared/_flash_messages.html.haml @@ -1,6 +1,6 @@ - flash.each do |type, content| %div{ class: build_alert_classes(type), role: "alert" } - %button.close{ type: "button", "data-dismiss" => "alert" } + %button.close{ type: "button", "data-bs-dismiss" => "alert" } %span{ "aria-hidden" => true } × %span.sr-only Close = content diff --git a/spec/features/admin/forums_spec.rb b/spec/features/admin/forums_spec.rb index 5c0847cdbd..0fe6e61d26 100644 --- a/spec/features/admin/forums_spec.rb +++ b/spec/features/admin/forums_spec.rb @@ -25,6 +25,7 @@ expect(page).to have_current_path new_forum_path, ignore_query: true fill_in 'Name', with: 'Discussion' fill_in 'Description', with: "this is a new forum" + select member.login_name, from: "Owner" click_button 'Save' end diff --git a/spec/features/crops/crop_wranglers_spec.rb b/spec/features/crops/crop_wranglers_spec.rb index 7307d6e6a8..555669c0db 100644 --- a/spec/features/crops/crop_wranglers_spec.rb +++ b/spec/features/crops/crop_wranglers_spec.rb @@ -79,8 +79,7 @@ end it "can't see wrangling page with js" do - visit root_path - click_link member.login_name + visit member_path(member) expect(page).not_to have_link "Crop Wrangling" end end diff --git a/spec/features/shared_examples/crop_suggest.rb b/spec/features/shared_examples/crop_suggest.rb index 03ac664d63..702d9cc656 100644 --- a/spec/features/shared_examples/crop_suggest.rb +++ b/spec/features/shared_examples/crop_suggest.rb @@ -65,6 +65,10 @@ it "Submitting a crop that doesn't exist in the database produces a meaningful error" do within "form#new_#{resource}" do fill_autocomplete "crop", with: "Ryan Gosling" + # Some forms require additional selections before submission. + if resource == "harvest" + choose plant_part.name + end click_button "Save" end