Module: JobInvocationsHelper
- Defined in:
- app/helpers/job_invocations_helper.rb
Overview
frozen_string_literal:true
Instance Method Summary collapse
- #collapsed_preview(target) ⇒ Object
- #input_safe_value(input) ⇒ Object
- #minicard(icon, number, text, tooltip: nil) ⇒ Object
- #preview_hosts(template_invocation) ⇒ Object
- #show_job_location(location) ⇒ Object
- #show_job_organization(organization) ⇒ Object
- #template_name_and_provider_link(template) ⇒ Object
Instance Method Details
#collapsed_preview(target) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/helpers/job_invocations_helper.rb', line 35 def collapsed_preview(target) title = (target || 'N/A').to_s content_tag(:h5, :class => "expander collapsed out", :data => { :toggle => 'collapse', :target => "#preview_#{target.id}" }) do content_tag(:span, '', :class => 'caret') + title end end |
#input_safe_value(input) ⇒ Object
53 54 55 56 |
# File 'app/helpers/job_invocations_helper.rb', line 53 def input_safe_value(input) template_input = input.template_input template_input.respond_to?(:hidden_value) && template_input.hidden_value ? '*' * 5 : input.value end |
#minicard(icon, number, text, tooltip: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/job_invocations_helper.rb', line 4 def minicard(icon, number, text, tooltip: nil) = tooltip ? { :'data-original-title' => tooltip, :rel => 'twipsy' } : {} 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' }.merge()) do icon_text(icon, '', :kind => 'pficon') + content_tag(:span, number, :class =>'card-pf-aggregate-status-count') + text end end end |
#preview_hosts(template_invocation) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/helpers/job_invocations_helper.rb', line 25 def preview_hosts(template_invocation) hosts = template_invocation.targeting.hosts.(:view_hosts, Host).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 |
#show_job_location(location) ⇒ Object
49 50 51 |
# File 'app/helpers/job_invocations_helper.rb', line 49 def show_job_location(location) location.presence || _('Any Location') end |
#show_job_organization(organization) ⇒ Object
45 46 47 |
# File 'app/helpers/job_invocations_helper.rb', line 45 def show_job_organization(organization) organization.presence || _('Any Organization') end |
#template_name_and_provider_link(template) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/helpers/job_invocations_helper.rb', line 16 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_content, hash_for_edit_job_template_path(:id => template.id)) end |