Module: ForemanM2::ImagesHelperExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/helpers/concerns/foreman_m2/images_helper_extensions.rb
Instance Method Summary collapse
-
#image_field(f, opts = {}) ⇒ Object
create or overwrite instance methods…
Instance Method Details
#image_field(f, opts = {}) ⇒ Object
create or overwrite instance methods…
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/concerns/foreman_m2/images_helper_extensions.rb', line 10 def image_field(f, opts = {}) return if (@compute_resource.capabilities & %i[image hybrid]).empty? images = @compute_resource.available_images if images.any? images.each { |image| image.name = image.id if image.name.nil? } select_f f, :uuid, images.to_a.sort_by { |image| image.name.downcase }, :id, :name, {}, :label => _('Image') else text_f f, :uuid, :label => opts[:label] || _('Image ID'), :help_inline => opts[:help_inline] || _('Image ID as provided by the compute resource, e.g. ami-..') end end |