Module: ForemanPatch::HostsHelper
- Defined in:
- app/helpers/foreman_patch/hosts_helper.rb
Instance Method Summary collapse
- #patch_groups_for_host(host, options) ⇒ Object
- #patch_host_multiple_actions ⇒ Object
- #patch_host_overview_fields(host) ⇒ Object
Instance Method Details
#patch_groups_for_host(host, options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/foreman_patch/hosts_helper.rb', line 10 def patch_groups_for_host(host, ) include_blank = .fetch(:include_blank, nil) if include_blank == true include_blank = '<option></option>' end = ForemanPatch::Group.all.map do |group| selected = host.group.try(:id) == group.id ? 'selected' : '' %(<option #{selected} value="#{group.id}">#{h(group.name)}</option>) end = .join .insert(0, include_blank) if include_blank .html_safe end |
#patch_host_multiple_actions ⇒ Object
4 5 6 7 8 |
# File 'app/helpers/foreman_patch/hosts_helper.rb', line 4 def patch_host_multiple_actions [ {action: [_('Change Patch Group'), select_multiple_patch_group_hosts_path], priority: 1000} ] end |
#patch_host_overview_fields(host) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/foreman_patch/hosts_helper.rb', line 26 def patch_host_overview_fields(host) fields = [] if host.group_facet.present? name = host.group_facet.group || 'None' search = (host.group_facet.group.present? ? "patch_group = #{host.group_facet.group}" : 'not has patch_group') fields << { field: [ _('Patch Group'), link_to(name, hosts_path(search: search)), ], priority: 1001, } fields << { field: [ _('Last Patch Date'), host.group_facet.last_patched_at, ], priority: 1002, } end fields end |