Skip to content

Commit

Permalink
Fixes #3300 - extract translations on new smart variable page
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrisker authored and Dominic Cleal committed Aug 7, 2014
1 parent 997c2c0 commit 4c4f30b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions app/helpers/lookup_keys_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def show_puppet_class f
end

def param_type_selector f
selectable_f f, :key_type, options_for_select(LookupKey::KEY_TYPES, f.object.key_type),{},
selectable_f f, :key_type, options_for_select(LookupKey::KEY_TYPES.map { |e| [_(e),e] }, f.object.key_type),{},
{ :disabled => (f.object.is_param && !f.object.override), :size => "col-md-8" ,
:help_block => popover("Parameter Types",_("<dl>" +
:help_block => popover(_("Parameter types"),_("<dl>" +
"<dt>String</dt> <dd>Everything is taken as a string.</dd>" +
"<dt>Boolean</dt> <dd>Common representation of boolean values are accepted.</dd>" +
"<dt>Integer</dt> <dd>Integer numbers only, can be negative.</dd>" +
Expand All @@ -55,10 +55,10 @@ def param_type_selector f
end

def validator_type_selector f
selectable_f f, :validator_type, options_for_select(LookupKey::VALIDATOR_TYPES, f.object.validator_type),{:include_blank => _("None")},
selectable_f f, :validator_type, options_for_select(LookupKey::VALIDATOR_TYPES.map { |e| [_(e),e] }, f.object.validator_type),{:include_blank => _("None")},
{ :disabled => (f.object.is_param && !f.object.override), :size => "col-md-8" ,
:onchange => 'validatorTypeSelected(this)',
:help_block => popover("Validator type",_("<dl>" +
:help_block => popover(_("Validator type"),_("<dl>" +
"<dt>List</dt> <dd>A list of the allowed values, specified in the Validator rule field.</dd>" +
"<dt>Regexp</dt> <dd>Validates the input with the regular expression in the Validator rule field.</dd>" +
"</dl>"), :title => _("Validation types")).html_safe}
Expand Down
4 changes: 2 additions & 2 deletions app/models/lookup_key.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class LookupKey < ActiveRecord::Base
include Authorizable

KEY_TYPES = %w( string boolean integer real array hash yaml json )
VALIDATOR_TYPES = %w( regexp list )
KEY_TYPES = [N_("string"), N_("boolean"), N_("integer"), N_("real"), N_("array"), N_("hash"), N_("yaml"), N_("json")]
VALIDATOR_TYPES = [N_("regexp"), N_("list") ]

TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON', 'yes', 'YES', 'y', 'Y'].to_set
FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF', 'no', 'NO', 'n', 'N'].to_set
Expand Down
4 changes: 2 additions & 2 deletions app/views/lookup_keys/_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
<%= textarea_f f, :default_value, :value => f.object.default_value_before_type_cast,:size => "col-md-8", :disabled => (f.object.is_param && !f.object.override), :rows => :auto,
:help_block => _("Value to use when there is no match") %>
<div <%= "id=#{(f.object.key || 'new_lookup_keys').to_s.gsub(' ','_')}_lookup_key_override_value" %> style=<%= "display:none;" if (f.object.is_param && !f.object.override) %>>
<legend>Optional Input Validator</legend>
<legend><%= _("Optional input validator") %></legend>
<%= checkbox_f(f, :required, :size => "col-md-8", :disabled => !f.object.override,
:help_block => _("If checked, will raise an error if there is no default value and no matcher provide a value.")
) if is_param %>
<%= validator_type_selector f %>
<%= text_f f, :validator_rule, :size => "col-md-8", :disabled => f.object.validator_type.blank? %>

<legend>Override Value For Specific Hosts</legend>
<legend><%= _("Override value for specific hosts") %></legend>
<%= textarea_f f, :path, :rows => :auto, :label => _("Order"), :size => "col-md-8", :value => f.object.path,
:help_block => popover(_("The order in which values are resolved"),
_("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>host group, environment</code> would expect a matcher such as <code>hostgroup = \"web servers\", environment = production</code>"), :title => _("The order in which values are resolved")).html_safe
Expand Down
2 changes: 1 addition & 1 deletion app/views/lookup_keys/_value.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="fields">
<%= text_f f, :match, :size => "col-md-8",
:help_block => popover("Explain matchers", _("Matcher is a combination of an attribute and its value, if they match, the value below would be provided.<br> You may use any attribute foreman knows about, such as facts etc for example: <code> domain = example.com </code> or <code> is_virtual = true</code>"),
:help_block => popover(_("Explain matchers"), _("Matcher is a combination of an attribute and its value, if they match, the value below would be provided.<br> You may use any attribute foreman knows about, such as facts etc for example: <code> domain = example.com </code> or <code> is_virtual = true</code>"),
:title => _("Matcher"))
%>
<%= textarea_f f, :value, :rows => :auto, :value => f.object.value_before_type_cast, :size => "col-md-8", :help_inline => remove_child_link(icon_text("remove"), f, {:title => _('remove value')}) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/puppetclasses/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
<div class="row">
<div class='col-md-3'>
<input placeholder="Filter By Name" onkeyup="filterByClassParam(this);" type='text' class="form-control">
<input placeholder="<%= _('Filter by name') %>" onkeyup="filterByClassParam(this);" type='text' class="form-control">
</div>
<div class="form-group col-md-3">
<div class='input-group'>
Expand Down

0 comments on commit 4c4f30b

Please sign in to comment.