Module: Katello::Concerns::ForemanDocker::ContainerStepsHelperExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb

Instance Method Summary collapse

Instance Method Details

#katello_partial(f) ⇒ Object



6
7
8
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 6

def katello_partial(f)
  render(:partial => "/foreman_docker/containers/steps/katello_container", :locals => {:f => f})
end

#make_select_box(key, items, spinner_id, options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 10

def make_select_box(key, items, spinner_id, options)
  select = collection_select(key, :id, items,
                             :id, :name, options,
                             :class => "form-control spinner-form-control"
                            )
  if spinner_id
    spinner = image_tag("spinner.gif", :id => spinner_id, :class => "hide")
    select + spinner
  else
    select
  end
end

#select_container_capsule(f) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 23

def select_container_capsule(f)
  proxies = Organization.current.nil? ? [] : SmartProxy.with_content
  selected_proxy = proxies.size == 1 ? proxies.first.id : nil

  field(f, 'capsule[id]', :label => _("Capsule"), :required => true) do
    make_select_box(:capsule,
                     SmartProxy.with_content,
                     "load_capsules",
                     :prompt => _("Select a Capsule"),
                     :selected => selected_proxy)
  end
end

#select_container_content_views(f) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 58

def select_container_content_views(f)
  field(f, 'content_view[id]', :label => _("Content View"), :required => true) do
    make_select_box(:content_view,
                    [],
                    "load_content_views",
                    :prompt => _("Select a Content View")
                   )
  end
end

#select_container_cv_repositories(f) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 68

def select_container_cv_repositories(f)
  field(f, 'repository[id]', :label => _("Repository"), :required => true) do
    make_select_box(:repository,
                    [],
                    "load_repositories",
                    :prompt => _("Select a Repository")
                   )
  end
end

#select_container_cv_tags(f) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 78

def select_container_cv_tags(f)
  field(f, 'tag[id]', :label => _("Tag"), :required => true) do
    make_select_box(:tag,
                    [],
                    "load_tags",
                    :prompt => _("Select a Tag")
                   )
  end
end

#select_container_life_cycle_environments(f) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 47

def select_container_life_cycle_environments(f)
  envs = Organization.current.nil? ? [] : KTEnvironment.readable.where(:organization_id => Organization.current)
  field(f, 'kt_environment[id]', :label => _("Lifecycle Environment"), :required => true) do
    make_select_box(:kt_environment,
                    envs,
                    "load_environments",
                    :prompt => _("Select a Lifecycle Environment")
                   )
  end
end

#select_organizations(f) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'app/helpers/katello/concerns/foreman_docker/container_steps_helper_extensions.rb', line 36

def select_organizations(f)
  orgs = Organization.authorized(:view_organizations)
  field(f, 'organization[id]', :label => _("Organization"), :required => true) do
    make_select_box(:organization,
                    orgs,
                    nil,
                    :prompt => _("Select an Organization")
                   )
  end
end