currency_select 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/VERSION +1 -1
- data/currency_select.gemspec +7 -6
- data/lib/currency_select.rb +3 -96
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d100fa5d8db54cfe83c7b6b22af1b074fda179bbc8372a6be10fe724a284b2d
|
4
|
+
data.tar.gz: cbcbdd178abaf13fc1ecf6bbee7c9e9486c46139e3bca4ae761685deedbb14f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 736a8e8842996e681149fc24c0dae6483ac45cf0bd5ed71a43b99b6a2571783d5ad0a1d0ddf44b8cff3ab10c166f787a04008169a0f7da20daea18fa46596633
|
7
|
+
data.tar.gz: e7c241ca7915f93e32cec7fb0ce60b9ee9c04e546ded9fd6f5d95b11a640ca7e04a2647971cb317942f886db1c4c4f1f10601f572b37d7608ac0baf2c2f5f505
|
data/CHANGELOG.md
CHANGED
@@ -13,10 +13,28 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
13
13
|
|
14
14
|
### Removed
|
15
15
|
|
16
|
+
## 5.0.0
|
17
|
+
|
18
|
+
### Added
|
19
|
+
- Add official support for Ruby 3.2 (#125)
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
- Allow the non-formbuilder version to set the selected option (#134)
|
23
|
+
- Drop whitespace between HTML tags (#115)
|
24
|
+
|
25
|
+
### Removed
|
26
|
+
- Drop support for Rails 5.2 (#112)
|
27
|
+
- Drop support for Ruby 2.6 and 2.7 (#111, #132)
|
28
|
+
|
16
29
|
### Fixed
|
17
30
|
|
18
31
|
### Security
|
19
32
|
|
33
|
+
## 4.1.0
|
34
|
+
|
35
|
+
### Added
|
36
|
+
- Add support for Ruby 3.1 (#105)
|
37
|
+
|
20
38
|
## 4.0.0
|
21
39
|
|
22
40
|
### Added
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5.0.0
|
data/currency_select.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = version
|
9
9
|
s.license = 'MIT'
|
10
10
|
|
11
|
-
s.required_ruby_version = '>=
|
11
|
+
s.required_ruby_version = '>= 3.0.0'
|
12
12
|
|
13
13
|
s.homepage = 'https://github.com/braingourmets/currency_select'
|
14
14
|
s.authors = ['Trond Arve Nordheim', 'Oliver Klee']
|
@@ -20,11 +20,12 @@ Gem::Specification.new do |s|
|
|
20
20
|
]
|
21
21
|
s.extra_rdoc_files = %w[CHANGELOG.md LICENSE README.md]
|
22
22
|
|
23
|
-
s.add_runtime_dependency 'actionview', '>=
|
23
|
+
s.add_runtime_dependency 'actionview', '>= 6.0.0', '< 7.1'
|
24
24
|
s.add_runtime_dependency 'money', '~> 6.0'
|
25
25
|
|
26
|
-
s.add_development_dependency 'rspec-rails', '~>
|
27
|
-
s.add_development_dependency 'rubocop', '~>
|
28
|
-
s.add_development_dependency 'rubocop-rails', '~> 2.
|
29
|
-
s.add_development_dependency 'rubocop-
|
26
|
+
s.add_development_dependency 'rspec-rails', '~> 5.1.0'
|
27
|
+
s.add_development_dependency 'rubocop', '~> 1.26.0'
|
28
|
+
s.add_development_dependency 'rubocop-rails', '~> 2.13.2'
|
29
|
+
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
30
|
+
s.add_development_dependency 'rubocop-rspec', '~> 2.8.0'
|
30
31
|
end
|
data/lib/currency_select.rb
CHANGED
@@ -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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trond Arve Nordheim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 6.0.0
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: '7.1'
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: 6.0.0
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '7.1'
|
@@ -51,56 +51,70 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 5.1.0
|
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:
|
61
|
+
version: 5.1.0
|
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:
|
68
|
+
version: 1.26.0
|
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:
|
75
|
+
version: 1.26.0
|
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.
|
82
|
+
version: 2.13.2
|
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.
|
89
|
+
version: 2.13.2
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: rubocop-rake
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.6.0
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.6.0
|
90
104
|
- !ruby/object:Gem::Dependency
|
91
105
|
name: rubocop-rspec
|
92
106
|
requirement: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 2.8.0
|
97
111
|
type: :development
|
98
112
|
prerelease: false
|
99
113
|
version_requirements: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: 2.8.0
|
104
118
|
description:
|
105
119
|
email: o.klee@braingourmets.com
|
106
120
|
executables: []
|
@@ -132,14 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
146
|
requirements:
|
133
147
|
- - ">="
|
134
148
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
149
|
+
version: 3.0.0
|
136
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
151
|
requirements:
|
138
152
|
- - ">="
|
139
153
|
- !ruby/object:Gem::Version
|
140
154
|
version: '0'
|
141
155
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.4.10
|
143
157
|
signing_key:
|
144
158
|
specification_version: 4
|
145
159
|
summary: Currency select plugin for Rails
|