Sha256: 7abe30e7d54b6dbf3ca71b328e19bd0c13eb4e8470af0eb951e75ed091fab25c

Contents?: true

Size: 655 Bytes

Versions: 9

Compression:

Stored size: 655 Bytes

Contents

module OscMacheteRails
  module Helper
    def status_label(job, tag = :span)
      job ||= OpenStruct.new status: OSC::Machete::Status.not_submitted
      text = job.status.to_s

      label_class = 'label-default'
      if job.failed?
        label_class = 'label-danger'
      elsif job.passed?
        label_class = 'label-success'
        text = "Completed"
      elsif job.active?
        label_class = 'label-primary'
      end

      content_tag tag, class: %I(status-label label #{label_class}) do
        text
      end
    end
    alias_method :job_status_label, :status_label
  end
end

ActionView::Base.send :include, OscMacheteRails::Helper

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
osc_machete_rails-2.1.2 lib/osc_machete_rails/helper.rb
osc_machete_rails-2.1.0 lib/osc_machete_rails/helper.rb
osc_machete_rails-2.0.0 lib/osc_machete_rails/helper.rb
osc_machete_rails-1.3.1 lib/osc_machete_rails/helper.rb
osc_machete_rails-1.3.0 lib/osc_machete_rails/helper.rb
osc_machete_rails-1.2.2 lib/osc_machete_rails/helper.rb
osc_machete_rails-2.0.0.pre1 lib/osc_machete_rails/helper.rb
osc_machete_rails-1.2.1 lib/osc_machete_rails/helper.rb
osc_machete_rails-1.2.0 lib/osc_machete_rails/helper.rb