currency_select 4.1.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34966f5e01826eea10afd72d0482a6b206086c84ae9c1b3daff05abfb71b5e0c
4
- data.tar.gz: 9848694b180fe61281b0f042560c606d1a4f0b13140b3f18311f6f7162ac1ced
3
+ metadata.gz: b7c2ca6e321424ab30b2ec8e9a4177347b10582e88bfe35a35c0148c11abff5e
4
+ data.tar.gz: 224a133524363f381b881ecde355802734833d2b97da2aa83e3fa10a40bf982e
5
5
  SHA512:
6
- metadata.gz: 542ce884664c90151e0fe52bdd81e12175b51b444784d8c30c1aabd645f2bb2b607b2ae2532b4fafde242bb021cd1aae6b83dc2723ea933a885d1cb6027698d1
7
- data.tar.gz: 40fd4238f223fb9b6d045744c777cc8b4fabfadf2179e85b22cc160d90811a6a0ec89a4d36c5ada145db503465d693466d166811b77bcc507d0b4612c82446af
6
+ metadata.gz: a9fce454cc63c0572555f65d7ab63923b42d3a23949ce7f26142633f553818ede494d0bba4a91e8e2b818f340af03801af67df94c474e2759e180b1b9b61f9ea
7
+ data.tar.gz: 127b536e16a97290243b4748e71bc48ae760431b8e7a4bcccdde709aac7fb90070eb71041be93aaedab3f4dfa44e6c3dafdedb024c0cd15c79f7e7ba4b7cbdf2
data/CHANGELOG.md CHANGED
@@ -17,22 +17,70 @@ This project adheres to [Semantic Versioning](https://semver.org/).
17
17
 
18
18
  ### Security
19
19
 
20
+ ## 7.0.0
21
+
22
+ ### Added
23
+
24
+ - Add support for Rails 7.2 (#176)
25
+ - Add official support for Ruby 3.3 (#156)
26
+
27
+ ### Removed
28
+
29
+ - Drop support for Ruby 3.0 (#161)
30
+
31
+ ## 6.0.0
32
+
33
+ ### Added
34
+
35
+ - Add support for Rails 7.1 (#146, #148, #149, #150),
36
+ thanks to @hishammalik and @pnicholls
37
+
38
+ ### Removed
39
+
40
+ - Drop support for Rails 6.0 (#142)
41
+
42
+ ## 5.0.1
43
+
44
+ ### Fixed
45
+
46
+ - Add missing files to the gemspec file (#137)
47
+
48
+ ## 5.0.0
49
+
50
+ ### Added
51
+
52
+ - Add official support for Ruby 3.2 (#125)
53
+
54
+ ### Changed
55
+
56
+ - Allow the non-formbuilder version to set the selected option (#134)
57
+ - Drop whitespace between HTML tags (#115)
58
+
59
+ ### Removed
60
+
61
+ - Drop support for Rails 5.2 (#112)
62
+ - Drop support for Ruby 2.6 and 2.7 (#111, #132)
63
+
20
64
  ## 4.1.0
21
65
 
22
66
  ### Added
67
+
23
68
  - Add support for Ruby 3.1 (#105)
24
69
 
25
70
  ## 4.0.0
26
71
 
27
72
  ### Added
73
+
28
74
  - Add support for Rails 7.0 (#96)
29
75
 
30
76
  ### Removed
77
+
31
78
  - Drop support for Ruby 2.5 (#90)
32
79
 
33
80
  ## 3.0.0
34
81
 
35
82
  ### Added
83
+
36
84
  - Add automatic gem release (#86, #88)
37
85
  - Support Ruby 3 (#81)
38
86
  - Add support for Rails 6.1 (#78, #79, #83)
@@ -40,21 +88,25 @@ This project adheres to [Semantic Versioning](https://semver.org/).
40
88
  - Add support for Ruby 2.7 (#66)
41
89
 
42
90
  ### Changed
91
+
43
92
  - Switch the CI from Travis to GitHub Actions (#80, #85)
44
93
  - Upgrade RSpec and RSpec-Rails (#71)
45
94
  - Update the Ruby versions on Travis CI (#68)
46
95
 
47
96
  ### Removed
97
+
48
98
  - Drop support for Ruby 2.4 (#70)
49
99
  - Drop support for Rails < 5.2 (#65)
50
100
 
51
101
  ### Fixed
102
+
52
103
  - Fix some RuboCop warnings (#73)
53
104
  - Fix warnings in the `.travis.yml` (#67, #69)
54
105
 
55
106
  ## 2.0.0
56
107
 
57
108
  ### Added
109
+
58
110
  - Add support for Rails 6.0
59
111
  ([#60](https://github.com/braingourmets/currency_select/pull/60))
60
112
  - Officially support Rails 5.2
@@ -63,6 +115,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
63
115
  ([#49](https://github.com/braingourmets/currency_select/pull/49))
64
116
 
65
117
  ### Removed
118
+
66
119
  - Drop support for Rails < 5.1
67
120
  ([#62](https://github.com/braingourmets/currency_select/pull/62))
68
121
  - Drop support for Ruby < 2.4
@@ -71,6 +124,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
71
124
  ([#48](https://github.com/braingourmets/currency_select/pull/48))
72
125
 
73
126
  ### Fixed
127
+
74
128
  - Add version to the requirements in the gemspec file
75
129
  ([#53](https://github.com/braingourmets/currency_select/pull/53))
76
130
  - Fix file names references from the gemspec file
@@ -81,16 +135,19 @@ This project adheres to [Semantic Versioning](https://semver.org/).
81
135
  ## 1.0.0
82
136
 
83
137
  ### Added
138
+
84
139
  - Officially support Rails 5.2
85
140
  ([#51](https://github.com/braingourmets/currency_select/pull/51))
86
141
  - Add Ruby 2.5.1 to the Travis build matrix
87
142
  ([#49](https://github.com/braingourmets/currency_select/pull/49))
88
143
 
89
144
  ### Removed
145
+
90
146
  - Drop support for Ruby < 2.3
91
147
  ([#48](https://github.com/braingourmets/currency_select/pull/48))
92
148
 
93
149
  ### Fixed
150
+
94
151
  - Add version to the requirements in the gemspec file
95
152
  ([#53](https://github.com/braingourmets/currency_select/pull/53))
96
153
  - Fix file names references from the gemspec file
@@ -101,27 +158,32 @@ This project adheres to [Semantic Versioning](https://semver.org/).
101
158
  ## 0.2.0
102
159
 
103
160
  ### Added
161
+
104
162
  - Automatically use the version number from the VERSION file in the gemspec
105
163
  ([#32](https://github.com/braingourmets/currency_select/pull/32))
106
164
  - Add a code of conduct
107
165
  ([#25](https://github.com/braingourmets/currency_select/pull/25))
108
166
 
109
167
  ### Changed
168
+
110
169
  - Mark all Ruby files as frozen_string_literal: true
111
170
  ([#31](https://github.com/braingourmets/currency_select/pull/31))
112
171
 
113
172
  ### Deprecated
173
+
114
174
  - Support for Rails < 5.0.0 will be removed in version 2.0.0.
115
175
  - Support for Rails < 4.2.0 will be removed in version 1.0.0.
116
176
  - Support for Ruby < 2.3.0 will be removed in version 1.0.0.
117
177
 
118
178
  ### Removed
179
+
119
180
  - Remove pre-Rails-4.0-specific code
120
181
  ([#38](https://github.com/braingourmets/currency_select/pull/38))
121
182
  - Drop Jeweler
122
183
  ([#28](https://github.com/braingourmets/currency_select/pull/28))
123
184
 
124
185
  ### Fixed
186
+
125
187
  - Add ActionView as explicit dependency
126
188
  ([#34](https://github.com/braingourmets/currency_select/pull/34))
127
189
  - Fix the check for only one active selection in the specs
data/README.md CHANGED
@@ -9,6 +9,12 @@ a HTML select list of available currencies.
9
9
  The list of currencies are provided by the
10
10
  [Money gem](https://rubygems.org/gems/money).
11
11
 
12
+ ## New maintainer wanted
13
+
14
+ We're not using this gem anymore, so we'm looking for a new maintainer. If
15
+ you're interested in becoming the new maintainer, please contact us at
16
+ `info AT braingourmets DOT com`.
17
+
12
18
  ## Installation
13
19
 
14
20
  Add the following to your Gemfile:
@@ -24,6 +30,7 @@ currency_select('user', 'currency')
24
30
  ```
25
31
 
26
32
  ### form_for example
33
+
27
34
  ```
28
35
  <%= f.currency_select(:currency, ["USD", "EUR", "CAD"], {}, {class: "form-control"}) -%>
29
36
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.1.0
1
+ 7.0.0
@@ -8,24 +8,28 @@ Gem::Specification.new do |s|
8
8
  s.version = version
9
9
  s.license = 'MIT'
10
10
 
11
- s.required_ruby_version = '>= 2.6.0'
11
+ s.required_ruby_version = '>= 3.1.0'
12
12
 
13
13
  s.homepage = 'https://github.com/braingourmets/currency_select'
14
14
  s.authors = ['Trond Arve Nordheim', 'Oliver Klee']
15
15
  s.email = 'o.klee@braingourmets.com'
16
16
 
17
17
  s.files = %w[
18
- lib/currency_select.rb rails/init.rb CHANGELOG.md CODE_OF_CONDUCT.md
19
- currency_select.gemspec Gemfile LICENSE Rakefile README.md VERSION
18
+ CHANGELOG.md CODE_OF_CONDUCT.md Gemfile LICENSE README.md Rakefile VERSION
19
+ currency_select.gemspec
20
+ lib/currency_select.rb lib/currency_select_tag.rb lib/form_builder.rb
21
+ lib/form_options_helper.rb lib/to_currency_select_tag.rb
22
+ rails/init.rb
20
23
  ]
21
24
  s.extra_rdoc_files = %w[CHANGELOG.md LICENSE README.md]
22
25
 
23
- s.add_runtime_dependency 'actionview', '>= 5.2.0', '< 7.1'
24
- s.add_runtime_dependency 'money', '~> 6.0'
26
+ s.add_dependency 'actionview', '>= 6.1.0', '< 7.3'
27
+ s.add_dependency 'money', '~> 6.0'
25
28
 
26
- s.add_development_dependency 'rspec-rails', '~> 5.1.0'
27
- s.add_development_dependency 'rubocop', '~> 1.25.1'
28
- s.add_development_dependency 'rubocop-rails', '~> 2.13.2'
29
+ s.add_development_dependency 'rspec-rails', '~> 6.1.3'
30
+ s.add_development_dependency 'rubocop', '~> 1.65.1'
31
+ s.add_development_dependency 'rubocop-rails', '~> 2.25.1'
29
32
  s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
30
- s.add_development_dependency 'rubocop-rspec', '~> 2.8.0'
33
+ s.add_development_dependency 'rubocop-rspec', '~> 3.0.4'
34
+ s.add_development_dependency 'rubocop-rspec_rails', '~> 2.30.0'
31
35
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'currency_select_tag'
4
+ require 'form_builder'
5
+ require 'form_options_helper'
3
6
  require 'money'
4
7
 
5
8
  ##
@@ -67,99 +70,3 @@ module CurrencySelect
67
70
  end
68
71
  end
69
72
  end
70
-
71
- # CurrencySelect
72
- module ActionView
73
- module Helpers
74
- ##
75
- # Module for the form options.
76
- #
77
- module FormOptionsHelper
78
- # Return select and option tags for the given object and method, using
79
- # currency_options_for_select to generate the list of option tags.
80
- def currency_select(
81
- object, method, priority_currencies = nil, options = {},
82
- html_options = {}
83
- )
84
- tag = CurrencySelectTag.new(object, method, self, options)
85
- tag.to_currency_select_tag(priority_currencies, options, html_options)
86
- end
87
-
88
- # Returns a string of option tags for all available currencies. Supply
89
- # a currency ISO code as +selected+ to have it marked as the selected
90
- # option tag. You can also supply an array of currencies as
91
- # +priority_currencies+, so that they will be listed above the rest of
92
- # the list.
93
- def currency_options_for_select(selected = nil, priority_currencies = nil)
94
- currency_options = ''.html_safe
95
-
96
- if priority_currencies
97
- currency_options += options_for_select(
98
- ::CurrencySelect.priority_currencies_array(priority_currencies),
99
- selected
100
- )
101
- raw = '<option value="" disabled="disabled">-------------</option>'
102
- currency_options += raw.html_safe + "\n"
103
-
104
- # prevents selected from being included twice in the HTML which causes
105
- # some browsers to select the second selected option (not priority)
106
- # which makes it harder to select an alternative priority country
107
- selected = nil if priority_currencies.include?(selected)
108
- end
109
-
110
- # All the countries included in the country_options output.
111
- currency_options + options_for_select(
112
- ::CurrencySelect.currencies_array, selected
113
- )
114
- end
115
- end
116
-
117
- ##
118
- # Tag.
119
- #
120
- module ToCurrencySelectTag
121
- def to_currency_select_tag(priority_currencies, options, html_options)
122
- html_options = html_options.stringify_keys
123
- add_default_name_and_id(html_options)
124
- value = if method(:value).arity.zero?
125
- value()
126
- else
127
- value(object)
128
- end
129
- content_tag(
130
- 'select',
131
- add_options(
132
- currency_options_for_select(value, priority_currencies),
133
- options,
134
- value
135
- ),
136
- html_options
137
- )
138
- end
139
- end
140
-
141
- ##
142
- # Tag.
143
- #
144
- class CurrencySelectTag < Tags::Base
145
- include ToCurrencySelectTag
146
- end
147
-
148
- ##
149
- # Form builder.
150
- #
151
- class FormBuilder
152
- def currency_select(
153
- method, priority_currencies = nil, options = {}, html_options = {}
154
- )
155
- @template.currency_select(
156
- @object_name,
157
- method,
158
- priority_currencies,
159
- options.merge(object: @object),
160
- html_options
161
- )
162
- end
163
- end
164
- end
165
- end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'to_currency_select_tag'
4
+ require 'form_options_helper'
5
+
6
+ # CurrencySelect
7
+ module ActionView
8
+ module Helpers
9
+ ##
10
+ # Tag.
11
+ #
12
+ class CurrencySelectTag < Tags::Base
13
+ include ToCurrencySelectTag
14
+ include FormOptionsHelper
15
+ include ActionView::Helpers::Tags::SelectRenderer if defined?(ActionView::Helpers::Tags::SelectRenderer)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # CurrencySelect
4
+ module ActionView
5
+ module Helpers
6
+ ##
7
+ # Form builder.
8
+ #
9
+ class FormBuilder
10
+ def currency_select(
11
+ method, priority_currencies = nil, options = {}, html_options = {}
12
+ )
13
+ @template.currency_select(
14
+ @object_name,
15
+ method,
16
+ priority_currencies,
17
+ options.merge(object: @object),
18
+ html_options
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'money'
4
+
5
+ # CurrencySelect
6
+ module ActionView
7
+ module Helpers
8
+ ##
9
+ # Module for the form options.
10
+ #
11
+ module FormOptionsHelper
12
+ # Return select and option tags for the given object and method, using
13
+ # currency_options_for_select to generate the list of option tags.
14
+ def currency_select(
15
+ object, method, priority_currencies = nil, options = {},
16
+ html_options = {}
17
+ )
18
+ tag = CurrencySelectTag.new(object, method, self, options)
19
+ tag.to_currency_select_tag(priority_currencies, options, html_options)
20
+ end
21
+
22
+ # Returns a string of option tags for all available currencies. Supply
23
+ # a currency ISO code as +selected+ to have it marked as the selected
24
+ # option tag. You can also supply an array of currencies as
25
+ # +priority_currencies+, so that they will be listed above the rest of
26
+ # the list.
27
+ def currency_options_for_select(selected = nil, priority_currencies = nil)
28
+ currency_options = ''.html_safe
29
+
30
+ if priority_currencies
31
+ currency_options += options_for_select(
32
+ ::CurrencySelect.priority_currencies_array(priority_currencies),
33
+ selected
34
+ )
35
+ label = '-------------'.html_safe
36
+ option = content_tag(:option, label, value: '', disabled: 'disabled')
37
+ currency_options += option
38
+
39
+ # prevents selected from being included twice in the HTML which causes
40
+ # some browsers to select the second selected option (not priority)
41
+ # which makes it harder to select an alternative priority country
42
+ selected = nil if priority_currencies.include?(selected)
43
+ end
44
+
45
+ # All the countries included in the country_options output.
46
+ currency_options + options_for_select(
47
+ ::CurrencySelect.currencies_array, selected
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # CurrencySelect
4
+ module ActionView
5
+ module Helpers
6
+ ##
7
+ # Tag.
8
+ #
9
+ module ToCurrencySelectTag
10
+ def to_currency_select_tag(priority_currencies, options, html_options)
11
+ html_options = html_options.stringify_keys
12
+ add_default_name_and_id(html_options)
13
+ value = if method(:value).arity.zero?
14
+ options.fetch(:selected) { value() }
15
+ else
16
+ options.fetch(:selected) { value(object) }
17
+ end
18
+ content_tag(
19
+ 'select',
20
+ add_options(
21
+ currency_options_for_select(value, priority_currencies),
22
+ options,
23
+ value
24
+ ),
25
+ html_options
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trond Arve Nordheim
8
8
  - Oliver Klee
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-25 00:00:00.000000000 Z
12
+ date: 2024-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -17,20 +17,20 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 5.2.0
20
+ version: 6.1.0
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '7.1'
23
+ version: '7.3'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: 5.2.0
30
+ version: 6.1.0
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '7.1'
33
+ version: '7.3'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: money
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -51,42 +51,42 @@ dependencies:
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 5.1.0
54
+ version: 6.1.3
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.1.0
61
+ version: 6.1.3
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rubocop
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.25.1
68
+ version: 1.65.1
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.25.1
75
+ version: 1.65.1
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rubocop-rails
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.13.2
82
+ version: 2.25.1
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.13.2
89
+ version: 2.25.1
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rubocop-rake
92
92
  requirement: !ruby/object:Gem::Requirement
@@ -107,15 +107,29 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.8.0
110
+ version: 3.0.4
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 2.8.0
118
- description:
117
+ version: 3.0.4
118
+ - !ruby/object:Gem::Dependency
119
+ name: rubocop-rspec_rails
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 2.30.0
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 2.30.0
132
+ description:
119
133
  email: o.klee@braingourmets.com
120
134
  executables: []
121
135
  extensions: []
@@ -133,12 +147,16 @@ files:
133
147
  - VERSION
134
148
  - currency_select.gemspec
135
149
  - lib/currency_select.rb
150
+ - lib/currency_select_tag.rb
151
+ - lib/form_builder.rb
152
+ - lib/form_options_helper.rb
153
+ - lib/to_currency_select_tag.rb
136
154
  - rails/init.rb
137
155
  homepage: https://github.com/braingourmets/currency_select
138
156
  licenses:
139
157
  - MIT
140
158
  metadata: {}
141
- post_install_message:
159
+ post_install_message:
142
160
  rdoc_options: []
143
161
  require_paths:
144
162
  - lib
@@ -146,15 +164,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
164
  requirements:
147
165
  - - ">="
148
166
  - !ruby/object:Gem::Version
149
- version: 2.6.0
167
+ version: 3.1.0
150
168
  required_rubygems_version: !ruby/object:Gem::Requirement
151
169
  requirements:
152
170
  - - ">="
153
171
  - !ruby/object:Gem::Version
154
172
  version: '0'
155
173
  requirements: []
156
- rubygems_version: 3.3.7
157
- signing_key:
174
+ rubygems_version: 3.5.11
175
+ signing_key:
158
176
  specification_version: 4
159
177
  summary: Currency select plugin for Rails
160
178
  test_files: []