%= javascript 'config_template', 'ace/ace', 'ace/theme-twilight', 'ace/theme-dawn', 'ace/theme-clouds', 'ace/mode-diff',
'diff', 'ace/mode-ruby', 'ace/keybinding-vim', 'ace/keybinding-emacs' %>
<%= form_for @config_template, :html => { :multipart => true } do |f| %>
<%= base_errors_for @config_template %>
<%= text_f f, :name %>
<%= checkbox_f f, :snippet, :onchange => "snippet_changed(this)" %>
>
<%= select_f f, :template_kind_id, TemplateKind.all, :id, :name, {:include_blank => true}, {:label => _("Type")} %>
<%= alert :class => 'controls alert-success', :header => '',
:text => icon_text("info-sign", (_('Note: %s ') % link_to(_('Useful template functions and macros'),
'http://theforeman.org/projects/foreman/wiki/TemplateWriting#Functions-and-macros', :rel => 'external')).html_safe) %>
<%= _("Code") %>
<%= _("Preview") %>
<%= select_tag('keybinding', content_tag(:optgroup, options_for_select(['Default', 'Vim', 'Emacs']), :label => _('Key Binding')), :class => 'input-small', :style=>"margin-top: 8px;height: 26px;") %>
<%= textarea_f f, :template, :class => "span12 template_text", :fluid=>true, :label => _("Template editor"), :'data-file-name' => @config_template.name %>
<%= file_field_f f, :template, :class => "template_file span4",
:help_block => _("Selecting a file will override the editor and load the file instead") %>
<%= textarea_f f, :audit_comment, :class => "span12", :fluid=>true, :rows => 3, :label => _("Audit Comment"),
:help_block => _("The Audit Comment field is saved with the template auditing to document the template changes") %>
<% if @history.try(:any?) %>
<% @history.each do |audit| %>
<% next unless audit_template? audit %>
<%= audit_user(audit) %> <%= audit.comment %>
<%= audit_time audit %>
<%= link_to_function icon_text("retweet", "Revert"), "revert_template(this)", :'data-url' => revision_config_templates_url, :'data-version' => audit.id %>
<%= link_to icon_text("eye-open", "Show Diff"), audit_path(audit) %>
<% end -%>
<% else -%>
<%= alert :header => _('No History Found'), :text => _('Save something and try again') %>
<% end %>
><%= _("Not relevant for snippet") %>
>
×
<%= _("How Templates are determined") %>
<%= _("When editing a Template, you must assign a list of Operating Systems which this Template can be used with. Optionally, you can restrict a template to a list of Hostgroups and/or Environments") %>
<%= _("When a Host requests a template (e.g. during provisioning), Foreman will select the best match from the available templates of that type, in the following order:") %>
<%= _("Host-group and Environment") %>
<%= _("Host-group only") %>
<%= _("Environment only") %>
<%= _("Operating system default") %>
<%= (_("The final entry, Operating System default, can be set by editing the %s page.") % (link_to _("Operating System"), operatingsystems_path)).html_safe %>
<%= multiple_checkboxes f, :operatingsystems, @config_template, Operatingsystem, :label => _("Applicable
Operating Systems").html_safe %>
<%= render "combinations", :f => f %>
<%= submit_or_cancel f %>
<% end %>