Sha256: a8b5e4911ffd6db4a2041845f647f39bfdd0c85da52a90b1fedcda08f96ffa96

Contents?: true

Size: 1.7 KB

Versions: 26

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal:true

module JobInvocationsHelper
  def minicard(icon, number, text)
    content_tag(:div, :class => 'card-pf card-pf-accented
                card-pf-aggregate-status card-pf-aggregate-status-mini') do
      content_tag(:h2, :class => 'card-pf-title', :style => 'line-height: 1.1') do
        icon_text(icon, '', :kind => 'pficon') +
        content_tag(:span, number, :class =>'card-pf-aggregate-status-count') +
        text
      end
    end
  end

  def job_invocations_buttons
    [
      documentation_button_rex('3.2ExecutingaJob'),
      display_link_if_authorized(_('Run Job'), hash_for_new_job_invocation_path)
    ]
  end

  def template_name_and_provider_link(template)
    template_name = content_tag(:strong, template.name)
    provider = template.provider.humanized_name
    link_content = template_name + ' - ' + provider + ' ' +
      icon_text('edit', '', :kind => 'pficon')
    link_to_if_authorized(link_content,
                          hash_for_edit_job_template_path(:id => template.id))
  end

  def preview_hosts(template_invocation)
    hosts = template_invocation.targeting.hosts.take(20)
    hosts.map do |host|
      collapsed_preview(host) +
        render(:partial => 'job_invocations/user_input',
               :locals => { :template_invocation => template_invocation,
                            :target => host })
    end.reduce(:+)
  end

  def collapsed_preview(target)
    title = target.try(:name) || 'N/A'
    content_tag(:h5,
                :class => "expander collapsed out",
                :data => { :toggle => 'collapse',
                           :target => "#preview_#{target.id}" }) do
      content_tag(:span, '', :class => 'caret') + title
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foreman_remote_execution-2.0.10 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.9 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.8 app/helpers/job_invocations_helper.rb
foreman_remote_execution-3.0.3 app/helpers/job_invocations_helper.rb
foreman_remote_execution-3.0.2 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.7 app/helpers/job_invocations_helper.rb
foreman_remote_execution-3.0.1 app/helpers/job_invocations_helper.rb
foreman_remote_execution-3.0.0 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.6 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.5 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.4 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.3 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.2 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.1 app/helpers/job_invocations_helper.rb
foreman_remote_execution-2.0.0 app/helpers/job_invocations_helper.rb
foreman_remote_execution-1.8.4 app/helpers/job_invocations_helper.rb
foreman_remote_execution-1.8.3 app/helpers/job_invocations_helper.rb
foreman_remote_execution-1.8.2 app/helpers/job_invocations_helper.rb
foreman_remote_execution-1.8.1 app/helpers/job_invocations_helper.rb
foreman_remote_execution-1.8.0 app/helpers/job_invocations_helper.rb