Module: ForemanProxmox::HostsHelperExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/helpers/concerns/foreman_proxmox/hosts_helper_extensions.rb
Instance Method Summary collapse
- #display_proxmox_if_authorized(name, options = {}, html_options = {}) ⇒ Object
- #host_title_actions_with_proxmox(*args) ⇒ Object
- #is_authorized(options) ⇒ Object
- #proxmox_url(options) ⇒ Object
Instance Method Details
#display_proxmox_if_authorized(name, options = {}, html_options = {}) ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/helpers/concerns/foreman_proxmox/hosts_helper_extensions.rb', line 29 def (name, = {}, = {}) if () link_to(name, proxmox_url(), ) else "" end end |
#host_title_actions_with_proxmox(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/concerns/foreman_proxmox/hosts_helper_extensions.rb', line 11 def host_title_actions_with_proxmox(*args) title_actions( if Virtualmachine.where("host_id = '#{@host.id}'").first != nil ( (_("VM details"), {:controller => 'foreman_proxmox/virtualmachines', :action => 'show', :id => @host.id}, :class => 'btn') ) end, ( (_('Power Control'),{}, (_('Start VM'), {:controller => 'foreman_proxmox/virtualmachines', :action => 'start_vm', :id => @host.id}, :class => 'btn'), (_('Stop VM'), {:controller => 'foreman_proxmox/virtualmachines', :action => 'stop_vm', :id => @host.id}, :class => 'btn'), (_('Reboot VM'), {:controller => 'foreman_proxmox/virtualmachines', :action => 'reboot_vm', :id => @host.id}, :class => 'btn') ) ) ) host_title_actions_without_proxmox(*args) end |
#is_authorized(options) ⇒ Object
41 42 43 |
# File 'app/helpers/concerns/foreman_proxmox/hosts_helper_extensions.rb', line 41 def () User.current.allowed_to?() end |
#proxmox_url(options) ⇒ Object
37 38 39 |
# File 'app/helpers/concerns/foreman_proxmox/hosts_helper_extensions.rb', line 37 def proxmox_url() ForemanProxmox::Engine.routes.url_for(.merge(:only_path => true, :script_name => foreman_proxmox_path)) end |