Module: ForemanRemoteExecution::HostsHelperExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb

Instance Method Summary collapse

Instance Method Details

#host_title_actions_with_run_button(*args) ⇒ Object



17
18
19
20
# File 'app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb', line 17

def host_title_actions_with_run_button(*args)
  title_actions(button_group(link_to(_("Run Job"), new_job_invocation_path(:host_ids => [args.first.id]), :id => :run_button)))
  host_title_actions_without_run_button(*args)
end

#multiple_actions_select_with_remote_execution(*args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb', line 22

def multiple_actions_select_with_remote_execution(*args)
  # TODO: awful hack to open the job invocation form as a new
  # page rather than using the AJAX inside a modal window.
  # Since we want for this plugin to be compatible with 1.9, we
  # need to monkey patch/js hack for now, but it should be removed
  # after we fix and release http://projects.theforeman.org/issues/11309
  multiple_actions_select_without_remote_execution(*args) +
      <<-JAVASCRIPT.html_safe
  <script>
  $(function () {
    $("#submit_multiple a[onclick*='blank.html?run_job=true']").click(function (e) {
      document.location = "#{new_job_invocation_path}?" + $.param({host_ids: $.foremanSelectedHosts});
    })
  })
  </script>
  JAVASCRIPT
end

#multiple_actions_with_remote_executionObject



11
12
13
14
15
# File 'app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb', line 11

def multiple_actions_with_remote_execution
  # The modal window loads empty page, we hook the custom function
  # to the link later. The ?run_job=true is there just to be able to identify the link
  multiple_actions_without_remote_execution + [[_('Run Job'), 'blank.html?run_job=true']]
end