url_params_manager 0.5.0 → 0.6.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
  SHA1:
3
- metadata.gz: 3d2fd9f24eb02adc69e61c80d542b1c833ba3c15
4
- data.tar.gz: fb4c94f651c2cf2700d85d9b60c83be05dd1c4bb
3
+ metadata.gz: e5de8109a634df819168a3cb80180e7947365dc0
4
+ data.tar.gz: 8282374457e43e3983f26e565f1134aca214fa5a
5
5
  SHA512:
6
- metadata.gz: 1f87befa22054f408155f9ef04fb248a528f68c6bc12f0ad79d405f1a165a5ec3d574ef8e6ba1aeaabfcaaff6ad5e3cc03d1cd910d09e8e26d4eb9be0b85e080
7
- data.tar.gz: 75d4f2a1d6dc80cb4f4936b691560a7640da24eec5f31ac18c59f12a736f67768fc4295cd000abe53bfc8e8faab4bc1cc94f7e9ef7fc1da6b016338f5ce0c046
6
+ metadata.gz: 0e5b8509ffbabd03ec17e64beb4e72e7d0ab061b6d2e6c8491f84a9e7c3ae9209657ed6d87b359d20ec3546ded422f4d0ac4c9ca2b90146c07f435f335312fcf
7
+ data.tar.gz: 2e39bfa024b81b024215e582a305f384a08ae821fecc909d4bb8f88f61d1c1886ba1b8663550acf77e7f769e4406c1ba4251f20a4f634e0f320bdffd009e8cb2
@@ -8,6 +8,7 @@ addons:
8
8
  rvm:
9
9
  - 2.1.6
10
10
  - 2.2.2
11
+ - 2.3.0
11
12
 
12
13
  script: 'bundle exec rake spec'
13
14
 
data/README.md CHANGED
@@ -205,7 +205,7 @@ Important observations:
205
205
  - the position-defined params hash is **ordered**. The position will be determined by the order of the keys of the config hash.
206
206
  - all position defined param needs a **placeholder**. This will be:
207
207
  - ignored when translating from url to filter
208
- - added to the url in its place if a posterior param is present, so we can respect the position order.
208
+ - added to the url in its place if a posterior param is present (or if `force_placeholder` option is passed as true), so we can respect the position order.
209
209
  - when the param has multiple values, instead of adding them in separate parts, we'll concatenate them using a separator:
210
210
  - it can be passed as `multiple_separator` option
211
211
  - if not passed, it will use a default separator `--`.
@@ -292,6 +292,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
292
292
 
293
293
  ## Changeset
294
294
 
295
+ ### v.0.6.0
296
+
297
+ - added `force_placeholder` option to `position_defined_url_params`.
298
+
295
299
  ### v.0.5.0
296
300
 
297
301
  - added `filter_params_pretreatment` option.
@@ -89,8 +89,11 @@ module UrlParamsManager
89
89
  # converting into string
90
90
  filters_uri_part = generate_uri_part sorted_uri_args
91
91
 
92
+ # remove empty elements
93
+ present_uri_filters = filters_uri_part.reject &:blank?
94
+
92
95
  # query string args + filter param for the urlpath helper methods
93
- query_string_args.merge filters: filters_uri_part.join('/')
96
+ query_string_args.merge filters: present_uri_filters.join('/')
94
97
  end
95
98
 
96
99
  def add_placeholders(sorted_uri_args)
@@ -101,7 +104,7 @@ module UrlParamsManager
101
104
  options = position_defined_url_params[key] || {}
102
105
  need_placeholder = need_placeholder || args[key].present?
103
106
 
104
- if need_placeholder && args[key].blank?
107
+ if args[key].blank? && (need_placeholder || options[:force_placeholder])
105
108
  args[key] = options[:placeholder] || DEFAULT_PLACEHOLDER
106
109
  end
107
110
 
@@ -1,3 +1,3 @@
1
1
  module UrlParamsManager
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_params_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Turiño
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-11-24 00:00:00.000000000 Z
12
+ date: 2016-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  version: '0'
206
206
  requirements: []
207
207
  rubyforge_project:
208
- rubygems_version: 2.2.2
208
+ rubygems_version: 2.5.1
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Allows SEO Friendly urls for search pages to be built easily. Intended to