wcc-contentful-app 1.3.2 → 1.4.0.rc2

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: adb8106d1a266b17a9420bf36a400cc8e786ba145b489886482d0410ef1af762
4
- data.tar.gz: 8f01a0c06d23454728df9036972e3a12cb54620de34af851052128c2c4eeeb9a
3
+ metadata.gz: cb8544accdf8bb9c26bcf200d5fdff9b4ae21c1292e6878958bc72d99cf38bb2
4
+ data.tar.gz: 955a3aaeb9d8bbee66955e29df093637a005fd58886369c2114a7df178cb53a7
5
5
  SHA512:
6
- metadata.gz: dad708db58d05f7bf1733c0a5b2c4b4034394e2046772401e9daf6a18b6726105def0d2e8a3db402122d641cb35e3284aa797b5365b5adc81b4828e8337bb1c5
7
- data.tar.gz: 3f4a97b5ffe1a116fddad102c94c0af936f96eb4d50dd4f03ca8e963a763b5946360fe32e030bc471e7db10d98f29241777502bb03b3a5336c1a4e79b8635be2
6
+ metadata.gz: 7a7e458f40876b6eb374f7916b55854ead7ff0b619ae741b068a2c3871699ca9f31dc87cbf450a5474bf8f3026baaa109519ff2030ecb49981f6b8abd2cb0386
7
+ data.tar.gz: 81c39f1053eff4f0144b5a1b536bf1cec297c4c061b7a2eefd789e3d8668654b8dcfa4ce17e0fe883ee1ee8fccfc4fc39e174a2886542ad80aab30eb976762c8
@@ -43,6 +43,6 @@ class WCC::Contentful::App::PagesController < ApplicationController
43
43
  def global_site_config
44
44
  return unless model = site_config_model
45
45
 
46
- @global_site_config ||= model.instance(preview?)
46
+ @global_site_config ||= model.instance(preview?, locale: I18n.locale)
47
47
  end
48
48
  end
@@ -3,7 +3,7 @@
3
3
  module WCC
4
4
  module Contentful
5
5
  module App
6
- VERSION = '1.3.2'
6
+ VERSION = '1.4.0.rc2'
7
7
  end
8
8
  end
9
9
  end
@@ -16,14 +16,27 @@ class WCC::Contentful::Model::MenuButton < WCC::Contentful::Model
16
16
  return external_link if external_link
17
17
 
18
18
  url = (link&.try(:slug) || link&.try(:url))
19
- return url unless fragment.present?
20
-
21
19
  url = URI(url || '')
22
- url.fragment = fragment
20
+
21
+ url = rewrite_to_locale(url, sys.locale) if default_locale && sys.locale != default_locale
22
+
23
+ url.fragment = fragment if fragment.present?
23
24
  url.to_s
24
25
  end
25
26
 
26
27
  def fragment
27
28
  WCC::Contentful::App::SectionHelper.section_id(section_link) if section_link
28
29
  end
30
+
31
+ private
32
+
33
+ def default_locale
34
+ WCC::Contentful.configuration&.default_locale
35
+ end
36
+
37
+ def rewrite_to_locale(uri, locale)
38
+ uri = URI(uri)
39
+ uri.path = File.join("/#{locale}", uri.path)
40
+ uri.to_s
41
+ end
29
42
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class WCC::Contentful::Model::SiteConfig < WCC::Contentful::Model
4
- def self.instance(preview = false) # rubocop:disable Style/OptionalBooleanParameter
5
- find_by(foreign_key: 'default', options: { include: 4, preview: preview })
4
+ def self.instance(preview = false, locale: nil) # rubocop:disable Style/OptionalBooleanParameter
5
+ find_by(foreign_key: 'default', options: { include: 4, preview: preview, locale: locale })
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcc-contentful-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -338,14 +338,14 @@ dependencies:
338
338
  requirements:
339
339
  - - "~>"
340
340
  - !ruby/object:Gem::Version
341
- version: 1.3.2
341
+ version: 1.4.0.rc2
342
342
  type: :runtime
343
343
  prerelease: false
344
344
  version_requirements: !ruby/object:Gem::Requirement
345
345
  requirements:
346
346
  - - "~>"
347
347
  - !ruby/object:Gem::Version
348
- version: 1.3.2
348
+ version: 1.4.0.rc2
349
349
  description: Models, Controllers, and Views common to Watermark Church apps
350
350
  email:
351
351
  - dev@watermark.org
@@ -444,7 +444,7 @@ homepage: https://github.com/watermarkchurch/wcc-contentful
444
444
  licenses:
445
445
  - MIT
446
446
  metadata:
447
- documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.3/wcc-contentful-app
447
+ documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.4/wcc-contentful-app
448
448
  rubygems_mfa_required: 'true'
449
449
  post_install_message:
450
450
  rdoc_options: []
@@ -457,9 +457,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
457
457
  version: '2.7'
458
458
  required_rubygems_version: !ruby/object:Gem::Requirement
459
459
  requirements:
460
- - - ">="
460
+ - - ">"
461
461
  - !ruby/object:Gem::Version
462
- version: '0'
462
+ version: 1.3.1
463
463
  requirements: []
464
464
  rubygems_version: 3.3.7
465
465
  signing_key: