From 0544abcd8fe0b359b76103f73a3b46327fa31b2b Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sun, 31 Aug 2025 03:16:28 +0000 Subject: [PATCH] Github lure --- app/helpers/application_helper.rb | 4 ++++ app/views/home/_stats.html.haml | 6 +++--- app/views/home/index.html.haml | 1 + config/locales/en.yml | 3 +-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9506cabf3..98fb076be 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -21,6 +21,10 @@ 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 diff --git a/app/views/home/_stats.html.haml b/app/views/home/_stats.html.haml index 9d5f189ca..5baec4006 100644 --- a/app/views/home/_stats.html.haml +++ b/app/views/home/_stats.html.haml @@ -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)) - - + 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')) diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 838ed3c92..6e8c60d9a 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -8,6 +8,7 @@ %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 diff --git a/config/locales/en.yml b/config/locales/en.yml index fdaa542ef..4226f7f41 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -175,7 +175,6 @@ 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, @@ -207,7 +206,7 @@ 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}. + message_html: So far, %{member} have planted %{number_crops} %{number_plantings} in %{number_gardens}; and %{contributors} people have contributed to our code on %{github}! number_crops_linktext: "%{count} crops" number_gardens_linktext: "%{count} gardens" number_plantings_linktext: "%{count} times"