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
- #ansible_proxy_import(hash) ⇒ Object
- #ansible_proxy_links(hash, classes = nil) ⇒ Object
- #import_time(role) ⇒ Object
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) (_('Import'), { :primary => true, :class => 'roles-import' }, ansible_proxy_links(hash)) end |
#ansible_proxy_links(hash, classes = nil) ⇒ Object
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| (_('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 (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 |