mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-19 06:15:44 -04:00
40
app/views/seeds/_actions.html.haml
Normal file
40
app/views/seeds/_actions.html.haml
Normal file
@@ -0,0 +1,40 @@
|
||||
- if can? :edit, @seed
|
||||
= link_to edit_seed_path(@seed), class: 'btn btn-default btn-xs' do
|
||||
%span.glyphicon.glyphicon-pencil{ title: "Edit" }
|
||||
Edit
|
||||
= link_to new_photo_path(id: seed.id, type: 'seed'), class: 'btn btn-default btn-xs' do
|
||||
%span.glyphicon.glyphicon-camera{ title: "Add photo" }
|
||||
Add photo
|
||||
- if can? :destroy, @seed
|
||||
= link_to @seed, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' do
|
||||
%span.glyphicon.glyphicon-trash{ title: "Delete" }
|
||||
Delete
|
||||
|
||||
|
||||
-# - if can?(:edit, planting) || can?(:destroy, planting)
|
||||
-# - if can? :edit, planting
|
||||
-# = link_to edit_planting_path(planting), class: 'btn btn-default btn-xs' do
|
||||
-# %span.glyphicon.glyphicon-pencil{ title: "Edit" }
|
||||
-# Edit
|
||||
-# - if can? :destroy, planting
|
||||
-# = link_to planting, method: :delete,
|
||||
-# data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' do
|
||||
-# %span.glyphicon.glyphicon-trash{ title: "Delete" }
|
||||
-# Delete
|
||||
|
||||
-# - unless planting.finished
|
||||
-# = link_to planting_path(planting, planting: { finished: 1 }),
|
||||
-# method: :put, class: 'btn btn-default btn-xs append-date' do
|
||||
|
||||
-# %span.glyphicon.glyphicon-ok{ title: "Finished" }
|
||||
-# Mark as finished
|
||||
|
||||
-# - if can?(:create, Harvest)
|
||||
-# = link_to new_planting_harvest_path(planting), class: 'btn btn-default btn-xs' do
|
||||
-# %span.glyphicon.glyphicon-leaf{ title: "Harvest" }
|
||||
-# Harvest
|
||||
|
||||
-# - if can?(:edit, planting) && can?(:create, Photo)
|
||||
-# = link_to new_photo_path(id: planting.id, type: 'planting'), class: 'btn btn-default btn-xs' do
|
||||
-# %span.glyphicon.glyphicon-camera{ title: "Add photo" }
|
||||
-# Add photo
|
||||
@@ -58,15 +58,11 @@
|
||||
subject: "Interested in your #{@seed.crop} seeds"),
|
||||
class: 'btn btn-primary'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: 'request seeds' }
|
||||
= render 'shared/signin_signup', to: 'request seeds'
|
||||
|
||||
- if can?(:edit, @seed) || can?(:destroy, @seed)
|
||||
%p
|
||||
- if can? :edit, @seed
|
||||
= link_to 'Edit', edit_seed_path(@seed), class: 'btn btn-default btn-xs'
|
||||
- if can? :destroy, @seed
|
||||
= link_to 'Delete', @seed, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs'
|
||||
|
||||
= render 'actions', seed: @seed
|
||||
.col-md-6
|
||||
= render partial: "crops/index_card", locals: { crop: @seed.crop }
|
||||
- if @seed.owner.location
|
||||
@@ -79,3 +75,10 @@
|
||||
Or
|
||||
= link_to "purchase seeds via Ebay",
|
||||
crop_ebay_seeds_url(@seed.crop), target: "_blank", rel: "noopener noreferrer"
|
||||
.row
|
||||
- @seed.photos.includes(:owner).each do |p|
|
||||
.col-md-2.six-across
|
||||
= render 'photos/thumbnail', photo: p
|
||||
- if can?(:create, Photo) && can?(:edit, @seed)
|
||||
.col-md-2
|
||||
= link_to "Add photo", new_photo_path(type: "seed", id: @seed.id), class: 'btn btn-primary'
|
||||
|
||||
Reference in New Issue
Block a user