foreman/app/helpers/hypervisors/guests_helper.rb @ 82e47ae0
b3f525e2 | Ohad Levy | module Hypervisors::GuestsHelper
|
|
def state s
|
|||
82e47ae0 | Amos Benari | s ? " Off" : " On"
|
|
05ab4c16 | Ohad Levy | end
|
|
def power_class s
|
|||
82e47ae0 | Amos Benari | "class='label #{s ? "label-success" : ""}'"
|
|
05ab4c16 | Ohad Levy | end
|
|
def power_action guest
|
|||
opts = hash_for_power_hypervisor_guest_path(:hypervisor_id => @hypervisor, :id => guest)
|
|||
82e47ae0 | Amos Benari | html = guest.running? ? { :confirm => 'Are you sure?', :class => "btn btn-small btn-danger" } : { :class => "btn btn-small btn-info" }
|
|
05ab4c16 | Ohad Levy | ||
display_link_if_authorized "Power#{state(guest.running?)}" , opts, html.merge(:method => :put)
|
|||
b3f525e2 | Ohad Levy | end
|
|
end
|