Module: ForemanAnsible::AnsibleRolesHelper

Defined in:
app/helpers/foreman_ansible/ansible_roles_helper.rb

Overview

Small convenience to list all roles in the UI

Instance Method Summary collapse

Instance Method Details

#ansible_proxy_import(hash) ⇒ Object



20
21
22
23
24
# File 'app/helpers/foreman_ansible/ansible_roles_helper.rb', line 20

def ansible_proxy_import(hash)
  select_action_button(_('Import'),
                       { :primary => true, :class => 'roles-import' },
                       ansible_proxy_links(hash))
end


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/foreman_ansible/ansible_roles_helper.rb', line 4

def ansible_proxy_links(hash, classes = nil)
  links = SmartProxy.with_features('Ansible').map do |proxy|
    display_link_if_authorized(_('From %s') % proxy.name,
                               hash.merge(:proxy => proxy),
                               :class => classes)
  end.flatten
  host_text = if links.any?
                _('From Foreman host')
              else
                _('Import from Foreman host')
              end
  links.unshift display_link_if_authorized(host_text,
                                           hash,
                                           :class => classes)
end

#import_time(role) ⇒ Object



26
27
28
# File 'app/helpers/foreman_ansible/ansible_roles_helper.rb', line 26

def import_time(role)
  _('%s ago') % time_ago_in_words(role.updated_at)
end