enum_help 0.0.15 → 0.0.16

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: 75f95d6a74f8b6e386e27fece0f7d34c76335020
4
- data.tar.gz: 560fd5a99b601fc46e55f1a0307c23b0e2fb3275
3
+ metadata.gz: 5b76ebfec1adf5d496385557f9425e1e1a95554c
4
+ data.tar.gz: eb49a08c37113ebf0852cad91e2f774d94493f47
5
5
  SHA512:
6
- metadata.gz: b39a30445d6c1089e5b138343a5386aa892a4fc14e0a34ace569df1b56d95e8f3cba81b6d6ec16c9a745e763cd3106d1b8890ddcc9074c7132aa201a11befb55
7
- data.tar.gz: 37a7ca60dd022b157307ecb21d68802011b385182df9deb6c663b16d86070049f33142d959a46238566404d410c6754a2a7c0dd5e9beaaca6d5dedcda8cc8ae6
6
+ metadata.gz: 80eb30b5f104314e567b1af238a1bb9f5122b4a35701f68788f287c57c84da92178bf6fd3431ba2e40b0a68748c451ecea5500137bc07d9e1bdd332543a89a78
7
+ data.tar.gz: 6784941159e554668851e44dfa4e4ad8f28b803d54c55e555a16f148c941bfbbba7958f2d52636375c397b0bf23145f700e08fd326f7b1c33096753cd641e55f
data/README.md CHANGED
@@ -8,6 +8,31 @@ As you know in Rails 4.1.0 , ActiveRecord supported Enum method. But it doesn't
8
8
 
9
9
  This gem can help you work fine with Enum feather, I18n and simple_form
10
10
 
11
+ ## Breaking Changes
12
+
13
+ Version 0.0.15 changes the behaviour of namespaced modules as per [this commit](https://github.com/zmbacker/enum_help/commit/fd1c09bcc5402b97bbf4d35313ce84cdffbe47d3): standard en.yml structures for enums `Foo::Bar::Baz#abc` and `Foo::Bar::Bat#def` change from
14
+
15
+ enums:
16
+ foo/bar/baz:
17
+ abc:
18
+ lorem: 'Ipsum'
19
+ foo/bar/bat:
20
+ abc:
21
+ lorem: 'Ipsum'
22
+
23
+ To
24
+
25
+ enums:
26
+ foo:
27
+ bar:
28
+ baz:
29
+ abc:
30
+ lorem: 'Ipsum'
31
+ bat:
32
+ abc:
33
+ lorem: 'Ipsum'
34
+
35
+ For different I18n backends, adjust accordingly as namespaced modules are now referenced by `.` rather than `/`.
11
36
 
12
37
  ## Installation
13
38
 
@@ -28,7 +28,7 @@ module EnumHelp
28
28
  def #{attr_i18n_method_name}
29
29
  enum_label = self.send(:#{attr_name})
30
30
  if enum_label
31
- ::EnumHelp::Helper.translate_enum_label(self.class, :#{attr_name}, enum_label)
31
+ ::EnumHelp::Helper.translate_enum_label('#{klass}', :#{attr_name}, enum_label)
32
32
  else
33
33
  nil
34
34
  end
@@ -43,7 +43,7 @@ module EnumHelp
43
43
  klass.instance_eval <<-METHOD, __FILE__, __LINE__
44
44
  def #{collection_i18n_method_name}
45
45
  collection_array = #{collection_method_name}.collect do |label, _|
46
- [label, ::EnumHelp::Helper.translate_enum_label(self, :#{attr_name}, label)]
46
+ [label, ::EnumHelp::Helper.translate_enum_label('#{klass}', :#{attr_name}, label)]
47
47
  end
48
48
  Hash[collection_array].with_indifferent_access
49
49
  end
@@ -4,7 +4,7 @@ module EnumHelp
4
4
  module SimpleForm
5
5
  module BuilderExtension
6
6
 
7
- def default_input_type_with_enum(*args, &block)
7
+ def default_input_type(*args, &block)
8
8
  att_name = (args.first || @attribute_name).to_s
9
9
  options = args.last
10
10
  return :enum_radio_buttons if options.is_a?(Hash) && options[:as] == :radio_buttons &&
@@ -13,7 +13,7 @@ module EnumHelp
13
13
  return :enum if (options.is_a?(Hash) ? options[:as] : @options[:as]).nil? &&
14
14
  is_enum_attributes?( att_name )
15
15
 
16
- default_input_type_without_enum(*args, &block)
16
+ super
17
17
  end
18
18
 
19
19
 
@@ -71,11 +71,10 @@ end
71
71
 
72
72
 
73
73
  SimpleForm::FormBuilder.class_eval do
74
- include EnumHelp::SimpleForm::BuilderExtension
74
+ prepend EnumHelp::SimpleForm::BuilderExtension
75
75
 
76
76
  map_type :enum, :to => EnumHelp::SimpleForm::EnumInput
77
77
  map_type :enum_radio_buttons, :to => EnumHelp::SimpleForm::EnumRadioButtons
78
78
  alias_method :collection_enum_radio_buttons, :collection_radio_buttons
79
79
  alias_method :collection_enum, :collection_select
80
- alias_method_chain :default_input_type, :enum
81
80
  end
@@ -1,3 +1,3 @@
1
1
  module EnumHelp
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_help
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lester Zhao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler