Revision 82e47ae0
Added by Amos Benari about 12 years ago
- ID 82e47ae0f86994702c3a084cc6150250a81034ee
app/helpers/hypervisors/guests_helper.rb | ||
---|---|---|
module Hypervisors::GuestsHelper
|
||
|
||
def state s
|
||
s ? "Off" : " On"
|
||
s ? " Off" : " On"
|
||
end
|
||
|
||
def power_class s
|
||
"class='label #{s ? "success" : ""}'"
|
||
"class='label #{s ? "label-success" : ""}'"
|
||
end
|
||
|
||
def power_action guest
|
||
opts = hash_for_power_hypervisor_guest_path(:hypervisor_id => @hypervisor, :id => guest)
|
||
html = guest.running? ? { :confirm => 'Are you sure?', :class => "label important" } : { :class => "label notice" }
|
||
html = guest.running? ? { :confirm => 'Are you sure?', :class => "btn btn-small btn-danger" } : { :class => "btn btn-small btn-info" }
|
||
|
||
display_link_if_authorized "Power#{state(guest.running?)}" , opts, html.merge(:method => :put)
|
||
end
|
Also available in: Unified diff
updates UI to bootstrap v2