Skip to content

Commit

Permalink
Merge pull request #1045 from brian-kephart/master
Browse files Browse the repository at this point in the history
Fix error rendering category pages
  • Loading branch information
brian-kephart authored Mar 24, 2023
2 parents 8f0ef38 + 23253a3 commit a485c6e
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [2.7.2](https://github.com/owen2345/camaleon-cms/tree/2.7.2) (2023-03-24)
- Fix bug rendering category pages

## [2.7.1](https://github.com/owen2345/camaleon-cms/tree/2.7.1) (2023-03-22)
- Fix common relationships

Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ source 'https://rubygems.org'
gemspec
gem 'non-digest-assets'
gem 'oj'
gem 'rails', '~> 7.0.0.rc1'
gem 'rails', '~> 7.0.0'
gem 'sassc', '!= 2.3.0' # this version segfaults
gem 'selenium-webdriver'
gem 'selenium-webdriver', "!= 4.8.2" # https://github.com/SeleniumHQ/selenium/issues/11815
gem 'webdrivers'

gem 'capybara-screenshot'
Expand Down
15 changes: 6 additions & 9 deletions app/controllers/camaleon_cms/frontend_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def index
# render category list
def category
begin
if params[:category_slug].present?
@category ||= current_site.the_full_categories.find_by_slug(params[:category_slug]).decorate
end
@category ||= current_site.the_full_categories.find_by_slug(params[:category_slug]).decorate if params[:category_slug].present?
@category ||= current_site.the_full_categories.find(params[:category_id]).decorate
@post_type = @category.the_post_type
rescue StandardError
Expand All @@ -49,12 +47,11 @@ def category
r_file = lookup_context.template_exists?("categories/#{@category.the_slug}") ? "categories/#{@category.the_slug}" : 'category'
end

unless layout_.present?
layout_ = lookup_context.template_exists?("layouts/post_types/#{@post_type.the_slug}/category") ? "post_types/#{@post_type.the_slug}/category" : nil
end
unless layout_.present?
layout_ = lookup_context.template_exists?("layouts/categories/#{@category.the_slug}") ? "categories/#{@category.the_slug}" : nil
end
layout_ = if lookup_context.template_exists?("layouts/post_types/#{@post_type.the_slug}/category")
"post_types/#{@post_type.the_slug}/category"
elsif lookup_context.template_exists?("layouts/categories/#{@category.the_slug}")
"categories/#{@category.the_slug}"
end
r = { category: @category, layout: layout_, render: r_file }
hooks_run('on_render_category', r)
render r[:render], (!r[:layout].nil? ? { layout: r[:layout] } : {})
Expand Down
3 changes: 1 addition & 2 deletions camaleon_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Gem::Specification.new do |s|
s.requirements << 'imagemagick'
# s.post_install_message = "Thank you for install Camaleon CMS."

s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md', 'public/**/*']
s.test_files = Dir['spec/**/*']
s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']

s.add_dependency 'bcrypt'
s.add_dependency 'breadcrumbs_on_rails'
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_6_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ gem 'puma'
gem 'rack_session_access'
gem 'rails', '~> 6.0.0'
gem 'rspec_junit_formatter'
gem 'selenium-webdriver'
gem 'selenium-webdriver', '!= 4.8.2'
gem 'sqlite3'
gem 'webdrivers'
2 changes: 1 addition & 1 deletion gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ gem 'puma'
gem 'rack_session_access'
gem 'rails', '~> 6.1.0'
gem 'rspec_junit_formatter'
gem 'selenium-webdriver'
gem 'selenium-webdriver', '!= 4.8.2'
gem 'sqlite3'
gem 'webdrivers'
2 changes: 1 addition & 1 deletion gemfiles/rails_7_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ gem 'puma'
gem 'rack_session_access'
gem 'rails', '~> 7.0.1'
gem 'rspec_junit_formatter'
gem 'selenium-webdriver'
gem 'selenium-webdriver', '!= 4.8.2'
gem 'sqlite3'
gem 'webdrivers'
2 changes: 1 addition & 1 deletion gemfiles/rails_edge.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ gem 'puma'
gem 'rack_session_access'
gem 'rails', github: 'rails/rails'
gem 'rspec_junit_formatter'
gem 'selenium-webdriver'
gem 'selenium-webdriver', '!= 4.8.2'
gem 'sqlite3'
gem 'webdrivers'
2 changes: 1 addition & 1 deletion lib/camaleon_cms/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CamaleonCms
VERSION = '2.7.1'.freeze
VERSION = '2.7.2'.freeze
end

0 comments on commit a485c6e

Please sign in to comment.