%= javascript "katello/hosts/host_and_hostgroup_edit" %>
<% env_select_id = @hostgroup ? :hostgroup_lifecycle_environment_id : :host_lifecycle_environment_id %>
<% env_select_name = @hostgroup ? 'hostgroup[lifecycle_environment_id]' : 'host[lifecycle_environment_id]' %>
<%= field(f, env_select_id, {:label => _("Lifecycle Environment")}) do
select_tag env_select_id, lifecycle_environment_options(@host || @hostgroup, :include_blank => blank_or_inherit_with_id(f, :lifecycle_environment)),
:class => 'form-control', :name => env_select_name
end %>
<% cv_select_id = @hostgroup ? :hostgroup_content_view_id : :host_content_view_id %>
<% cv_select_name = @hostgroup ? 'hostgroup[content_view_id]' : 'host[content_view_id]' %>
<%= field(f, cv_select_id, {:label => _("Content View")}) do
select_tag cv_select_id, content_views_for_host(@host || @hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_view)),
:class => 'form-control', :name => cv_select_name
end %>
<% environment_attrs = { :'data-content_puppet_match' => ((@host || @hostgroup).new_record? || (@host || @hostgroup).content_and_puppet_match?),
:help_inline => %(#{_("Reset Puppet Environment to match selected Content View")}).html_safe } %>
<% if @host %>
<%= select_f f, :environment_id, Environment.with_taxonomy_scope_override(@location,@organization).order(:name), :id, :to_label, { :include_blank => true,
:disable_button => _(HostsAndHostgroupsHelper::INHERIT_TEXT),
:disable_button_enabled => inherited_by_default?(:environment_id, @host || @hostgroup),
:user_set => params[:host] && params[:host][:environment_id]
},
{:onchange => 'update_puppetclasses(this)', :'data-url' => hostgroup_or_environment_selected_hosts_path,
:'data-host-id' => @host.id, :help_inline => :indicator }.merge(environment_attrs) %>
<% else %>
<%= select_f f, :environment_id, Environment.all, :id, :to_label, {:include_blank => blank_or_inherit_f(f, :environment)},
{:label => _("Environment"), :onchange => 'update_puppetclasses(this);', :"data-url" => environment_selected_hostgroups_path}.merge(environment_attrs) %>
<%end %>
<% proxies = SmartProxy.with_content.unscoped.with_taxonomy_scope(@location,@organization,:path_ids) %>
<% if proxies.count > 0 %>
<%= select_f f, :content_source_id, proxies, :id, :name,
{ :include_blank => blank_or_inherit_f(f, :content_source) },
{ :label => _("Content Source"),
:help_inline => _("Use this as a source for installation and updates.") } %>
<% end %>