mobility-actiontext 1.0.0 → 1.1.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: 07d1047f391d3c0dde02a646adc682b3a09f1e99a2e4beb04c7ba3b971a41e0d
4
- data.tar.gz: a49bf73b5b911d02a71eacc5f84f9f18ed91865befb9b2872a29025bb7be6813
3
+ metadata.gz: 83d469e061908f44d2b12d45a5cfe0108a9b78264e14eecf677abd881d8fb29c
4
+ data.tar.gz: 22c8db7113a9b6cbfcdf2e060a6f4b639b59e8011ab5a1ae5bf1b525040f2235
5
5
  SHA512:
6
- metadata.gz: 56786adb17b842818b65b6de35403a987c8b49dc570c4a00a367995160590c58f284374e74c391bc6aee37d05b2c1cf081aee878ce83232d877daeba86292ed6
7
- data.tar.gz: e82e781d93cd99fce6bb5e85fff45334b39cedc50a6772476a4fa22ed1319f0beabf9c20df1b319fe514f6e70743dff9880dcdac5814bbfc2c460bb32886843a
6
+ metadata.gz: ba1372589dbf8592c9dd66e0d28c628e16a71ef6397e878c2c9c6e38a43ff86266963cc38db8cb8a605242fbba6fd9503bfcb348c073a302edf237749490d141
7
+ data.tar.gz: c2e72b4be327237ca0aac4557fcca381cfbbe0558832f681850fa74deba72e79dfd08d4ab94f9a82136d6b05c7fcf92fe207e1bd3ec9ce38f648ad95d28fa969
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Mobility Action Text Changelog
2
2
 
3
+ ### 1.1.0 (2022-03-24)
4
+
5
+ - Add rich text associations for each locale ([#25](https://github.com/sedubois/mobility-actiontext/pull/25)).
6
+
3
7
  ### 1.0.0 (2022-02-28)
4
8
  - Fix eager loading of single translation using `with_rich_text_#{name}` ([#24](https://github.com/sedubois/mobility-actiontext/pull/24)).
5
9
 
data/Gemfile.lock CHANGED
@@ -1,68 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mobility-actiontext (1.0.0)
4
+ mobility-actiontext (1.1.0)
5
5
  actiontext (>= 6.0)
6
6
  mobility (~> 1.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (7.0.2.2)
12
- actionview (= 7.0.2.2)
13
- activesupport (= 7.0.2.2)
11
+ actionpack (7.0.2.3)
12
+ actionview (= 7.0.2.3)
13
+ activesupport (= 7.0.2.3)
14
14
  rack (~> 2.0, >= 2.2.0)
15
15
  rack-test (>= 0.6.3)
16
16
  rails-dom-testing (~> 2.0)
17
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actiontext (7.0.2.2)
19
- actionpack (= 7.0.2.2)
20
- activerecord (= 7.0.2.2)
21
- activestorage (= 7.0.2.2)
22
- activesupport (= 7.0.2.2)
18
+ actiontext (7.0.2.3)
19
+ actionpack (= 7.0.2.3)
20
+ activerecord (= 7.0.2.3)
21
+ activestorage (= 7.0.2.3)
22
+ activesupport (= 7.0.2.3)
23
23
  globalid (>= 0.6.0)
24
24
  nokogiri (>= 1.8.5)
25
- actionview (7.0.2.2)
26
- activesupport (= 7.0.2.2)
25
+ actionview (7.0.2.3)
26
+ activesupport (= 7.0.2.3)
27
27
  builder (~> 3.1)
28
28
  erubi (~> 1.4)
29
29
  rails-dom-testing (~> 2.0)
30
30
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
31
- activejob (7.0.2.2)
32
- activesupport (= 7.0.2.2)
31
+ activejob (7.0.2.3)
32
+ activesupport (= 7.0.2.3)
33
33
  globalid (>= 0.3.6)
34
- activemodel (7.0.2.2)
35
- activesupport (= 7.0.2.2)
36
- activerecord (7.0.2.2)
37
- activemodel (= 7.0.2.2)
38
- activesupport (= 7.0.2.2)
39
- activestorage (7.0.2.2)
40
- actionpack (= 7.0.2.2)
41
- activejob (= 7.0.2.2)
42
- activerecord (= 7.0.2.2)
43
- activesupport (= 7.0.2.2)
34
+ activemodel (7.0.2.3)
35
+ activesupport (= 7.0.2.3)
36
+ activerecord (7.0.2.3)
37
+ activemodel (= 7.0.2.3)
38
+ activesupport (= 7.0.2.3)
39
+ activestorage (7.0.2.3)
40
+ actionpack (= 7.0.2.3)
41
+ activejob (= 7.0.2.3)
42
+ activerecord (= 7.0.2.3)
43
+ activesupport (= 7.0.2.3)
44
44
  marcel (~> 1.0)
45
45
  mini_mime (>= 1.1.0)
46
- activesupport (7.0.2.2)
46
+ activesupport (7.0.2.3)
47
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
48
48
  i18n (>= 1.6, < 2)
49
49
  minitest (>= 5.1)
50
50
  tzinfo (~> 2.0)
51
51
  builder (3.2.4)
52
- concurrent-ruby (1.1.9)
52
+ concurrent-ruby (1.1.10)
53
53
  crass (1.0.6)
54
54
  erubi (1.10.0)
55
55
  globalid (1.0.0)
56
56
  activesupport (>= 5.0)
57
57
  i18n (1.10.0)
58
58
  concurrent-ruby (~> 1.0)
59
- loofah (2.14.0)
59
+ loofah (2.15.0)
60
60
  crass (~> 1.0.2)
61
61
  nokogiri (>= 1.5.9)
62
62
  marcel (1.0.2)
63
63
  mini_mime (1.1.2)
64
64
  minitest (5.15.0)
65
- mobility (1.2.5)
65
+ mobility (1.2.6)
66
66
  i18n (>= 0.6.10, < 2)
67
67
  request_store (~> 1.0)
68
68
  nokogiri (1.13.3-x86_64-darwin)
@@ -95,4 +95,4 @@ DEPENDENCIES
95
95
  sqlite3 (~> 1.4)
96
96
 
97
97
  BUNDLED WITH
98
- 2.3.7
98
+ 2.3.10
data/README.md CHANGED
@@ -77,7 +77,15 @@ This is done through the `Mobility::Backends::ActionText::Translation` model ext
77
77
 
78
78
  ## Development
79
79
 
80
- After checking out the repo, run `bundle install` to install dependencies. Then, run `cd test_app && bundle exec rails test` to run the tests.
80
+ After checking out the repo, run `bundle install` to install dependencies.
81
+
82
+ Execute tests by running:
83
+
84
+ ```sh
85
+ cd test_app
86
+ bundle install
87
+ bundle exec rails test
88
+ ```
81
89
 
82
90
  To release a new version, update `lib/mobility/action_text/version.rb` and `CHANGELOG.md`, run `bundle && cd test_app && bundle`, commit, then run `bundle exec rake release`. This will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
83
91
 
@@ -88,4 +96,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/sedubo
88
96
  ## License
89
97
 
90
98
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
91
-
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mobility
4
4
  module ActionText
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0'
6
6
  end
7
7
  end
@@ -83,6 +83,11 @@ module Mobility
83
83
  has_one :"rich_text_#{name}", -> { where(name: name, locale: Mobility.locale) },
84
84
  class_name: 'Mobility::Backends::ActionText::RichTextTranslation',
85
85
  as: :record, inverse_of: :record, autosave: true, dependent: :destroy
86
+ Mobility.available_locales.each do |locale|
87
+ has_one :"rich_text_#{name}_#{locale}", -> { where(name: name, locale: locale) },
88
+ class_name: 'Mobility::Backends::ActionText::RichTextTranslation',
89
+ as: :record, inverse_of: :record, autosave: true, dependent: :destroy
90
+ end
86
91
  scope :"with_rich_text_#{name}", -> { includes("rich_text_#{name}") }
87
92
  scope :"with_rich_text_#{name}_and_embeds",
88
93
  -> { includes("rich_text_#{name}": { embeds_attachments: :blob }) }
@@ -15,7 +15,9 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
17
  spec.metadata['source_code_uri'] = 'https://github.com/sedubois/mobility-actiontext'
18
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/sedubois/mobility-actiontext/issues'
18
19
  spec.metadata['changelog_uri'] = 'https://github.com/sedubois/mobility-actiontext/blob/main/CHANGELOG.md'
20
+ spec.metadata['rubygems_mfa_required'] = 'true'
19
21
 
20
22
  # Specify which files should be added to the gem when it is released.
21
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
data/test_app/Gemfile CHANGED
@@ -31,7 +31,7 @@ group :development do
31
31
  gem 'web-console', '>= 4.1.0'
32
32
  # Display performance information such as SQL time and flame graphs for each request in your browser.
33
33
  # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
34
- gem 'rack-mini-profiler', '~> 2.0'
34
+ gem 'rack-mini-profiler'
35
35
  gem 'listen', '~> 3.3'
36
36
  end
37
37
 
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- mobility-actiontext (1.0.0)
4
+ mobility-actiontext (1.1.0)
5
5
  actiontext (>= 6.0)
6
6
  mobility (~> 1.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.2.2)
12
- actionpack (= 7.0.2.2)
13
- activesupport (= 7.0.2.2)
11
+ actioncable (7.0.2.3)
12
+ actionpack (= 7.0.2.3)
13
+ activesupport (= 7.0.2.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.2.2)
17
- actionpack (= 7.0.2.2)
18
- activejob (= 7.0.2.2)
19
- activerecord (= 7.0.2.2)
20
- activestorage (= 7.0.2.2)
21
- activesupport (= 7.0.2.2)
16
+ actionmailbox (7.0.2.3)
17
+ actionpack (= 7.0.2.3)
18
+ activejob (= 7.0.2.3)
19
+ activerecord (= 7.0.2.3)
20
+ activestorage (= 7.0.2.3)
21
+ activesupport (= 7.0.2.3)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.0.2.2)
27
- actionpack (= 7.0.2.2)
28
- actionview (= 7.0.2.2)
29
- activejob (= 7.0.2.2)
30
- activesupport (= 7.0.2.2)
26
+ actionmailer (7.0.2.3)
27
+ actionpack (= 7.0.2.3)
28
+ actionview (= 7.0.2.3)
29
+ activejob (= 7.0.2.3)
30
+ activesupport (= 7.0.2.3)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.2.2)
37
- actionview (= 7.0.2.2)
38
- activesupport (= 7.0.2.2)
36
+ actionpack (7.0.2.3)
37
+ actionview (= 7.0.2.3)
38
+ activesupport (= 7.0.2.3)
39
39
  rack (~> 2.0, >= 2.2.0)
40
40
  rack-test (>= 0.6.3)
41
41
  rails-dom-testing (~> 2.0)
42
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.2.2)
44
- actionpack (= 7.0.2.2)
45
- activerecord (= 7.0.2.2)
46
- activestorage (= 7.0.2.2)
47
- activesupport (= 7.0.2.2)
43
+ actiontext (7.0.2.3)
44
+ actionpack (= 7.0.2.3)
45
+ activerecord (= 7.0.2.3)
46
+ activestorage (= 7.0.2.3)
47
+ activesupport (= 7.0.2.3)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.2.2)
51
- activesupport (= 7.0.2.2)
50
+ actionview (7.0.2.3)
51
+ activesupport (= 7.0.2.3)
52
52
  builder (~> 3.1)
53
53
  erubi (~> 1.4)
54
54
  rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.2.2)
57
- activesupport (= 7.0.2.2)
56
+ activejob (7.0.2.3)
57
+ activesupport (= 7.0.2.3)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.2.2)
60
- activesupport (= 7.0.2.2)
61
- activerecord (7.0.2.2)
62
- activemodel (= 7.0.2.2)
63
- activesupport (= 7.0.2.2)
64
- activestorage (7.0.2.2)
65
- actionpack (= 7.0.2.2)
66
- activejob (= 7.0.2.2)
67
- activerecord (= 7.0.2.2)
68
- activesupport (= 7.0.2.2)
59
+ activemodel (7.0.2.3)
60
+ activesupport (= 7.0.2.3)
61
+ activerecord (7.0.2.3)
62
+ activemodel (= 7.0.2.3)
63
+ activesupport (= 7.0.2.3)
64
+ activestorage (7.0.2.3)
65
+ actionpack (= 7.0.2.3)
66
+ activejob (= 7.0.2.3)
67
+ activerecord (= 7.0.2.3)
68
+ activesupport (= 7.0.2.3)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.2.2)
71
+ activesupport (7.0.2.3)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
@@ -76,7 +76,7 @@ GEM
76
76
  bindex (0.8.1)
77
77
  builder (3.2.4)
78
78
  byebug (11.1.3)
79
- concurrent-ruby (1.1.9)
79
+ concurrent-ruby (1.1.10)
80
80
  crass (1.0.6)
81
81
  digest (3.1.0)
82
82
  erubi (1.10.0)
@@ -92,7 +92,7 @@ GEM
92
92
  listen (3.7.1)
93
93
  rb-fsevent (~> 0.10, >= 0.10.3)
94
94
  rb-inotify (~> 0.9, >= 0.9.10)
95
- loofah (2.14.0)
95
+ loofah (2.15.0)
96
96
  crass (~> 1.0.2)
97
97
  nokogiri (>= 1.5.9)
98
98
  mail (2.7.1)
@@ -101,7 +101,7 @@ GEM
101
101
  method_source (1.0.0)
102
102
  mini_mime (1.1.2)
103
103
  minitest (5.15.0)
104
- mobility (1.2.5)
104
+ mobility (1.2.6)
105
105
  i18n (>= 0.6.10, < 2)
106
106
  request_store (~> 1.0)
107
107
  net-imap (0.2.3)
@@ -128,32 +128,32 @@ GEM
128
128
  nio4r (~> 2.0)
129
129
  racc (1.6.0)
130
130
  rack (2.2.3)
131
- rack-mini-profiler (2.3.4)
131
+ rack-mini-profiler (3.0.0)
132
132
  rack (>= 1.2.0)
133
133
  rack-test (1.1.0)
134
134
  rack (>= 1.0, < 3)
135
- rails (7.0.2.2)
136
- actioncable (= 7.0.2.2)
137
- actionmailbox (= 7.0.2.2)
138
- actionmailer (= 7.0.2.2)
139
- actionpack (= 7.0.2.2)
140
- actiontext (= 7.0.2.2)
141
- actionview (= 7.0.2.2)
142
- activejob (= 7.0.2.2)
143
- activemodel (= 7.0.2.2)
144
- activerecord (= 7.0.2.2)
145
- activestorage (= 7.0.2.2)
146
- activesupport (= 7.0.2.2)
135
+ rails (7.0.2.3)
136
+ actioncable (= 7.0.2.3)
137
+ actionmailbox (= 7.0.2.3)
138
+ actionmailer (= 7.0.2.3)
139
+ actionpack (= 7.0.2.3)
140
+ actiontext (= 7.0.2.3)
141
+ actionview (= 7.0.2.3)
142
+ activejob (= 7.0.2.3)
143
+ activemodel (= 7.0.2.3)
144
+ activerecord (= 7.0.2.3)
145
+ activestorage (= 7.0.2.3)
146
+ activesupport (= 7.0.2.3)
147
147
  bundler (>= 1.15.0)
148
- railties (= 7.0.2.2)
148
+ railties (= 7.0.2.3)
149
149
  rails-dom-testing (2.0.3)
150
150
  activesupport (>= 4.2.0)
151
151
  nokogiri (>= 1.6)
152
152
  rails-html-sanitizer (1.4.2)
153
153
  loofah (~> 2.3)
154
- railties (7.0.2.2)
155
- actionpack (= 7.0.2.2)
156
- activesupport (= 7.0.2.2)
154
+ railties (7.0.2.3)
155
+ actionpack (= 7.0.2.3)
156
+ activesupport (= 7.0.2.3)
157
157
  method_source
158
158
  rake (>= 12.2)
159
159
  thor (~> 1.0)
@@ -174,7 +174,7 @@ GEM
174
174
  sprockets (> 3.0)
175
175
  sprockets-rails
176
176
  tilt
177
- sprockets (4.0.2)
177
+ sprockets (4.0.3)
178
178
  concurrent-ruby (~> 1.0)
179
179
  rack (> 1, < 3)
180
180
  sprockets-rails (3.4.2)
@@ -212,7 +212,7 @@ DEPENDENCIES
212
212
  mobility (~> 1.2)
213
213
  mobility-actiontext!
214
214
  puma (~> 5.0)
215
- rack-mini-profiler (~> 2.0)
215
+ rack-mini-profiler
216
216
  rails (~> 7.0.0)
217
217
  sass-rails (>= 6)
218
218
  sqlite3 (~> 1.4)
@@ -224,4 +224,4 @@ RUBY VERSION
224
224
  ruby 3.1.1p18
225
225
 
226
226
  BUNDLED WITH
227
- 2.3.7
227
+ 2.3.10
@@ -46,7 +46,7 @@ module Mobility
46
46
  assert_equal 'Post Title', post.title
47
47
  end
48
48
 
49
- test 'post has rich text content' do
49
+ test 'post has rich text content association' do
50
50
  post = posts(:one)
51
51
 
52
52
  assert_instance_of Mobility::Backends::ActionText::RichTextTranslation, post.rich_text_content
@@ -57,6 +57,24 @@ module Mobility
57
57
  HTML
58
58
  end
59
59
 
60
+ test 'post has rich text content associations for each locale' do
61
+ post = posts(:one)
62
+
63
+ assert_instance_of Mobility::Backends::ActionText::RichTextTranslation, post.rich_text_content_en
64
+ assert_equal <<~HTML, post.rich_text_content_en.to_s
65
+ <div class="trix-content">
66
+ <h1>Hello world!</h1>
67
+ </div>
68
+ HTML
69
+
70
+ assert_instance_of Mobility::Backends::ActionText::RichTextTranslation, post.rich_text_content_fr
71
+ assert_equal <<~HTML, post.rich_text_content_fr.to_s
72
+ <div class="trix-content">
73
+ <h1>Bonjour le monde !</h1>
74
+ </div>
75
+ HTML
76
+ end
77
+
60
78
  test 'post has different content in different languages' do
61
79
  post = posts(:one)
62
80
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility-actiontext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Dubois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actiontext
@@ -138,7 +138,9 @@ licenses:
138
138
  metadata:
139
139
  homepage_uri: https://github.com/sedubois/mobility-actiontext
140
140
  source_code_uri: https://github.com/sedubois/mobility-actiontext
141
+ bug_tracker_uri: https://github.com/sedubois/mobility-actiontext/issues
141
142
  changelog_uri: https://github.com/sedubois/mobility-actiontext/blob/main/CHANGELOG.md
143
+ rubygems_mfa_required: 'true'
142
144
  post_install_message:
143
145
  rdoc_options: []
144
146
  require_paths: