diff --git a/app/helpers/buttons_helper.rb b/app/helpers/buttons_helper.rb index 9cc5e11c6..fb1ac0458 100644 --- a/app/helpers/buttons_helper.rb +++ b/app/helpers/buttons_helper.rb @@ -81,7 +81,7 @@ module ButtonsHelper end def seed_finish_button(seed, classes: 'btn btn-default') - return unless can?(:create, Planting) && seed.active? + return unless can?(:create, Planting) && seed.active link_to seed_path(seed, seed: { finished: 1 }), method: :put, class: "#{classes} append-date" do finished_icon + ' ' + t('buttons.mark_as_finished') diff --git a/app/models/concerns/search_seeds.rb b/app/models/concerns/search_seeds.rb index 4ba34b1ea..326ce2b35 100644 --- a/app/models/concerns/search_seeds.rb +++ b/app/models/concerns/search_seeds.rb @@ -24,6 +24,7 @@ module SearchSeeds finished: finished?, gmo: gmo, has_photos: photos.size.positive?, + active: active, heirloom: heirloom, location: owner.location, organic: organic, diff --git a/app/views/seeds/_actions.html.haml b/app/views/seeds/_actions.html.haml index 5cc91951a..1d337eea4 100644 --- a/app/views/seeds/_actions.html.haml +++ b/app/views/seeds/_actions.html.haml @@ -3,13 +3,13 @@ %a#seed-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-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? + - if can?(:create, Planting) && can?(:update, seed) && seed.active = link_to new_planting_path(seed_id: seed), class: 'dropdown-item success-color' do = seed_icon Plant seeds = seed_edit_button(seed, classes: 'dropdown-item') = add_photo_button(seed, classes: 'dropdown-item') - - if seed.active? + - if seed.active = seed_finish_button(seed, classes: 'dropdown-item') .dropdown-divider = delete_button(seed, classes: 'dropdown-item text-danger')