Skip to content

Commit c84ef56

Browse files
etewiahclaude
andcommitted
feat: Enable theme inheritance and remove duplicate files
Connect Theme#view_paths to controller for proper parent-child inheritance. Child themes now automatically fallback to parent theme views when a file doesn't exist locally. Changes: - Update set_theme_path in ApplicationController to use Theme model - Remove 19 identical files from brisbane and biarritz themes - Add BEM implementation plan documentation This reduces maintenance burden for future CSS/styling updates since changes to the default theme will automatically propagate to child themes. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 78c3121 commit c84ef56

21 files changed

+122
-1560
lines changed

app/controllers/pwb/application_controller.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,17 @@ def set_theme_path
3838
end
3939
end
4040
theme_name = theme_name.present? ? theme_name : "default"
41-
# Use Rails.root for theme paths
42-
prepend_view_path "#{Rails.root}/app/themes/#{theme_name}/views/"
41+
42+
# Use Theme model's view_paths for proper inheritance support
43+
# This allows child themes to automatically inherit views from parent themes
44+
theme = Theme.find_by(name: theme_name) || Theme.find_by(name: "default")
45+
if theme
46+
# Prepend in reverse order so theme-specific paths have highest priority
47+
theme.view_paths.reverse_each { |path| prepend_view_path path }
48+
else
49+
# Fallback to hardcoded path if theme not found
50+
prepend_view_path "#{Rails.root}/app/themes/#{theme_name}/views/"
51+
end
4352

4453
self.class.layout "layouts/pwb/application"
4554
end

app/themes/biarritz/views/pwb/components/_form_and_map.html.erb

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/themes/biarritz/views/pwb/components/_generic_page_part.html.erb

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/themes/biarritz/views/pwb/search/_search_form_for_rent.html.erb

Lines changed: 0 additions & 158 deletions
This file was deleted.

app/themes/biarritz/views/pwb/search/_search_form_for_sale.html.erb

Lines changed: 0 additions & 158 deletions
This file was deleted.

0 commit comments

Comments
 (0)