Project

General

Profile

Download (2.13 KB) Statistics
| Branch: | Tag: | Revision:
92bf092d Amos Benari
<div <%= "id=#{f.object.key || 'new_lookup_keys'} class='tab-pane fields well' " %> >
<%= remove_child_link "Remove #{f.object.new_record? ? "Variable" : f.object}", f , {:class => 'btn btn-danger hide'} unless controller_name == "lookup_keys" %>
2b54d6ef Ohad Levy
<%= text_f f, :key, :label => "Name" %>
<%= text_f f, :description %>
82e47ae0 Amos Benari
<%= text_f f, :default_value, :class => "input-xxlarge", :help_inline => popover("?","value to use when there is no match", :title => "Default Value").html_safe %>
2b54d6ef Ohad Levy
<%= selectable_f f, :validator_type, options_for_select(LookupKey::VALIDATION_TYPES, f.object.validator_type),
{ :include_blank => "string"},
8eb63065 Amos Benari
{ :label => "Type Validator", :class => "medium",
:help_inline => popover("?","<dl> <dt>String</dt> <dd>everything goes</dd> <dt>Regexp</dt> <dd>regular expression to verify the value</dd>
017e1049 Ohad Levy
<dt>List</dt> <dd>comma seperated values, e.g. 80,443<dd> </dt>", :title => "How values are validated").html_safe}
2b54d6ef Ohad Levy
%>
82e47ae0 Amos Benari
<%= text_f f, :validator_rule, :label => "Validator constraint", :class => "input-xxlarge",
8eb63065 Amos Benari
:help_inline => popover("?","Values to match Type validator, leave blank if its String", :title => "Validator constraint")%>
<%= textarea_f f, :path, :rows => "4", :value => f.object.path, :label => "Order",
:help_inline => popover("?", "The order in which matchers keys are processed, first match wins.<br>
You may use multiple attributes as a matcher key, for example, an order of <code>hostgroup, environment</code>
017e1049 Ohad Levy
would expect a matcher such as <code>hostgroup = \"web servers\", environment = production</code>", :title => "The order in which values are resolved").html_safe
2b54d6ef Ohad Levy
%>
9afa092e Ohad Levy
<%# the following field is required to see child validations %>
<%= f.hidden_field :updated_at, :value => Time.now.to_i %>
<div class="children_fields">
2b54d6ef Ohad Levy
<%= new_child_fields_template(f, :lookup_values, {:partial => "lookup_keys/value"}) %>
017e1049 Ohad Levy
<%= f.fields_for :lookup_values do |lookup_values| %>
2b54d6ef Ohad Levy
<%= render 'lookup_keys/value', :f => lookup_values %>
9afa092e Ohad Levy
<% end %>
92bf092d Amos Benari
<%= add_child_link "+ Add Matcher-Value", :lookup_values, { :title => 'add a new matcher-value pair'} %>
9afa092e Ohad Levy
</div>
2b54d6ef Ohad Levy
<hr>
9afa092e Ohad Levy
</div>