Sha256: 899dc0f01c2493020814da67d7e5a1a5549f4504c4cded9b95a41eb130dddab2

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

module RocketJobMissionControl
  module ApplicationHelper
    STATE_ICON_MAP = {
      aborted:   'fa-stop',
      completed: 'fa-check',
      disabled:  'fa-stop',
      enabled:   'fa-check',
      failed:    'fa-exclamation-triangle',
      paused:    'fa-pause',
      pending:   'fa-inbox',
      queued:    'fa-inbox',
      running:   'fa-play',
      scheduled: 'fa-clock-o',
      starting:  'fa-cogs',
      stopping:  'fa-stop',
      zombie:    'fa-hourglass-o'
    }

    def state_icon(state)
      STATE_ICON_MAP[state.to_sym] + ' ' + state.to_s
    end

    def site_title
      'Rocket Job Mission Control'
    end

    def title
      @page_title ||= params[:controller].to_s.titleize
      h(@full_title || [@page_title, site_title].compact.join(' | '))
    end

    def active_page(path)
      'active' if current_page?(path)
    end

    def pretty_print_array_or_hash(arguments)
      return arguments unless arguments.kind_of?(Array) || arguments.kind_of?(Hash)
      json_string_options = {space: ' ', indent: '  ', array_nl: '<br />', object_nl: '<br />'}
      JSON.generate(arguments, json_string_options).html_safe
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rocketjob_mission_control-3.0.0.rc1 app/helpers/rocket_job_mission_control/application_helper.rb
rocketjob_mission_control-2.1.1 app/helpers/rocket_job_mission_control/application_helper.rb
rocketjob_mission_control-2.1.0 app/helpers/rocket_job_mission_control/application_helper.rb
rocketjob_mission_control-2.0.0 app/helpers/rocket_job_mission_control/application_helper.rb
rocketjob_mission_control-2.0.0.rc2 app/helpers/rocket_job_mission_control/application_helper.rb
rocketjob_mission_control-2.0.0.rc1 app/helpers/rocket_job_mission_control/application_helper.rb