Compare commits

..

1 Commits

Author SHA1 Message Date
Daniel O'Connor
fea2f6ff61 Fix deprecations 2025-08-27 14:28:14 +00:00
66 changed files with 140 additions and 183 deletions

View File

@@ -183,7 +183,7 @@ GEM
image_processing (~> 1.1)
marcel (~> 1.0.0)
ssrf_filter (~> 1.0)
chartkick (5.2.0)
chartkick (5.1.5)
childprocess (5.0.0)
coderay (1.1.3)
coercible (1.0.0)
@@ -607,7 +607,7 @@ GEM
rswag-ui (2.16.0)
actionpack (>= 5.2, < 8.1)
railties (>= 5.2, < 8.1)
rubocop (1.80.1)
rubocop (1.80.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)

View File

@@ -1,8 +1,6 @@
// stats shown on homepage. eg. "999 members..."
.stats {
a {
font-weight: bold;
}
font-weight: bold;
}
.crops,

View File

@@ -10,33 +10,9 @@
width: 100%;
}
#navbarSupportedContent {
ul {
flex-direction: column-reverse;
flex-wrap: nowrap;
li.nav-item {
display: block;
a {
display: grid;
grid-template-columns: 2em 1fr 2em;
}
a.dropdown-toggle::after {
width: 100%;
text-align: right;
}
}
}
}
.crop-actions {
flex-direction: column;
width: 100%;
a {
margin: auto;
.navbar .nav > li {
display: block;
}
}
.navbar .navbar-form {
padding-left: 0;

View File

@@ -10,7 +10,6 @@ body {
.navbar {
flex-wrap: nowrap;
align-items: flex-start
}
.navbar-brand {
.site-name {
@@ -368,6 +367,9 @@ ul.thumbnail-buttons {
h1 {
font-size: 400%;
}
.stats a {
color: $black;
}
// signup widget on homepage
.signup {

View File

@@ -39,6 +39,12 @@ class CropsController < ApplicationController
respond_with @crops
end
def openfarm
@crop = Crop.find(params[:crop_slug])
@crop.update_openfarm_data!
respond_with @crop, location: @crop
end
def gbif
@crop = Crop.find(params[:crop_slug])
@crop.update_gbif_data!
@@ -131,6 +137,7 @@ class CropsController < ApplicationController
if @crop.approval_status_changed?(from: "pending", to: "approved")
notifier.deliver_now!
@crop.update_openfarm_data!
@crop.update_gbif_data!
end
else

View File

@@ -4,7 +4,7 @@ class GardensController < DataController
def index
@owner = Member.find_by(slug: params[:member_slug])
@show_all = params[:all] == '1'
@show_jump_to = params[:member_slug].present? || false
@show_jump_to = params[:member_slug].present? ? true : false
@gardens = @gardens.includes(:owner)
@gardens = @gardens.active unless @show_all
@@ -18,7 +18,7 @@ class GardensController < DataController
end
def show
@current_plantings = @garden.plantings.current.where.not(failed: true).includes(:crop, :owner).order(planted_at: :desc)
@current_plantings = @garden.plantings.current.includes(:crop, :owner).order(planted_at: :desc)
@current_activities = @garden.activities.current.includes(:owner).order(created_at: :desc)
@finished_plantings = @garden.plantings.finished.includes(:crop)
@suggested_companions = Crop.approved.where(

View File

@@ -21,10 +21,6 @@ module ApplicationHelper
classes
end
def count_github_contibutors
File.open(Rails.root.join('CONTRIBUTORS.md')).readlines.grep(/^-/).size
end
# Produces a cache key for uniquely identifying cached fragments.
def cache_key_for(klass, identifier = "all")
count = klass.count
@@ -97,8 +93,4 @@ module ApplicationHelper
def og_description(description)
strip_tags(description).split(' ')[0..20].join(' ')
end
def site_name
ENV.fetch('GROWSTUFF_SITE_NAME', 'Growstuff')
end
end

View File

@@ -1,7 +1,6 @@
# frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
helper :application
default from: 'from@example.com'
layout 'mailer'
end

View File

@@ -4,6 +4,10 @@ module OpenFarmData
extend ActiveSupport::Concern
included do
def update_openfarm_data!
OpenfarmService.new.update_crop(self)
end
def of_photo
fetch_attr('main_image_path')
end
@@ -39,6 +43,10 @@ module OpenFarmData
fetch_attr('common_names')
end
def guides_count
fetch_attr('guides_count')
end
def binomial_name
fetch_attr('binomial_name')
end

View File

@@ -94,9 +94,9 @@ module PredictPlanting
private
def calculate_percentage_grown
return 0 if age_in_days.to_i < 0
return 0 if age_in_days < 0
percent = (age_in_days.to_f / expected_lifespan.to_f) * 100
percent = (age_in_days / expected_lifespan.to_f) * 100
(percent > 100 ? 100 : percent)
end
end

View File

@@ -59,7 +59,6 @@ class Seed < ApplicationRecord
scope :has_location, -> { joins(:owner).where.not('members.location': nil) }
scope :recent, -> { order(created_at: :desc) }
scope :active, -> { where('finished <> true').where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
scope :expired, -> { active.where('plant_before < ?', Time.zone.today) }
def tradable
tradable_to != 'nowhere'

View File

@@ -2,7 +2,7 @@
%rss{ version: 2.0 }
%channel
%title
Recent activities from #{@owner ? @owner : 'all members'} (#{site_name})
Recent activities from #{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= activities_url
- @activities.each do |activity|
%item

View File

@@ -5,7 +5,7 @@
= tag("meta", property: "og:description", content: og_description(@activity.description))
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Activities', activities_path

View File

@@ -3,7 +3,7 @@
- content_for :breadcrumbs do
%li.breadcrumb-item.active= link_to 'Admin', admin_path
%h1 Manage #{site_name}
%h1 Manage #{ENV['GROWSTUFF_SITE_NAME']}
.row
.col-md-4

View File

@@ -3,7 +3,7 @@
= tag("meta", property: "og:title", content: @alternate_name.name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
%p#notice= notice

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
%rss{ version: 2.0 }
%channel
%title Recent comments on all posts (#{site_name})
%title Recent comments on all posts (#{ENV['GROWSTUFF_SITE_NAME']})
%link= comments_url
- @comments.each do |comment|
%item

View File

@@ -1,6 +1,6 @@
- if crop.approved? && signed_in?
.btn-group.crop-actions{"aria-label" => "Crop Actions", role: "group"}
.btn-group{"aria-label" => "Crop Actions", role: "group"}
= render 'plantings/modal', planting: Planting.new(crop: crop, owner: current_member)
= render 'harvests/modal', harvest: Harvest.new(crop: @crop, owner: current_member)
= render 'seeds/modal', seed: Seed.new(crop: @crop, owner: current_member)

View File

@@ -18,7 +18,7 @@
- if !@crop.plantings.empty?
#{@crop.name.titleize} has been planted
= pluralize(@crop.plantings.size, "time")
by #{site_name} members.
by #{ENV['GROWSTUFF_SITE_NAME']} members.
- else
Nobody is growing this yet. You could be the first!
- if @crop.description.present?

View File

@@ -0,0 +1,6 @@
- if crop.guides_count.present? && crop.guides_count.positive?
%p
There are
= link_to "https://openfarm.cc/en/crops/#{CGI.escape @crop.name.gsub(' ', '-').downcase}" do
#{crop.guides_count} growing guides on Open Farm

View File

@@ -10,6 +10,10 @@
= edit_icon
= t('.edit')
= link_to crop_openfarm_path(crop), method: :post, class: 'dropdown-item' do
= icon 'far', 'update'
Fetch data from OpenFarm
= link_to crop_gbif_path(crop), method: :post, class: 'dropdown-item' do
= icon 'far', 'update'
Fetch data from GBIF

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
%rss{ version: 2.0 }
%channel
%title Recently added crops (#{site_name})
%title Recently added crops (#{ENV['GROWSTUFF_SITE_NAME']})
%link= crops_url
- @crops.each do |crop|
%item

View File

@@ -4,7 +4,7 @@
= tag("meta", property: "og:title", content: @crop.name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :scripts do
= javascript_include_tag "charts"
@@ -74,6 +74,7 @@
.card-body
%h4 How to grow #{@crop.name.pluralize}
= render 'grown_for', crop: @crop
= render 'planting_advice', crop: @crop
- if @crop.parent
%hr/
%p.parent-crop
@@ -115,7 +116,7 @@
.card
.card-body
%h3 Learn more about #{@crop.name.pluralize}
%h4.text-muted resources outside #{site_name}
%h4.text-muted resources outside #{ENV['GROWSTUFF_SITE_NAME']}
%ul.list-group.list-group-flush
%li.list-group-item
@@ -123,6 +124,13 @@
= icon 'fas', 'external-link-alt'
Wikipedia (English)
%li.list-group-item
= link_to "https://openfarm.cc/en/crops/#{CGI.escape @crop.name.gsub(' ', '-')}",
class: 'card-link',
target: "_blank",
rel: "noopener noreferrer" do
= icon 'fas', 'external-link-alt'
OpenFarm - Growing guide
%li.list-group-item
= link_to "https://www.gardenate.com/plant/#{CGI.escape @crop.name}",
target: "_blank",
@@ -139,14 +147,6 @@
= icon 'fas', 'external-link-alt'
Google
%li.list-group-item
= link_to 'https://chat.openai.com/?model=gpt-4o&prompt=' + CGI.escape(['How do I grow', @crop.name, "and what grows well with it? What should I plant the next season if practicing crop rotation? Explain why and add links to your sources"].join(' ')),
target: "_blank",
class: 'card-link',
rel: "noopener noreferrer" do
= icon 'fas', 'external-link-alt'
ChatGPT
%li.list-group-item
= link_to "https://wikihow.com/wikiHowTo?search=#{CGI.escape "grow #{@crop.name}" }",
target: "_blank",

View File

@@ -1,3 +1,4 @@
- site_name = ENV['GROWSTUFF_SITE_NAME']
%p Hello #{@resource.login_name},
%p

View File

@@ -1,3 +1,4 @@
- site_name = ENV['GROWSTUFF_SITE_NAME']
%p Hello #{@resource.login_name},
%p

View File

@@ -1,3 +1,4 @@
- site_name = ENV['GROWSTUFF_SITE_NAME']
%p Hello #{@resource.login_name},
%p

View File

@@ -4,7 +4,7 @@
%br/
= render 'devise/shared/error_messages', resource: resource
%p Delete your account from #{site_name}.
%p Delete your account from #{ENV['GROWSTUFF_SITE_NAME']}.
.form-group
= f.label :current_password, "Password required to delete", class: 'control-label col-md-2'
.col-md-4

View File

@@ -32,7 +32,7 @@
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :newsletter
Subscribe to the #{site_name} newsletter
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter
.help-block
= render partial: 'newsletter_blurb'

View File

@@ -1,4 +1,4 @@
The #{site_name} newsletter is sent out
The #{ENV['GROWSTUFF_SITE_NAME']} newsletter is sent out
every few weeks. Check out our
= link_to 'past newsletters', 'http://blog.growstuff.org/category/newsletter/'
if you want to see the sort of thing we'll send you. Of course, we'll never spam you

View File

@@ -1,8 +1,8 @@
.form-page
.card.form-card
%h1 Join #{site_name}
%h1 Join #{ENV['GROWSTUFF_SITE_NAME']}
.card-body
%p Sign up for a #{site_name} account to track your vegetable garden and connect with other local growers.
%p Sign up for a #{ENV['GROWSTUFF_SITE_NAME']} account to track your vegetable garden and connect with other local growers.
%p If you have accessibility issues with the captcha, please contact us via the links in the footer and we will help.
= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name),
@@ -24,7 +24,7 @@
to the #{link_to 'Terms of Service', "/policy/tos"}
%p
= f.check_box :newsletter, checked: true, label: "Subscribe to the #{site_name} newsletter"
= f.check_box :newsletter, checked: true, label: "Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter"
%p= render partial: 'newsletter_blurb'
= f.submit "Sign up", class: 'btn btn-block btn-success'

View File

@@ -5,7 +5,7 @@
= tag("meta", property: "og:title", content: @forum.name)
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
%h1= @forum.name

View File

@@ -18,7 +18,7 @@
%hr/
%p.text-center
#{site_name} helps you track what you're
#{ENV['GROWSTUFF_SITE_NAME']} helps you track what you're
harvesting from your home garden and see how productive it is.

View File

@@ -1,7 +1,7 @@
- content_for :title, 'GardenTypes'
%p
#{site_name} tracks who's growing what, where.
#{ENV['GROWSTUFF_SITE_NAME']} tracks who's growing what, where.
View any garden_type page to see which of our members have used it.
.index-cards

View File

@@ -7,7 +7,7 @@
= tag("meta", property: "og:title", content: "#{@garden.owner}'s #{@garden}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Gardens', gardens_path

View File

@@ -2,7 +2,7 @@
%rss{ version: 2.0 }
%channel
%title
Recent harvests from #{@owner ||= 'all members'} (#{site_name})
Recent harvests from #{@owner ||= 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= harvests_url
- @harvests.each do |harvest|
%item

View File

@@ -5,7 +5,7 @@
= tag("meta", property: "og:title", content: "#{@harvest.crop} harvested by #{@harvest.owner}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Harvests', harvests_path

View File

@@ -1,7 +1,7 @@
.row.homepage-blurb
.col-md-8.info
%h1 Growstuff - An open gardening platform
%p= t('.intro', site_name: site_name)
%p= t('.intro', site_name: ENV['GROWSTUFF_SITE_NAME'])
= render 'stats'
.col-md-4
.signup

View File

@@ -4,6 +4,6 @@
member: link_to(t('.member_linktext', count: Member.confirmed.size.to_i), members_path),
number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path),
number_plantings: link_to(t('.number_plantings_linktext', count: Planting.count.to_i), plantings_path),
number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path),
contributors: link_to(count_github_contibutors, 'http://github.com/Growstuff/growstuff/CONTRIBUTORS.md', target: '_blank', rel: 'noopener'),
github: link_to('GitHub', 'http://github.com/Growstuff/growstuff', target: '_blank', rel: 'noopener'))
number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path))

View File

@@ -1,14 +1,13 @@
- content_for :title do
= site_name
= ENV['GROWSTUFF_SITE_NAME']
- if member_signed_in?
.row
.col-lg-8.col-md-12
%h1.display-4= t('.welcome', site_name: site_name, member_name: current_member)
%h1.display-4= t('.welcome', site_name: ENV['GROWSTUFF_SITE_NAME'], member_name: current_member)
%p= render 'stats', cached: true
.col
%br
%p
- if current_member.plantings.active.any?
= link_to member_path(current_member, anchor: "#content"), class: 'btn btn-dark' do
@@ -62,16 +61,3 @@
%section.members
= cute_icon
= render 'members', cached: true
.col-12.col-lg-6
%section.pwa-install
= cute_icon
%h2.text-center= t('home.pwa_title')
.index-cards
.card
.card-body
%h3= t('home.pwa_ios_title')
%p= t('home.pwa_ios_steps_html')
.card
.card-body
%h3= t('home.pwa_android_title')
%p= t('home.pwa_android_steps_html')

View File

@@ -6,27 +6,27 @@
- else
= tag("meta", property: "og:image", content: image_url('facebook-thumbnail.png'))
= tag("meta", property: "og:title",
content: (content_for?(:title) ? yield(:title) + " - " : "") + site_name)
content: (content_for?(:title) ? yield(:title) + " - " : "") + ENV['GROWSTUFF_SITE_NAME'])
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: root_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- if content_for?(:member_rss_login_name) && content_for(:member_rss_slug)
= auto_discovery_link_tag(:rss,
{ controller: "/members", action: 'show', format: "rss", id: yield(:member_rss_slug) },
title: "#{site_name}- #{yield(:member_rss_login_name)}'s posts")
title: "#{ENV['GROWSTUFF_SITE_NAME']}- #{yield(:member_rss_login_name)}'s posts")
= auto_discovery_link_tag(:rss,
{ controller: "/posts", format: "rss" },
title: "#{site_name} - Recent posts from all members")
title: "#{ENV['GROWSTUFF_SITE_NAME']} - Recent posts from all members")
= auto_discovery_link_tag(:rss,
{ controller: "/crops", format: "rss" },
title: "#{site_name} - Recently added crops")
title: "#{ENV['GROWSTUFF_SITE_NAME']} - Recently added crops")
= auto_discovery_link_tag(:rss,
{ controller: "/plantings", format: "rss" },
title: "#{site_name} - Recent plantings from all members")
title: "#{ENV['GROWSTUFF_SITE_NAME']} - Recent plantings from all members")
%title
= content_for?(:title) ? yield(:title) + " - #{site_name} " : site_name
= content_for?(:title) ? yield(:title) + " - #{ENV['GROWSTUFF_SITE_NAME']} " : ENV['GROWSTUFF_SITE_NAME']
= csrf_meta_tags
= stylesheet_link_tag "application", media: "all"

View File

@@ -6,6 +6,6 @@
%span.site-name Growstuff
.nav= render 'crops/search_bar'
.nav
%button.navbar-toggler.ml-auto{ "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-bs-target" => "#navbarSupportedContent", "data-bs-toggle" => "collapse", type: "button" }
%span.navbar-toggler-icon
%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'

View File

@@ -1,5 +1,5 @@
#navbarSupportedContent.collapse.navbar-collapse
%ul.navbar-nav.mr-auto.bg-dark
%ul.navbar-nav.mr-auto
- if signed_in?
%li.nav-item
= link_to timeline_index_path, method: :get, class: 'nav-link text-white' do
@@ -30,9 +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-bs-toggle" => "dropdown", href: "#", role: "button"}
%span
= 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')
@@ -46,9 +44,7 @@
= harvest_icon
= t('.harvests')
%li.nav-item.dropdown
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}
%span
= 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'
@@ -58,9 +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-bs-toggle" => "dropdown", href: "#", role: "button"}
%span
= 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'

View File

@@ -1,5 +1,5 @@
- cache member do
.card
.card.card-double
.card-body
%h4.login-name= link_to member, member
%div

View File

@@ -1,8 +1,8 @@
= content_for :title, t(".title", site_name: site_name)
= content_for :title, t(".title", site_name: ENV['GROWSTUFF_SITE_NAME'])
%h1
= member_icon
= t(".title", site_name: site_name)
= t(".title", site_name: ENV['GROWSTUFF_SITE_NAME'])
= bootstrap_form_tag(url: members_path, method: :get, layout: :inline) do |f|
= f.select "sort",
options_for_select({ "alphabetically": 'alpha', "recently joined": "recently_joined" },

View File

@@ -5,7 +5,7 @@
= tag("meta", property: "og:title", content: @member.login_name)
= tag("meta", property: "og:type", content: "profile")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :member_rss_login_name, @member.login_name
- content_for :member_rss_slug, @member.slug
@@ -82,8 +82,8 @@
.col-md-10#content
.row
%section.order-3.order-md-1.col-12= render "map", member: @member
- if @harvesting.size.positive?
%section.harvests.order-2.order-md-1.col-12
- if @harvesting.size.positive?
%section.harvests.order-2.order-md-1
%h2 Ready to harvest
.index-cards
- @harvesting.each do |planting|

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
%rss{ version: 2.0 }
%channel
%title #{@member.login_name}'s recent posts (#{site_name})
%title #{@member.login_name}'s recent posts (#{ENV['GROWSTUFF_SITE_NAME']})
%link= member_url(@member)
- @member.posts.each do |post|
%item

View File

@@ -1,4 +1,4 @@
%p
The #{site_name} team.
The #{ENV['GROWSTUFF_SITE_NAME']} team.
%br/
= link_to root_url, root_url

View File

@@ -6,7 +6,7 @@
%p
= @request.requester.login_name
has requested a new crop on
= site_name
= ENV['GROWSTUFF_SITE_NAME']
%ul
%li Name: #{@request.name}

View File

@@ -5,7 +5,7 @@
= tag("meta", property: "og:image:user_generated", content: "true")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Photos', photos_path

View File

@@ -21,7 +21,7 @@
- if planting.finish_is_predicatable?
.card.fact-card
%h3 Progress
- if planting.age_in_days.to_i < 0
- if planting.age_in_days < 0
%strong Planned
- else
%strong #{planting.age_in_days}/#{planting.expected_lifespan}
@@ -45,7 +45,7 @@
%h3 Growing
%strong= seedling_icon
%span
- if planting.age_in_days.to_i < 0
- if planting.age_in_days < 0
Planting planned
- else
Planting is still growing today

View File

@@ -2,7 +2,7 @@
%rss{ version: 2.0 }
%channel
%title
Recent plantings from #{@owner ? @owner : 'all members'} (#{site_name})
Recent plantings from #{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= plantings_url
- @plantings.each do |planting|
%item

View File

@@ -6,7 +6,7 @@
= tag("meta", property: "og:description", content: og_description(@planting.description))
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Plantings', plantings_path
@@ -39,10 +39,10 @@
- elsif @planting.percentage_grown.present?
#{@planting.percentage_grown.to_i}%
- if @planting.finish_is_predicatable?
- if @planting.age_in_days.to_i < 0
- if @planting.age_in_days < 0
%strong Planned
- else
%strong #{@planting.age_in_days.to_i}/#{@planting.expected_lifespan} days
%strong #{@planting.age_in_days}/#{@planting.expected_lifespan} days
= render 'timeline', planting: @planting
= render 'likes/likes', object: @planting

View File

@@ -2,7 +2,7 @@
%rss{ version: 2.0 }
%channel
%title
Recent posts from #{@author ? @author : 'all members'} (#{site_name})
Recent posts from #{@author ? @author : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= posts_url
- @posts.each do |post|
%item

View File

@@ -6,13 +6,13 @@
= tag("meta", property: "og:title", content: @post.subject)
= tag("meta", property: "og:type", content: "article")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- if @post.author && !current_member
.alert.alert-info
= link_to @post.author.login_name, member_path(@post.author)
is using
= link_to site_name, root_path
= link_to ENV["GROWSTUFF_SITE_NAME"], root_path
to discuss #{@post.subject} with a community of food gardeners worldwide.
We have advice on growing
= succeed "," do
@@ -20,7 +20,7 @@
and a community from all around the world.
= render "shared/signin_signup",
to: "or to start using #{site_name} to track what you're planting and harvesting"
to: "or to start using #{ENV['GROWSTUFF_SITE_NAME']} to track what you're planting and harvesting"
- content_for :buttonbar do
- if @post.comments.count > 10 && can?(:create, Comment)

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
%rss{ version: 2.0 }
%channel
%title Recent comments on #{@post.subject} (#{site_name})
%title Recent comments on #{@post.subject} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= post_url(@post)
- @post.comments.each do |comment|
%item

View File

@@ -2,7 +2,7 @@
%rss{ version: 2.0 }
%channel
%title
Recent seeds from #{@owner ||= 'all members'} (#{site_name})
Recent seeds from #{@owner ||= 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})
%link= seeds_url
- @seeds.each do |seed|
%item

View File

@@ -6,7 +6,7 @@
= tag("meta", property: "og:image", content: "#{@seed.owner}'s #{@seed.crop} seeds")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: site_name)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do

View File

@@ -1 +0,0 @@
%h1 Support #{site_name}

View File

@@ -175,6 +175,7 @@ en:
Our team includes volunteers from all walks of life and all skill levels. To get involved,
visit %{talk_link} or find more information on the %{wiki_link}.
get_involved_title: Get Involved
github_linktext: Github
open_data_body_html: >
We're building a database of crops, planting advice, seed sources, and other information that anyone
can use for free, under a %{creative_commons_link}. You can use this data for research, to build apps,
@@ -206,15 +207,10 @@ en:
view_all: View all seeds
stats:
member_linktext: "%{count} members"
message_html: So far, %{member} have planted %{number_crops} %{number_plantings} in %{number_gardens}; and %{contributors} people have contributed to our code on %{github}!
message_html: So far, %{member} have planted %{number_crops} %{number_plantings} in %{number_gardens}.
number_crops_linktext: "%{count} crops"
number_gardens_linktext: "%{count} gardens"
number_plantings_linktext: "%{count} times"
pwa_android_steps_html: 1. Tap the three dots in the top right corner of Chrome.<br>2. Tap <strong>Install app</strong> or <strong>Add to Home screen</strong>.
pwa_android_title: For Android
pwa_ios_steps_html: 1. Tap the <strong>Share</strong> button in Safari.<br>2. Scroll down and tap <strong>Add to Home Screen</strong>'.
pwa_ios_title: For iOS (iPhone/iPad)
pwa_title: Want to install Growstuff on your phone?
label:
days_until_harvest: "%{number} days"
weeks_until_harvest: "%{number} weeks until harvest"

View File

@@ -81,6 +81,7 @@ Rails.application.routes.draw do
get 'sunniness' => 'charts/crops#sunniness', constraints: { format: 'json' }
get 'planted_from' => 'charts/crops#planted_from', constraints: { format: 'json' }
get 'harvested_for' => 'charts/crops#harvested_for', constraints: { format: 'json' }
post :openfarm
post :gbif
collection do

View File

@@ -2,6 +2,6 @@
class AddLanguageToAlternateNames < ActiveRecord::Migration[7.2]
def change
add_column :alternate_names, :language, :string
add_column :alternate_names, :language, :string, null: false
end
end

View File

@@ -53,12 +53,4 @@ namespace :growstuff do
end
end
end
desc "Mark seeds as finished when plant-before date expires"
# usage: rake growstuff:finish_expired_seeds
task finish_expired_seeds: :environment do
Seed.expired.find_each do |seed|
seed.update(finished: true, finished_at: Time.zone.now)
end
end
end

View File

@@ -76,6 +76,10 @@ describe "crop detail page", :js do
expect(page).to have_link "Wikipedia (English)", href: crop.en_wikipedia_url
end
it "has a link to OpenFarm" do
expect(page).to have_link "OpenFarm - Growing guide"
end
it "has a link to gardenate" do
expect(page).to have_link "Gardenate - Planting reminders",
href: "https://www.gardenate.com/plant/#{CGI.escape crop.name}"
@@ -140,7 +144,7 @@ describe "crop detail page", :js do
let(:crop) { FactoryBot.create(:annual_crop) }
describe 'with harvests' do
it_behaves_like "predicts harvest"
include_examples "predicts harvest"
end
it "predicts lifespan" do
@@ -161,7 +165,7 @@ describe "crop detail page", :js do
end
describe 'with harvests' do
it_behaves_like "predicts harvest"
include_examples "predicts harvest"
end
it "describes Perennial crops" do
@@ -177,7 +181,7 @@ describe "crop detail page", :js do
end
describe 'with harvests' do
it_behaves_like "predicts harvest"
include_examples "predicts harvest"
end
end
end

View File

@@ -85,22 +85,21 @@ describe "home page", :search do
end
context 'when anonymous' do
it_behaves_like 'show crops'
it_behaves_like 'show plantings'
it_behaves_like 'show harvests'
it_behaves_like 'shows seeds'
it_behaves_like 'is accessible'
include_examples 'show crops'
include_examples 'show plantings'
include_examples 'show harvests'
include_examples 'shows seeds'
include_examples 'is accessible'
it { is_expected.to have_text 'community of food gardeners' }
it { is_expected.to have_text 'Want to install Growstuff on your phone?' }
end
context "when signed in" do
include_context 'signed in member'
it_behaves_like 'show crops'
it_behaves_like 'show plantings'
it_behaves_like 'show harvests'
it_behaves_like 'shows seeds'
it_behaves_like 'is accessible'
include_examples 'show crops'
include_examples 'show plantings'
include_examples 'show harvests'
include_examples 'shows seeds'
include_examples 'is accessible'
describe 'should say welcome' do
before { visit root_path }

View File

@@ -132,20 +132,6 @@ describe Seed do
end
end
context 'expired' do
it 'returns seeds with a plant_before date in the past' do
expired_seed = FactoryBot.create(:seed, plant_before: 1.day.ago)
not_expired_seed = FactoryBot.create(:seed, plant_before: 1.day.from_now)
described_class.expired.should include expired_seed
described_class.expired.should_not include not_expired_seed
end
it 'does not return finished seeds' do
expired_seed = FactoryBot.create(:seed, plant_before: 1.day.ago, finished: true)
described_class.expired.should_not include expired_seed
end
end
context 'interesting' do
it 'lists interesting seeds' do
# to be interesting a seed must:

View File

@@ -14,7 +14,7 @@ RSpec.configure do |config|
# By default, the operations defined in spec files are added to the first
# document below. You can override this behavior by adding a swagger_doc tag to the
# the root example_group in your specs, e.g. describe '...', swagger_doc: 'v2/swagger.json'
config.swagger_docs = {
config.openapi_specs = {
'v1/swagger.yaml' => {
openapi: '3.0.1',
info: {
@@ -29,5 +29,5 @@ RSpec.configure do |config|
# The swagger_docs configuration option has the filename including format in
# the key, this may want to be changed to avoid putting yaml in json files.
# Defaults to json. Accepts ':json' and ':yaml'.
config.swagger_format = :yaml
config.openapi_format = :yaml
end

6
swagger/v1/swagger.yaml Normal file
View File

@@ -0,0 +1,6 @@
---
openapi: 3.0.1
info:
title: API V1
version: v1
paths: {}