Module: DigitaloceanImagesHelper
- Defined in:
- app/helpers/digitalocean_images_helper.rb
Instance Method Summary collapse
- #digitalocean_image_field(f) ⇒ Object
- #select_image(f, compute_resource) ⇒ Object
- #select_region(f, compute_resource) ⇒ Object
Instance Method Details
#digitalocean_image_field(f) ⇒ Object
2 3 4 5 6 7 |
# File 'app/helpers/digitalocean_images_helper.rb', line 2 def digitalocean_image_field(f) images = @compute_resource.available_images images.each { |image| image.name = image.id if image.name.nil? } select_f f, :uuid, images.to_a.sort_by(&:full_name), :id, :full_name, {}, :label => _('Image') end |
#select_image(f, compute_resource) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/digitalocean_images_helper.rb', line 9 def select_image(f, compute_resource) images = possible_images(compute_resource, nil, nil) select_f(f, :image_id, images, :id, :slug, { :include_blank => (images.empty? || images.size == 1) ? false : _('Please select an image') }, { :label => ('Image'), :disabled => images.empty? } ) end |
#select_region(f, compute_resource) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/digitalocean_images_helper.rb', line 21 def select_region(f, compute_resource) regions = compute_resource.regions f.object.region = compute_resource.region select_f(f, :region, regions, :slug, :slug, {}, :label => ('Region'), :disabled => compute_resource.images.empty?) end |