Sha256: 61fa8a61bc83acbe04117548348381024eb5addd20ba5848da977cebad5b7687

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

module ForemanAnsible
  # Chained methods to extend the hosts menu with Ansible actions
  module HostsHelperExtensions
    extend ActiveSupport::Concern

    included do
      alias_method_chain(:host_title_actions, :run_ansible_roles)
      alias_method_chain(:multiple_actions, :run_ansible_roles)
    end

    def host_title_actions_with_run_ansible_roles(*args)
      button = link_to(
        icon_text('play', ' ' + _('Ansible roles'), :kind => 'fa'),
        play_roles_ansible_host_path(:id => args.first.id),
        :id => :ansible_roles_button,
        :class => 'btn btn-default')
      title_actions(button_group(button)) if args.first.ansible_roles.present?
      host_title_actions_without_run_ansible_roles(*args)
    end

    def multiple_actions_with_run_ansible_roles
      multiple_actions_without_run_ansible_roles +
        [[_('Play Ansible roles'),
          multiple_play_roles_ansible_hosts_path,
          false]]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_ansible-1.0 app/helpers/foreman_ansible/hosts_helper_extensions.rb