From 0c76dc02719a9924534fe0213b9edec3a7c05c68 Mon Sep 17 00:00:00 2001 From: Jennifer He Date: Mon, 1 Dec 2025 16:45:02 -0500 Subject: [PATCH 1/5] show.html.erb: one line change that render chapter info if work.chaptered? I assume the elseif is there for a reason --- app/views/downloads/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/downloads/show.html.erb b/app/views/downloads/show.html.erb index 03feed1a161..935c9e2f052 100644 --- a/app/views/downloads/show.html.erb +++ b/app/views/downloads/show.html.erb @@ -1,7 +1,7 @@ <%= render "downloads/download_preface" %>
- <% if @chapters.size > 1 %> + <% if @work.chaptered? %> <% for chapter in @chapters %> <%= render "downloads/download_chapter", chapter: chapter %> <% end %> From 8dd9104cecc8b2daf80ef7d902ac0247471751a1 Mon Sep 17 00:00:00 2001 From: Jennifer He Date: Wed, 3 Dec 2025 12:13:21 -0500 Subject: [PATCH 2/5] catch the drafts count --- app/views/downloads/show.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/downloads/show.html.erb b/app/views/downloads/show.html.erb index 935c9e2f052..916cfecf2c7 100644 --- a/app/views/downloads/show.html.erb +++ b/app/views/downloads/show.html.erb @@ -1,7 +1,8 @@ <%= render "downloads/download_preface" %>
- <% if @work.chaptered? %> + <%# chaptered? = expected_number_of_chapters != 1. This includes chapter titles and notes%> + <% if @work.chaptered? || @chapter.size > 1 %> <% for chapter in @chapters %> <%= render "downloads/download_chapter", chapter: chapter %> <% end %> From b8da794b7080066b3fa524d7d00118b94c849b87 Mon Sep 17 00:00:00 2001 From: Jennifer He Date: Wed, 3 Dec 2025 12:32:58 -0500 Subject: [PATCH 3/5] Tight conditions --- app/views/downloads/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/downloads/show.html.erb b/app/views/downloads/show.html.erb index 916cfecf2c7..7ba7dda33f5 100644 --- a/app/views/downloads/show.html.erb +++ b/app/views/downloads/show.html.erb @@ -1,8 +1,8 @@ <%= render "downloads/download_preface" %>
- <%# chaptered? = expected_number_of_chapters != 1. This includes chapter titles and notes%> - <% if @work.chaptered? || @chapter.size > 1 %> + <%# if chaptered and one chapter (this include notes and title) OR more than one chap %> + <% if (@work.chaptered? && @chapters.size == 1) || @chapter.size > 1 %> <% for chapter in @chapters %> <%= render "downloads/download_chapter", chapter: chapter %> <% end %> From e756f42b890464debb753386b8cd71862004b58b Mon Sep 17 00:00:00 2001 From: Jennifer He Date: Wed, 3 Dec 2025 12:43:38 -0500 Subject: [PATCH 4/5] typo --- app/views/downloads/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/downloads/show.html.erb b/app/views/downloads/show.html.erb index 7ba7dda33f5..0eb69524ac6 100644 --- a/app/views/downloads/show.html.erb +++ b/app/views/downloads/show.html.erb @@ -2,7 +2,7 @@
<%# if chaptered and one chapter (this include notes and title) OR more than one chap %> - <% if (@work.chaptered? && @chapters.size == 1) || @chapter.size > 1 %> + <% if (@work.chaptered? && @chapters.size == 1) || @chapters.size > 1 %> <% for chapter in @chapters %> <%= render "downloads/download_chapter", chapter: chapter %> <% end %> From 6cacfd1ba8ae9013a48220c37f1bfb00b370a375 Mon Sep 17 00:00:00 2001 From: Jennifer He Date: Wed, 3 Dec 2025 17:19:30 -0500 Subject: [PATCH 5/5] Cucumber test added --- features/works/work_download.feature | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/features/works/work_download.feature b/features/works/work_download.feature index 87b8a0743ae..54e16e5baec 100644 --- a/features/works/work_download.feature +++ b/features/works/work_download.feature @@ -438,3 +438,36 @@ Feature: Download a work And I should see "Chapter 1" And I should see "Chapter 2: Chapter Two Title" + Scenario: Download work with only one chapter expecting more chapters include chapter title and notes + + Given I am logged in as "myname" + And I set up the draft "Download" + And I fill in "Work Title" with "Download" + And I fill in "content" with "Content for chapter one." + And I check "This work has multiple chapters" + And I fill in "Chapter 1 of" with "?" + And I check "at the beginning" + And I fill in "Notes" with "Overall start notes" + And I check "at the end" + And I fill in "End Notes" with "Overall end notes" + And I press "Post" + When I go to the 1st chapter of the work "Download" + And I follow "Edit Chapter" + And I fill in "Chapter Title" with "Chapter One Title" + And I check "at the beginning" + And I fill in "Notes" with "Text of notes at chapter start" + And I check "at the end" + And I fill in "End Notes" with "Text of notes at chapter end" + And I press "Update" + When I view the work "Download" + And I follow "HTML" + Then I should receive a file of type "html" + And I should see "Overall start notes" + And I should see "Overall end notes" + And I should see "Chapter 1: Chapter One Title" + And I should see "Chapter Notes" + And I should see "Text of notes at chapter start" + And I should see "See the end of the chapter for more notes" + And I should see "Chapter End Notes" + And I should see "Text of notes at chapter end" +