Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
63 lines
1.6 KiB
Ruby
63 lines
1.6 KiB
Ruby
# Code inspired by
|
|
# http://royvandermeij.com/blog/2011/09/21/create-a-liquid-handler-for-rails-3-dot-1/
|
|
# https://github.com/chamnap/liquid-rails/blob/master/lib/liquid-rails/template_handler.rb
|
|
|
|
class ActionView::Template::Handlers::Liquid
|
|
def self.call(template, _source)
|
|
"ActionView::Template::Handlers::Liquid.new(self).render(#{template.source.inspect}, local_assigns)"
|
|
end
|
|
|
|
def initialize(view)
|
|
@view = view
|
|
@controller = @view.controller
|
|
@helper = ActionController::Base.helpers
|
|
end
|
|
|
|
def render(template, local_assigns = {})
|
|
assigns = drops
|
|
assigns['content_for_layout'] = @view.content_for(:layout) if @view.content_for?(:layout)
|
|
assigns.merge!(local_assigns)
|
|
assigns.merge!(locals)
|
|
|
|
liquid = Liquid::Template.parse(template)
|
|
liquid.send(render_method, assigns.stringify_keys, filters: filters, registers: registers.stringify_keys)
|
|
end
|
|
|
|
def locals
|
|
if @controller.respond_to?(:liquid_locals, true)
|
|
@controller.send(:liquid_locals)
|
|
else
|
|
{}
|
|
end
|
|
end
|
|
|
|
def drops
|
|
droppables = @controller.send(:liquid_droppables) if @controller.respond_to?(:liquid_droppables, true)
|
|
droppables.update(droppables) { |_, obj| obj.try(:to_drop) || nil }
|
|
end
|
|
|
|
def filters
|
|
if @controller.respond_to?(:liquid_filters, true)
|
|
@controller.send(:liquid_filters)
|
|
else
|
|
[]
|
|
end
|
|
end
|
|
|
|
def registers
|
|
if @controller.respond_to?(:liquid_registers, true)
|
|
@controller.send(:liquid_registers)
|
|
else
|
|
{}
|
|
end
|
|
end
|
|
|
|
def compilable?
|
|
false
|
|
end
|
|
|
|
def render_method
|
|
::Rails.env.development? || ::Rails.env.test? ? :render! : :render
|
|
end
|
|
end
|