From 7bda7a9b50d1bf4c4fb62ec66c423cfe9511c5de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 14:29:43 +0000 Subject: [PATCH 1/4] Initial plan From fc66820874aa2ba486cdd198001737ad407e5e76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 14:33:39 +0000 Subject: [PATCH 2/4] Add story tips PDF link to story ideas form with seed resources Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- app/views/story_ideas/_form.html.erb | 11 ++++ db/seeds.rb | 3 + lib/tasks/seed_resources.rake | 54 ++++++++++++++++++ public/documents/README.md | 31 ++++++++++ .../tips_for_sharing_impactful_stories.pdf | Bin public/images/info-icon.png | 0 6 files changed, 99 insertions(+) create mode 100644 lib/tasks/seed_resources.rake create mode 100644 public/documents/README.md create mode 100644 public/documents/tips_for_sharing_impactful_stories.pdf create mode 100644 public/images/info-icon.png diff --git a/app/views/story_ideas/_form.html.erb b/app/views/story_ideas/_form.html.erb index f2c04b8c1..e90bfd321 100644 --- a/app/views/story_ideas/_form.html.erb +++ b/app/views/story_ideas/_form.html.erb @@ -14,6 +14,17 @@ <% end %> <%= render 'shared/errors', resource: story_idea if story_idea.errors.any? %> <%# = f.object.errors.full_messages %> + + +
+
+ <%= link_to "/documents/tips_for_sharing_impactful_stories.pdf", target: "_blank", class: "inline-flex items-center text-blue-600 hover:text-blue-800 font-bold" do %> + <%= image_tag "info-icon.png", alt: "Info", class: "w-5 h-5 mr-2" %> + Download Story Tips PDF + <% end %> +
+
+ <%# = f.input :title, diff --git a/db/seeds.rb b/db/seeds.rb index 50862a25b..b1631b0ad 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -169,3 +169,6 @@ metadata.categories.find_or_create_by!(name: category_name) end end + +puts "Downloading seed resources (PDFs, images)…" +Rake::Task['seed:resources'].invoke diff --git a/lib/tasks/seed_resources.rake b/lib/tasks/seed_resources.rake new file mode 100644 index 000000000..374932f11 --- /dev/null +++ b/lib/tasks/seed_resources.rake @@ -0,0 +1,54 @@ +namespace :seed do + desc "Download seed resources (PDFs, images) from external sources" + task resources: :environment do + require 'open-uri' + + puts "Downloading seed resources..." + + # Create directories if they don't exist + FileUtils.mkdir_p(Rails.root.join('public', 'documents')) + FileUtils.mkdir_p(Rails.root.join('public', 'images')) + + # Download Tips for Sharing Impactful Stories PDF + pdf_path = Rails.root.join('public', 'documents', 'tips_for_sharing_impactful_stories.pdf') + unless File.exist?(pdf_path) && File.size(pdf_path) > 0 + puts "Downloading Tips for Sharing Impactful Stories PDF..." + begin + URI.open('https://res.cloudinary.com/a-window-between-worlds/image/upload/v1750730476/Tips_for_Sharing_Impactful_Stories_lkuime.pdf') do |remote| + File.open(pdf_path, 'wb') do |local| + local.write(remote.read) + end + end + puts "✓ Downloaded tips_for_sharing_impactful_stories.pdf" + rescue => e + puts "⚠ Warning: Failed to download PDF: #{e.message}" + puts " You can manually download from:" + puts " https://res.cloudinary.com/a-window-between-worlds/image/upload/v1750730476/Tips_for_Sharing_Impactful_Stories_lkuime.pdf" + end + else + puts "✓ tips_for_sharing_impactful_stories.pdf already exists" + end + + # Download info icon + icon_path = Rails.root.join('public', 'images', 'info-icon.png') + unless File.exist?(icon_path) && File.size(icon_path) > 0 + puts "Downloading info icon..." + begin + URI.open('https://stories.awbw.org/wp-content/uploads/2021/08/info-1.png') do |remote| + File.open(icon_path, 'wb') do |local| + local.write(remote.read) + end + end + puts "✓ Downloaded info-icon.png" + rescue => e + puts "⚠ Warning: Failed to download icon: #{e.message}" + puts " You can manually download from:" + puts " https://stories.awbw.org/wp-content/uploads/2021/08/info-1.png" + end + else + puts "✓ info-icon.png already exists" + end + + puts "\nSeed resources setup complete!" + end +end diff --git a/public/documents/README.md b/public/documents/README.md new file mode 100644 index 000000000..420411c28 --- /dev/null +++ b/public/documents/README.md @@ -0,0 +1,31 @@ +# Documents Directory + +This directory contains downloadable resources for the application. + +## Setup Instructions + +After cloning the repository, download the following files: + +### 1. Tips for Sharing Impactful Stories PDF + +Download from cloudinary and place in this directory: + +```bash +curl -L "https://res.cloudinary.com/a-window-between-worlds/image/upload/v1750730476/Tips_for_Sharing_Impactful_Stories_lkuime.pdf" -o public/documents/tips_for_sharing_impactful_stories.pdf +``` + +Original URL: https://res.cloudinary.com/a-window-between-worlds/image/upload/v1750730476/Tips_for_Sharing_Impactful_Stories_lkuime.pdf + +### 2. Info Icon + +Download the info icon and place in `public/images/`: + +```bash +curl -L "https://stories.awbw.org/wp-content/uploads/2021/08/info-1.png" -o public/images/info-icon.png +``` + +Original URL: https://stories.awbw.org/wp-content/uploads/2021/08/info-1.png + +## Usage + +These files are referenced in the story ideas form (`app/views/story_ideas/_form.html.erb`) to provide helpful tips to users when sharing stories. diff --git a/public/documents/tips_for_sharing_impactful_stories.pdf b/public/documents/tips_for_sharing_impactful_stories.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/public/images/info-icon.png b/public/images/info-icon.png new file mode 100644 index 000000000..e69de29bb From aa1ff6a25e17ecfe66426cb51f15d11595e2ee8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 14:34:20 +0000 Subject: [PATCH 3/4] Update README with automatic setup instructions Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- public/documents/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/public/documents/README.md b/public/documents/README.md index 420411c28..c0afe7a3e 100644 --- a/public/documents/README.md +++ b/public/documents/README.md @@ -2,9 +2,19 @@ This directory contains downloadable resources for the application. -## Setup Instructions +## Automatic Setup -After cloning the repository, download the following files: +Run the seed resources rake task to automatically download all required files: + +```bash +bundle exec rake seed:resources +``` + +This task is also automatically run when you execute `bin/rails db:seed`. + +## Manual Setup + +If automatic download fails or you prefer manual download: ### 1. Tips for Sharing Impactful Stories PDF From 64a58886666cb3ba0617873f8744d5a04b71c9ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 14:35:35 +0000 Subject: [PATCH 4/4] Address code review feedback: fix capitalization and use ASCII ellipsis Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- db/seeds.rb | 2 +- public/documents/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index b1631b0ad..f5203dee7 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -170,5 +170,5 @@ end end -puts "Downloading seed resources (PDFs, images)…" +puts "Downloading seed resources (PDFs, images)..." Rake::Task['seed:resources'].invoke diff --git a/public/documents/README.md b/public/documents/README.md index c0afe7a3e..886d63347 100644 --- a/public/documents/README.md +++ b/public/documents/README.md @@ -18,7 +18,7 @@ If automatic download fails or you prefer manual download: ### 1. Tips for Sharing Impactful Stories PDF -Download from cloudinary and place in this directory: +Download from Cloudinary and place in this directory: ```bash curl -L "https://res.cloudinary.com/a-window-between-worlds/image/upload/v1750730476/Tips_for_Sharing_Impactful_Stories_lkuime.pdf" -o public/documents/tips_for_sharing_impactful_stories.pdf