7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/lcp_ruby/display/renderers/workflow_timeline.rb', line 7
def render(value, options = {}, record: nil, view_context: nil)
workflow = resolve_workflow(options)
steps = resolve_steps(workflow, options)
return value.to_s if steps.empty?
colors = resolve_colors(steps, workflow, options)
current_state = value.to_s.presence
current_index = steps.index(current_state)
show_icons = options.fetch("show_icons", true)
show_labels = options.fetch("show_labels", true)
compact = options.fetch("compact", false)
html = build_timeline_html(
view_context, steps, colors, current_index, current_state,
workflow, show_icons: show_icons, show_labels: show_labels, compact: compact
)
html.html_safe end
|