Module: Staticky::Phlex::ViewHelpers
- Defined in:
- lib/staticky/phlex/view_helpers.rb
Instance Method Summary collapse
- #helpers ⇒ Object
-
#link_to(text = nil, href, &block) ⇒ Object
rubocop:disable Style/OptionalArguments.
- #staticky_live_reload_js(base_path = "/") ⇒ Object
Instance Method Details
#helpers ⇒ Object
6 7 8 |
# File 'lib/staticky/phlex/view_helpers.rb', line 6 def helpers context[:helpers] end |
#link_to(text = nil, href, &block) ⇒ Object
rubocop:disable Style/OptionalArguments
16 17 18 19 20 21 22 |
# File 'lib/staticky/phlex/view_helpers.rb', line 16 def link_to(text = nil, href, **, &block) # rubocop:disable Style/OptionalArguments block ||= proc { text } href = Staticky.router.resolve(href) href = href.uri.to_s unless href.is_a?(String) a(href:, **, &block) end |
#staticky_live_reload_js(base_path = "/") ⇒ Object
10 11 12 13 14 |
# File 'lib/staticky/phlex/view_helpers.rb', line 10 def staticky_live_reload_js(base_path = "/") script(type: :module) do raw safe(Staticky::Utils.live_reload_js(base_path)) end end |