visual_condition_builder 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 141855f6f80c2d8eb3165471ec608c4d1cd3c1d1
4
- data.tar.gz: 0b6b38e786a45347b3df4ce3c24cf73ebd16b077
3
+ metadata.gz: e0290f3e046a1c88a9c6c50149e72f4bde1b2a69
4
+ data.tar.gz: 5dbc47a59d4d4152f66962420a0b5603d7a814b0
5
5
  SHA512:
6
- metadata.gz: 26707f9caefdf86e61679e0ff200bd9c068aafd7aa73ad95cc9903c43026b1674f0427a441a4094b196c79aa993796fcceb535b7542f56e1304f43c59324cbc0
7
- data.tar.gz: 2087b2a80d41a34ddf2141b435c242d8db2f43802c078c79970e9b5e22e4b46baca38c2897f7cf7cbd75f45625e61f9c0b7142c442f973eca092327344e7b520
6
+ metadata.gz: 7e5bb0a0ee4eaa93d6753f18e379f27f647b57a97088fb8c315a72696164deba2e99fe287cc60737a6af19abda5a4e7ad6b089978ef472d9c38ee8fb81ae0df1
7
+ data.tar.gz: 3b5d22e2bbd95904e08f89ee3955eff791e1c6dbecba4634982d96c594da1f3c8fa1d1dafe72b422371284cdcf44ab60caf982d2823847390a84e4edb3c15970
data/README.md CHANGED
@@ -95,7 +95,7 @@ See below all the arguments you can use:
95
95
 
96
96
  Param | Description
97
97
  --- | ----
98
- label | Label of the field, if not informed, will search in the file.yml (ver i18n)
98
+ label | Label of the field, if not informed, will search in the visual_condition_builder.*.yml. (default: param name)
99
99
  type | Type of the field. Responsible for defining how the values will be inserted (DatePicker, Numeric Mask, ...)
100
100
  operators | Defines which operators you want to use, if not informed, the default operators will be used
101
101
  values | Sets the default values for this field, restricting the user to those values.
@@ -366,7 +366,8 @@ Condition Builder have converters of values to use in controller:
366
366
  ## i18N
367
367
 
368
368
  When you create the conditions with `build_conditions` and `conditions_fields` the builder automacaly translate attributes for you.
369
- See locale file example `config/locales/visual_condition_builder.pt-BR.yml`:
369
+ See locale file example `config/locales/visual_condition_builder.pt-BR.yml`:
370
+ Parameters with dots in the name are converted to underscores, example: "address.number" => "address_number"
370
371
 
371
372
  ```yml
372
373
  pt-BR:
@@ -415,8 +416,9 @@ pt-BR:
415
416
  exemplo: 'Meu Dicionário de Exemplo'
416
417
  condition_dictionaries:
417
418
  exemplo:
418
- nome: 'Nome'
419
- idade: 'Idade'
419
+ name: 'Name'
420
+ age: 'Age'
421
+ address_number: "Adress Number"
420
422
  ```
421
423
 
422
424
  ## Bug reports
@@ -38,17 +38,18 @@ module VisualConditionBuilder
38
38
  def param(attr, *args)
39
39
  #DEFAULT VALUES
40
40
  args = array_hashes_to_hash(args)
41
+ attr_param = attr.to_s.gsub(/\./,'_')
41
42
  args[:type] ||= 'STRING'
42
43
  args[:operators] = operators_by_type(args[:type]) unless args[:operators].present?
43
44
  args[:operators] = normalize_operators(args[:operators])
44
45
  args[:values] ||= []
45
46
  args[:group] ||= ''
46
47
  if args[:group].present? && args[:group].is_a?(Symbol)
47
- args[:label] ||= I18n.t(attr.to_sym, default: attr.to_s.humanize, scope: [:condition_dictionaries, args[:group]])
48
+ args[:label] ||= I18n.t(attr_param, default: attr.to_s.humanize, scope: [:condition_dictionaries, args[:group]])
48
49
  args[:field] ||= "#{args[:group]}_#{attr}"
49
50
  args[:group] = {args[:group] => I18n.t(args[:group], default: args[:group].to_s, scope: [:condition_builder, :dictionaries])}
50
51
  else
51
- args[:label] ||= I18n.t(attr.to_sym, default: attr.to_s.humanize, scope: [:condition_dictionaries, dictionary_name])
52
+ args[:label] ||= I18n.t(attr_param, default: attr.to_s.humanize, scope: [:condition_dictionaries, dictionary_name])
52
53
  args[:field] ||= attr
53
54
  end
54
55
  if normalized_name(args[:type])==:boolean && args[:label] !~ /\?$/
@@ -1,3 +1,3 @@
1
1
  module VisualConditionBuilder
2
- VERSION = "2.1.5"
2
+ VERSION = "2.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visual_condition_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Porto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2017-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails