mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-11 01:05:01 -04:00
Merge branch 'dev' of https://github.com/Growstuff/growstuff into feature/add-schema-org-to-crops-page
This commit is contained in:
@@ -74,7 +74,7 @@ class ScientificNamesController < ApplicationController
|
||||
end
|
||||
|
||||
def scientific_name_params
|
||||
params.require(:scientific_name).permit(:crop_id, :name, :gbif_key)
|
||||
params.require(:scientific_name).permit(:crop_id, :name, :gbif_key, :wikidata_id)
|
||||
end
|
||||
|
||||
def gbif_service
|
||||
|
||||
@@ -42,36 +42,45 @@
|
||||
%span.help-block Living more than two years
|
||||
|
||||
%h2 Data
|
||||
= f.text_area :description, label: 'Description'
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.description}
|
||||
= f.number_field :row_spacing, label: 'Row Spacing (cm)', min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.row_spacing}
|
||||
= f.number_field :spread, label: 'Spread (cm)', min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.spread}
|
||||
= f.number_field :height, label: 'Height (cm)', min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.height}
|
||||
= f.text_field :sowing_method
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.sowing_method}
|
||||
= f.text_field :sun_requirements
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.sun_requirements}
|
||||
= f.number_field :growing_degree_days, min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.growing_degree_days}
|
||||
- if @crop.description.blank? || can?(:wrangle, @crop)
|
||||
= f.text_area :description, label: 'Description'
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.description}
|
||||
- if @crop.row_spacing.blank? || can?(:wrangle, @crop)
|
||||
= f.number_field :row_spacing, label: 'Row Spacing (cm)', min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.row_spacing}
|
||||
- if @crop.spread.blank? || can?(:wrangle, @crop)
|
||||
= f.number_field :spread, label: 'Spread (cm)', min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.spread}
|
||||
- if @crop.height.blank? || can?(:wrangle, @crop)
|
||||
= f.number_field :height, label: 'Height (cm)', min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.height}
|
||||
- if @crop.sowing_method.blank? || can?(:wrangle, @crop)
|
||||
= f.text_field :sowing_method
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.sowing_method}
|
||||
- if @crop.sun_requirements.blank? || can?(:wrangle, @crop)
|
||||
= f.text_field :sun_requirements
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.sun_requirements}
|
||||
- if @crop.growing_degree_days.blank? || can?(:wrangle, @crop)
|
||||
= f.number_field :growing_degree_days, min: 0
|
||||
- if @crop.parent
|
||||
%span.help-block Parent: #{@crop.parent.growing_degree_days}
|
||||
|
||||
- unless @crop.approved?
|
||||
= link_to 'Search wikipedia', "https://en.wikipedia.org/w/index.php?search=#{@crop.name}", target: '_blank'
|
||||
= f.url_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
|
||||
%span.help-block
|
||||
Link to the crop's page on the English language Wikipedia (required).
|
||||
= f.url_field :en_youtube_url, label: 'YouTube URL'
|
||||
%span.help-block
|
||||
Link to a YouTube video about the crop in English.
|
||||
- if @crop.en_wikipedia_url.blank? || can?(:wrangle, @crop)
|
||||
= f.url_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
|
||||
%span.help-block
|
||||
Link to the crop's page on the English language Wikipedia (required).
|
||||
- if @crop.en_youtube_url.blank? || can?(:wrangle, @crop)
|
||||
= f.url_field :en_youtube_url, label: 'YouTube URL'
|
||||
%span.help-block
|
||||
Link to a YouTube video about the crop in English.
|
||||
|
||||
-# Only crop wranglers see the crop hierarchy (for now)
|
||||
- if can? :wrangle, @crop
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
Nobody is growing this yet. You could be the first!
|
||||
- if crop_or_parent(@crop, :description).present?
|
||||
%p= simple_format crop_or_parent(@crop, :description)
|
||||
- else
|
||||
- if member_signed_in?
|
||||
%p= link_to "Add a description.", edit_crop_path(@crop)
|
||||
.col-md-3
|
||||
= image_tag crop_image_path(@crop),
|
||||
class: 'img-responsive shadow rounded crop-hero-photo', alt: "Image of #{@crop.name}"
|
||||
|
||||
@@ -54,3 +54,7 @@
|
||||
- if crop.growing_degree_days.present?
|
||||
= render 'layouts/fact_card',
|
||||
title: 'Growing Degree Days', value: crop.growing_degree_days, description: nil
|
||||
- if member_signed_in? && (!crop.height.present? || !crop.spread.present? || !crop.row_spacing.present? || !crop.growing_degree_days.present?)
|
||||
.card.fact-card
|
||||
.card-body.text-center
|
||||
%p= link_to "Add more attributes.", edit_crop_path(@crop)
|
||||
|
||||
@@ -4,25 +4,28 @@
|
||||
%p None known.
|
||||
- else
|
||||
- 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-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
|
||||
= t('.edit')
|
||||
.dropdown-divider
|
||||
= link_to sn, method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item text-danger' do
|
||||
= delete_icon
|
||||
= t('.delete')
|
||||
- else
|
||||
- if sn.gbif_key
|
||||
= link_to sn.name, "https://www.gbif.org/species/#{sn.gbif_key}",
|
||||
class: 'card-link',
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer"
|
||||
.d-inline-block
|
||||
- if can? :edit, sn
|
||||
.dropdown.planting-actions.d-inline-block
|
||||
%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
|
||||
= t('.edit')
|
||||
.dropdown-divider
|
||||
= link_to sn, method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item text-danger' do
|
||||
= delete_icon
|
||||
= t('.delete')
|
||||
- else
|
||||
.badge= sn.name
|
||||
- if sn.gbif_key
|
||||
= link_to sn.name, "https://www.gbif.org/species/#{sn.gbif_key}",
|
||||
class: 'card-link',
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer"
|
||||
- else
|
||||
.badge= sn.name
|
||||
- if sn.wikidata_id.present?
|
||||
= link_to "WD", "https://www.wikidata.org/wiki/#{sn.wikidata_id}", class: 'badge badge-info ms-1', target: '_blank', rel: 'noopener noreferrer', title: 'Wikidata'
|
||||
|
||||
%p.text-right
|
||||
- if can? :edit, crop
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
%h2 Video
|
||||
.embed-responsive.embed-responsive-16by9
|
||||
%iframe.embed-responsive-item{ src: "https://www.youtube.com/embed/#{youtube_video_id(crop_or_parent(@crop, :en_youtube_url))}", allowfullscreen: true }
|
||||
- else
|
||||
- if member_signed_in?
|
||||
%p= link_to "Submit a video.", edit_crop_path(@crop)
|
||||
|
||||
%section.photos
|
||||
= cute_icon
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
= f.label :name, class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :name, class: 'form-control'
|
||||
.form-group
|
||||
= f.label :wikidata_id, "Wikidata ID", class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :wikidata_id, class: 'form-control'
|
||||
.form-group
|
||||
.form-actions.col-md-offset-2.col-md-8
|
||||
= f.submit 'Save', class: 'btn btn-primary'
|
||||
|
||||
Reference in New Issue
Block a user