Skip to content

Commit

Permalink
Include foundation helper in more contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed May 13, 2024
1 parent 21c61af commit 4f4743e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
module Bridgetown
class Configuration
class ConfigurationDSL < Bridgetown::FrontMatter::RubyFrontMatter
include Bridgetown::Foundation::RefinementsHelper

attr_reader :context

# @yieldself [ConfigurationDSL]
Expand Down
2 changes: 2 additions & 0 deletions bridgetown-core/lib/roda/plugins/bridgetown_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def root_hook(&block)
end

module InstanceMethods
include Bridgetown::Foundation::RefinementsHelper

def initialize_bridgetown_context
if self.class.opts[:bridgetown_site]
# The site had previously been initialized via the bridgetown_ssr plugin
Expand Down
2 changes: 2 additions & 0 deletions bridgetown-routes/test/ssr/config/initializers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
config.available_locales = [:en, :it]
config.default_locale = :en
config.prefix_default_locale = false

# puts foundation(Bridgetown.env.to_sym).within?([:test, :production]) # => true
end
2 changes: 1 addition & 1 deletion bridgetown-routes/test/ssr/src/_routes/howdy.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---<%
render_with(data: {
title: "#{params[:yo]} #{@answer_to_life}"
title: "#{params[:yo]} #{@answer_to_life} #{foundation(3).within?([1,2,3])}"
})
%>---

Expand Down
2 changes: 1 addition & 1 deletion bridgetown-routes/test/test_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def site

should "return HTML for the howdy route" do
get "/howdy?yo=joe&happy=pleased"
assert_equal "<h1>joe 42</h1>\n\n<p>I am pleasedpleased.</p>\n", last_response.body
assert_equal "<h1>joe 42 true</h1>\n\n<p>I am pleasedpleased.</p>\n", last_response.body
end

should "return HTML for a route in an arbitrary folder" do
Expand Down

0 comments on commit 4f4743e

Please sign in to comment.