Sha256: 3f2e6b82cdaa82965f9e95ece6eb1a11ad04ada39ffe071409f4fa7827ca4317

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

module SolidQueueDashboard
  module RecurringTasksHelper
    def recurring_task_circle(type, options = {})
      options[:class] = [ "circle", recurring_task_circle_class(type), options[:class] ].compact_blank.join(" ")
      tag.span("", **options)
    end

    def recurring_task_circle_class(type)
      {
        "amber": "circle-amber",
        "sky": "circle-sky",
        "zinc": "circle-zinc"
      }[RecurringTask::TYPE_COLORS[type]&.to_sym || :zinc]
    end

    def recurring_task_type_badge(type, options = {})
      options[:class] = [ "badge", recurring_task_type_badge_class(type), options[:class] ].compact_blank.join(" ")
      tag.span(type.to_s.titleize, **options)
    end

    def recurring_task_type_badge_class(type)
      {
        "amber": "badge-amber",
        "sky": "badge-sky",
        "zinc": "badge-zinc"
      }[RecurringTask::TYPE_COLORS[type]&.to_sym || :zinc]
    end

    def any_recurring_tasks_filters?
      params[:class_name].present? || params[:queue_name].present?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solid_queue_dashboard-0.2.0 app/helpers/solid_queue_dashboard/recurring_tasks_helper.rb
solid_queue_dashboard-0.1.1 app/helpers/solid_queue_dashboard/recurring_tasks_helper.rb
solid_queue_dashboard-0.1.0 app/helpers/solid_queue_dashboard/recurring_tasks_helper.rb