Class: Taski::Progress::Layout::IconTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Taski::Progress::Layout::IconTag
- Defined in:
- lib/taski/progress/layout/tags.rb
Overview
Liquid tag for rendering status icons based on current state. Uses ThemeDrop from context to get icons and colors. Uses state from context to determine which icon to show.
Constant Summary collapse
- DEFAULTS =
{ icon_success: "✓", icon_failure: "✗", icon_pending: "○", icon_skip: "⊘", color_green: ColorFilter::DEFAULT_COLORS[:green], color_red: ColorFilter::DEFAULT_COLORS[:red], color_yellow: ColorFilter::DEFAULT_COLORS[:yellow], color_dim: ColorFilter::DEFAULT_COLORS[:dim], color_reset: ColorFilter::DEFAULT_COLORS[:reset] }.freeze
- STATE_CONFIG =
{ "completed" => {icon: :icon_success, color: :color_green}, "failed" => {icon: :icon_failure, color: :color_red}, "running" => {icon: :icon_pending, color: :color_yellow}, "skipped" => {icon: :icon_skip, color: :color_dim} }.freeze
Instance Method Summary collapse
Instance Method Details
#render(context) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/taski/progress/layout/tags.rb', line 54 def render(context) @template = context["template"] state = context["state"]&.to_s config = STATE_CONFIG[state] return get_value(:icon_pending) unless config colorize(get_value(config[:icon]), config[:color]) end |