From 9bf1cbb5a02a5b89f7f910c6d57a203fa3fbf638 Mon Sep 17 00:00:00 2001 From: maebeale Date: Tue, 3 Mar 2026 09:31:31 -0500 Subject: [PATCH 1/5] Display category types and Windows labels in sentence case Replace .titleize with .humanize for category type display so labels render as sentence case (e.g. "Art type" instead of "Art Type"). Rename all user-facing "Windows type" / "Windows Type" strings to "Windows audience" for consistency with the updated terminology. Co-Authored-By: Claude Opus 4.6 --- app/controllers/windows_types_controller.rb | 6 +++--- app/decorators/category_type_decorator.rb | 2 +- app/helpers/admin_cards_helper.rb | 2 +- app/models/category_type.rb | 2 +- app/views/admin/ahoy_activities/charts.html.erb | 2 +- app/views/bookmarks/_search_fields.html.erb | 2 +- app/views/organizations/_form.html.erb | 4 ++-- app/views/organizations/_search_boxes.html.erb | 2 +- app/views/stories/_story_results.html.erb | 2 +- app/views/story_ideas/index.html.erb | 2 +- .../workshop_log_creation_wizard/_form.html.erb | 2 +- app/views/workshops/_dropdown_filter.html.erb | 2 +- app/views/workshops/_filters.html.erb | 2 +- spec/decorators/category_type_decorator_spec.rb | 15 +++++++++++++++ spec/models/category_type_spec.rb | 12 ++++++++++++ 15 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 spec/decorators/category_type_decorator_spec.rb diff --git a/app/controllers/windows_types_controller.rb b/app/controllers/windows_types_controller.rb index b0df30cde..5dd24a17f 100644 --- a/app/controllers/windows_types_controller.rb +++ b/app/controllers/windows_types_controller.rb @@ -33,7 +33,7 @@ def create @windows_type.categories = Category.where(id: selected_ids) if @windows_type.save - redirect_to @windows_type, notice: "Windows type was successfully created." + redirect_to @windows_type, notice: "Windows audience was successfully created." else set_form_variables render :new, status: :unprocessable_content @@ -47,7 +47,7 @@ def update @windows_type.categories = Category.where(id: selected_ids) if @windows_type.update(windows_type_params) - redirect_to @windows_type, notice: "Windows type was successfully updated.", status: :see_other + redirect_to @windows_type, notice: "Windows audience was successfully updated.", status: :see_other else set_form_variables render :edit, status: :unprocessable_content @@ -57,7 +57,7 @@ def update def destroy authorize! @windows_type @windows_type.destroy! - redirect_to windows_types_path, notice: "Windows type was successfully destroyed." + redirect_to windows_types_path, notice: "Windows audience was successfully destroyed." end # Optional hooks for setting variables for forms or index diff --git a/app/decorators/category_type_decorator.rb b/app/decorators/category_type_decorator.rb index e49c32ec3..bcdb02dc9 100644 --- a/app/decorators/category_type_decorator.rb +++ b/app/decorators/category_type_decorator.rb @@ -1,6 +1,6 @@ class CategoryTypeDecorator < ApplicationDecorator def title - name.titleize + name.humanize end def detail(length: nil) diff --git a/app/helpers/admin_cards_helper.rb b/app/helpers/admin_cards_helper.rb index 22ba7ffb3..8c66b2dfc 100644 --- a/app/helpers/admin_cards_helper.rb +++ b/app/helpers/admin_cards_helper.rb @@ -52,7 +52,7 @@ def reference_cards intensity: 100, title: "Sectors", params: { published: true }), - custom_card("Windows types", windows_types_path, icon: "🪟") + custom_card("Windows audiences", windows_types_path, icon: "🪟") ] end diff --git a/app/models/category_type.rb b/app/models/category_type.rb index fab3eb068..813e3859c 100644 --- a/app/models/category_type.rb +++ b/app/models/category_type.rb @@ -14,6 +14,6 @@ class CategoryType < ApplicationRecord scope :profile_specific, -> { where(profile_specific: true) } def display_label - display_text.presence || name.titleize + display_text.presence || name.humanize end end diff --git a/app/views/admin/ahoy_activities/charts.html.erb b/app/views/admin/ahoy_activities/charts.html.erb index 93e13251b..63a904abb 100644 --- a/app/views/admin/ahoy_activities/charts.html.erb +++ b/app/views/admin/ahoy_activities/charts.html.erb @@ -139,7 +139,7 @@
- <%= bar_chart(@ws_windows_types, title: "Workshop Search: Windows Types") %> + <%= bar_chart(@ws_windows_types, title: "Workshop search: Windows audiences") %>
diff --git a/app/views/bookmarks/_search_fields.html.erb b/app/views/bookmarks/_search_fields.html.erb index 6d90a04f1..fbf57ed33 100644 --- a/app/views/bookmarks/_search_fields.html.erb +++ b/app/views/bookmarks/_search_fields.html.erb @@ -42,7 +42,7 @@
- <%= label_tag :windows_type, "Windows type", class: "block text-sm font-medium text-gray-700 mb-1" %> + <%= label_tag :windows_type, "Windows audience", class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= select_tag :windows_type, options_for_select(@windows_types_array, diff --git a/app/views/organizations/_form.html.erb b/app/views/organizations/_form.html.erb index d5ef7b191..0b32a516d 100644 --- a/app/views/organizations/_form.html.erb +++ b/app/views/organizations/_form.html.erb @@ -22,7 +22,7 @@
- +
@@ -50,7 +50,7 @@
<%= f.association :windows_type, - label: "Windows Type", + label: "Windows audience", include_blank: true, required: false, input_html: { diff --git a/app/views/organizations/_search_boxes.html.erb b/app/views/organizations/_search_boxes.html.erb index 8fa0d0bc0..c06da8533 100644 --- a/app/views/organizations/_search_boxes.html.erb +++ b/app/views/organizations/_search_boxes.html.erb @@ -10,7 +10,7 @@ focus:border-blue-500 focus:ring focus:ring-blue-200 focus:outline-none" %>
- <%= label_tag :windows_type_name, "Windows type", class: "text-sm font-medium text-gray-700 mb-1 block" %> + <%= label_tag :windows_type_name, "Windows audience", class: "text-sm font-medium text-gray-700 mb-1 block" %> <%= select_tag :windows_type_name, options_for_select(WindowsType::TYPES.map { |wt| [wt, wt] }, params[:windows_type_name]), diff --git a/app/views/stories/_story_results.html.erb b/app/views/stories/_story_results.html.erb index 2f978e48e..7573b259d 100644 --- a/app/views/stories/_story_results.html.erb +++ b/app/views/stories/_story_results.html.erb @@ -22,7 +22,7 @@ <%= sort_link.call("title", "Title") %> - <%= sort_link.call("windows_type", "Windows Type") %> + <%= sort_link.call("windows_type", "Windows audience") %> <%= sort_link.call("workshop", "Workshop") %> <%= sort_link.call("author", "Author") %> <%= sort_link.call("organization", "Organization") %> diff --git a/app/views/story_ideas/index.html.erb b/app/views/story_ideas/index.html.erb index 47112e8a6..6624fdc6d 100644 --- a/app/views/story_ideas/index.html.erb +++ b/app/views/story_ideas/index.html.erb @@ -22,7 +22,7 @@ Image Author Name - Windows Type + Windows audience Workshop Organization Updated At diff --git a/app/views/workshop_log_creation_wizard/_form.html.erb b/app/views/workshop_log_creation_wizard/_form.html.erb index feb5d759b..b82bd98b1 100644 --- a/app/views/workshop_log_creation_wizard/_form.html.erb +++ b/app/views/workshop_log_creation_wizard/_form.html.erb @@ -9,7 +9,7 @@ <%= f.hidden_field :id %> <%= f.hidden_field :log_id, value: @old_report ? @old_report.id : nil %> <% if @windows_types && !workshop.id %> - <%= f.label 'New Workshop Windows Type', class: 'bold' %> + <%= f.label 'New workshop Windows audience', class: 'bold' %> <%= f.select :windows_type_id, @windows_types.map { |wtype| [wtype.name, wtype.id]} %> <% end %>
diff --git a/app/views/workshops/_dropdown_filter.html.erb b/app/views/workshops/_dropdown_filter.html.erb index d83dbba21..fa4fe75ff 100644 --- a/app/views/workshops/_dropdown_filter.html.erb +++ b/app/views/workshops/_dropdown_filter.html.erb @@ -41,7 +41,7 @@ id: "#{param_name}_#{item.id}", class: "category-checkbox" %> <%= label_tag "#{param_name}_#{item.id}", - item.public_send(label_method).titleize, + item.public_send(label_method).humanize, class: "text-sm text-gray-700" %>
<% end %> diff --git a/app/views/workshops/_filters.html.erb b/app/views/workshops/_filters.html.erb index 1d176ffe5..07d1c2955 100644 --- a/app/views/workshops/_filters.html.erb +++ b/app/views/workshops/_filters.html.erb @@ -26,7 +26,7 @@ <%= render "dropdown_filter", dom_id_prefix: "windows-types", - label_text: "Windows Audience", + label_text: "Windows audience", items: @windows_types, label_method: :short_name, param_name: :windows_types %> diff --git a/spec/decorators/category_type_decorator_spec.rb b/spec/decorators/category_type_decorator_spec.rb new file mode 100644 index 000000000..16b06853c --- /dev/null +++ b/spec/decorators/category_type_decorator_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +RSpec.describe CategoryTypeDecorator do + describe '#title' do + it 'returns the name in sentence case' do + category_type = build(:category_type, name: "art_type").decorate + expect(category_type.title).to eq("Art type") + end + + it 'capitalizes only the first word' do + category_type = build(:category_type, name: "emotional_theme").decorate + expect(category_type.title).to eq("Emotional theme") + end + end +end diff --git a/spec/models/category_type_spec.rb b/spec/models/category_type_spec.rb index a652e9790..c403c0e16 100644 --- a/spec/models/category_type_spec.rb +++ b/spec/models/category_type_spec.rb @@ -17,6 +17,18 @@ it { should validate_presence_of(:name) } end + describe '#display_label' do + it 'returns display_text when present' do + category_type = build(:category_type, name: "art_type", display_text: "Custom Label") + expect(category_type.display_label).to eq("Custom Label") + end + + it 'returns sentence-cased name when display_text is blank' do + category_type = build(:category_type, name: "art_type", display_text: nil) + expect(category_type.display_label).to eq("Art type") + end + end + describe 'scopes' do let!(:published_category_type) { create(:category_type, :published) } let!(:unpublished_category_type) { create(:category_type) } From 25718d590a37699e7291cdc08a0211ec9a47105a Mon Sep 17 00:00:00 2001 From: maebeale Date: Wed, 4 Mar 2026 05:39:17 -0500 Subject: [PATCH 2/5] Lowercase 'windows' in workshop log wizard label Co-Authored-By: Claude Opus 4.6 --- app/views/workshop_log_creation_wizard/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/workshop_log_creation_wizard/_form.html.erb b/app/views/workshop_log_creation_wizard/_form.html.erb index b82bd98b1..c2b79ac76 100644 --- a/app/views/workshop_log_creation_wizard/_form.html.erb +++ b/app/views/workshop_log_creation_wizard/_form.html.erb @@ -9,7 +9,7 @@ <%= f.hidden_field :id %> <%= f.hidden_field :log_id, value: @old_report ? @old_report.id : nil %> <% if @windows_types && !workshop.id %> - <%= f.label 'New workshop Windows audience', class: 'bold' %> + <%= f.label 'New workshop windows audience', class: 'bold' %> <%= f.select :windows_type_id, @windows_types.map { |wtype| [wtype.name, wtype.id]} %> <% end %>
From c10af79382e293e73f396a9b503fc5860c11b9e1 Mon Sep 17 00:00:00 2001 From: maebeale Date: Wed, 4 Mar 2026 05:54:15 -0500 Subject: [PATCH 3/5] Update AgeRange seeds: rename Teen to 13-17, fix casing, add positions Co-Authored-By: Claude Opus 4.6 --- db/seeds.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index be5255c60..97e564641 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -283,10 +283,10 @@ def find_or_create_by_name!(klass, name, **attrs, &block) category_type_categories = [ [ "AgeRange", "3-5" ], [ "AgeRange", "6-12" ], - [ "AgeRange", "Teen" ], + [ "AgeRange", "13-17" ], [ "AgeRange", "18+" ], [ "AgeRange", "Mixed-age groups" ], - [ "AgeRange", "Family Windows" ], + [ "AgeRange", "Family windows" ], # ["ArtType", "Boxes", 1], [ "ArtType", "Clay", 11 ], [ "ArtType", "Collage", 2 ], @@ -399,6 +399,12 @@ def find_or_create_by_name!(klass, name, **attrs, &block) cat.update!(published: true) unless cat.published? end +puts "Setting AgeRange category positions…" +age_range_order = ["3-5", "6-12", "13-17", "18+", "Mixed-age groups", "Family windows"] +age_range_order.each_with_index do |name, i| + Category.where("LOWER(name) = LOWER(?)", name).update_all(position: i + 1) +end + puts "Creating StoryPopulation CategoryType…" story_population_type = find_or_create_by_name!(CategoryType, "StoryPopulation") do |ct| ct.display_text = "Who is this story about?" From 3ef1a42ed973b54a73f1c56d537e71d278bf2fc4 Mon Sep 17 00:00:00 2001 From: maebeale Date: Wed, 4 Mar 2026 07:51:06 -0500 Subject: [PATCH 4/5] Fix CI failures: update specs for sentence case labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix RuboCop SpaceInsideArrayLiteralBrackets in seeds.rb - Update workshops system specs: "Windows Audience" → "Windows audience" - Update stories view spec: "Age Range" → "Age range" - Update person filters test: "Windows Type" → "Windows audience" Co-Authored-By: Claude Opus 4.6 --- db/seeds.rb | 2 +- spec/system/person_filters_workshops_test.rb | 2 +- spec/system/workshops_spec.rb | 4 ++-- spec/views/stories/new.html.erb_spec.rb | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 97e564641..944138a96 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -400,7 +400,7 @@ def find_or_create_by_name!(klass, name, **attrs, &block) end puts "Setting AgeRange category positions…" -age_range_order = ["3-5", "6-12", "13-17", "18+", "Mixed-age groups", "Family windows"] +age_range_order = [ "3-5", "6-12", "13-17", "18+", "Mixed-age groups", "Family windows" ] age_range_order.each_with_index do |name, i| Category.where("LOWER(name) = LOWER(?)", name).update_all(position: i + 1) end diff --git a/spec/system/person_filters_workshops_test.rb b/spec/system/person_filters_workshops_test.rb index 64d6977fe..f483c918d 100644 --- a/spec/system/person_filters_workshops_test.rb +++ b/spec/system/person_filters_workshops_test.rb @@ -41,7 +41,7 @@ expect(page).to have_content('The best workshop in the world') expect(page).to have_content('oh hello!') expect(page).to have_content('The best workshop on mars') - expect(page).to have_content('Windows Type') + expect(page).to have_content('Windows audience') expect(page).to have_content('Sector') expect(page).to have_content('Visibility') end diff --git a/spec/system/workshops_spec.rb b/spec/system/workshops_spec.rb index 5ee3b95e7..f9a6918e8 100644 --- a/spec/system/workshops_spec.rb +++ b/spec/system/workshops_spec.rb @@ -34,7 +34,7 @@ fill_in 'query', with: 'best workshop' # Open the dropdown - click_on "Windows Audience" # this clicks the