Module: ForemanBootdisk::HostsHelperExt
- Includes:
 - BootdiskLinksHelper
 
- Defined in:
 - app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb
 
Instance Method Summary collapse
- #bootdisk_authorized_for(options) ⇒ Object
 - #bootdisk_button_disabled(host) ⇒ Object
 - #bootdisk_url(options) ⇒ Object
 - 
  
    
      #display_bootdisk_for_subnet(host)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
need to wrap this one in a test for template proxy presence.
 - 
  
    
      #display_bootdisk_link_if_authorized(name, options = {}, html_options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Core Foreman helpers can’t look up a URL against a mounted engine.
 - #host_action_buttons(host) ⇒ Object
 - #host_title_actions(host) ⇒ Object
 
Methods included from BootdiskLinksHelper
#bootdisk_help_link, #bootdisk_title_action_buttons, #divider
Instance Method Details
#bootdisk_authorized_for(options) ⇒ Object
      55 56 57  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 55 def () User.current.allowed_to?() end  | 
  
#bootdisk_button_disabled(host) ⇒ Object
      17 18 19 20 21 22 23 24  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 17 def (host) title_actions( ( link_to(_('Boot disk'), '#', disabled: true, class: 'btn btn-default', title: _('Boot disk download not available for %s architecture') % host.architecture.name) ) ) end  | 
  
#bootdisk_url(options) ⇒ Object
      51 52 53  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 51 def bootdisk_url() ForemanBootdisk::Engine.routes.url_for(.merge(only_path: true, script_name: foreman_bootdisk_path)) end  | 
  
#display_bootdisk_for_subnet(host) ⇒ Object
need to wrap this one in a test for template proxy presence
      27 28 29 30 31 32 33 34 35 36 37 38 39 40  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 27 def display_bootdisk_for_subnet(host) if (proxy = host.try(:subnet).try(:tftp) || host.try(:subnet).try(:httpboot)) && proxy.has_feature?('Templates') ( _("Subnet '%s' generic image") % host.subnet.name, { controller: 'foreman_bootdisk/disks', action: 'subnet', id: host }, class: 'la' ) else '' end end  | 
  
#display_bootdisk_link_if_authorized(name, options = {}, html_options = {}) ⇒ Object
Core Foreman helpers can’t look up a URL against a mounted engine
      43 44 45 46 47 48 49  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 43 def (name, = {}, = {}) if () link_to(name, bootdisk_url(), ) else '' end end  | 
  
#host_action_buttons(host) ⇒ Object
      59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 59 def (host) actions = [] allowed_actions = Setting::Bootdisk.allowed_types return '' unless allowed_actions host_image_link = ( _("Host '%s' image") % host.name.split('.')[0], { controller: 'foreman_bootdisk/disks', action: 'host', id: host }, class: 'la' ) full_host_image_link = ( _("Full host '%s' image") % host.name.split('.')[0], { controller: 'foreman_bootdisk/disks', action: 'full_host', id: host }, class: 'la' ) full_host_blind_link = if ({controller: 'foreman_bootdisk/disks', action: 'full_host', id: host}) link_to(_("Full host '%s' image") % host.name.split('.')[0], '#', class: 'la btn btn-info', disabled: true, title: _('Host is not in build mode') ) else '' end actions << host_image_link if allowed_actions.include?('host') if allowed_actions.include?('full_host') if host.build? actions << full_host_image_link else actions << full_host_blind_link end end actions << divider if (host_image_link.present? && allowed_actions.include?('host')) || (full_host_image_link.present? && allowed_actions.include?('full_host')) actions << bootdisk_help_link actions end  | 
  
#host_title_actions(host) ⇒ Object
      7 8 9 10 11 12 13 14 15  | 
    
      # File 'app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb', line 7 def host_title_actions(host) if host.bootdisk_downloadable? ((host)) else (host) end super end  |