diff --git a/CHANGELOG.md b/CHANGELOG.md index 02758f3..5ffeb2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.0] - 2024-05-06 + +- Another refactor to support latest updates in Bridgetown v2 + ## [0.3.0] - 2024-04-07 - Refactor how Bridgetown's view layer is integrated with Rodauth, improve performance diff --git a/lib/authtown/version.rb b/lib/authtown/version.rb index 97a03f9..fd5e434 100644 --- a/lib/authtown/version.rb +++ b/lib/authtown/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Authtown - VERSION = "0.3.0" + VERSION = "0.4.0" end diff --git a/lib/authtown/view_mixin.rb b/lib/authtown/view_mixin.rb index ed2cb58..326d0f6 100644 --- a/lib/authtown/view_mixin.rb +++ b/lib/authtown/view_mixin.rb @@ -41,23 +41,11 @@ def view(*args, view_class: Bridgetown::ERBView, **kwargs) # rubocop:disable Met "#{kwargs.dig(:locals, :rodauth).prefix.delete_prefix("/")}/#{kwargs[:template]}" end - # TODO: this should really be some sort of exposed method from the routes plugin - response["X-Bridgetown-SSR"] = "1" + routes_manifest.routes.each do |route| + file, localized_slugs = route + next unless localized_slugs.first == kwargs[:template] - Bridgetown::Routes::Manifest.generate_manifest(bridgetown_site).each do |route| - file, localized_file_slugs = route - - file_slug = localized_file_slugs.first - - next unless file_slug == kwargs[:template] - - Bridgetown::Routes::CodeBlocks.eval_route_file file, file_slug, self - route_block = Bridgetown::Routes::CodeBlocks.route_block(file_slug) - response.instance_variable_set( - :@_route_file_code, route_block.instance_variable_get(:@_route_file_code) - ) # could be nil - @_route_locals = kwargs[:locals] - return instance_exec(request, &route_block) + return run_file_route(file, slug: localized_slugs.first) end Bridgetown.logger.warn("Rodauth template not found: #{kwargs[:template]}")