composite_content 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +43 -0
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +239 -0
  7. data/LICENSE +13 -0
  8. data/README.md +112 -0
  9. data/Rakefile +17 -0
  10. data/composite_content.gemspec +47 -0
  11. data/config/locales/en.yml +10 -0
  12. data/config/locales/fr.yml +10 -0
  13. data/db/migrate/20220807184334_create_composite_content_slots.rb +17 -0
  14. data/db/migrate/20220807185808_create_composite_content_blocks.rb +14 -0
  15. data/db/migrate/20220807191353_create_composite_content_headings.rb +12 -0
  16. data/db/migrate/20220807191402_create_composite_content_quotes.rb +12 -0
  17. data/db/migrate/20220807191410_create_composite_content_texts.rb +11 -0
  18. data/gemfiles/rails-6.1.x.gemfile +14 -0
  19. data/lib/composite_content/action_view.rb +84 -0
  20. data/lib/composite_content/active_record.rb +45 -0
  21. data/lib/composite_content/block.rb +11 -0
  22. data/lib/composite_content/blocks/heading.rb +21 -0
  23. data/lib/composite_content/blocks/quote.rb +12 -0
  24. data/lib/composite_content/blocks/text.rb +12 -0
  25. data/lib/composite_content/blocks.rb +11 -0
  26. data/lib/composite_content/engine.rb +50 -0
  27. data/lib/composite_content/model/base.rb +13 -0
  28. data/lib/composite_content/model/blockable.rb +21 -0
  29. data/lib/composite_content/model/builder/base.rb +47 -0
  30. data/lib/composite_content/model/builder/block.rb +36 -0
  31. data/lib/composite_content/model/builder/slot.rb +31 -0
  32. data/lib/composite_content/model/builder.rb +13 -0
  33. data/lib/composite_content/model.rb +11 -0
  34. data/lib/composite_content/slot.rb +55 -0
  35. data/lib/composite_content/version.rb +5 -0
  36. data/lib/composite_content.rb +14 -0
  37. data/lib/generators/composite_content/install_generator.rb +20 -0
  38. data/lib/generators/composite_content/templates/block/_form.html.erb +13 -0
  39. data/lib/generators/composite_content/templates/blocks/heading/_form.html.erb +9 -0
  40. data/lib/generators/composite_content/templates/blocks/heading/_show.html.erb +1 -0
  41. data/lib/generators/composite_content/templates/blocks/quote/_form.html.erb +9 -0
  42. data/lib/generators/composite_content/templates/blocks/quote/_show.html.erb +7 -0
  43. data/lib/generators/composite_content/templates/blocks/text/_form.html.erb +4 -0
  44. data/lib/generators/composite_content/templates/blocks/text/_show.html.erb +1 -0
  45. data/lib/generators/composite_content/templates/slot/_form.html.erb +13 -0
  46. metadata +275 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a686efcdcec61939877f6b8615c135ccf783fe7d4aa5c41257bdc0aa622186e9
4
+ data.tar.gz: c55f515cb92332b9620d4c040f4643870f06780f277ee10a20ab6dd0f1dfedc6
5
+ SHA512:
6
+ metadata.gz: 839c222ed66ed2fa56e9657bf5a54cc15bd64d938ecbf7ca7bff97aeb038aeea0e22373d3c22a610c92454005855ee83521b23d5c2f7def2bde188cbb0acdfe1
7
+ data.tar.gz: 97e9c56f6d39cfe92607a4af147c6704e87852d82dd0b46983b8fcfbf8b0016cda2a4712aa8ce26bbd90b0b0a062de3b11b9c6c7f8440c3f8fc6bee00c7ab1b6
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,43 @@
1
+ ---
2
+ require:
3
+ - rubocop-performance
4
+ - rubocop-rails
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
8
+ inherit_mode:
9
+ merge:
10
+ - Exclude
11
+
12
+ AllCops:
13
+ NewCops: enable
14
+ TargetRubyVersion: 2.6
15
+ Exclude:
16
+ - 'spec/dummy/db/schema.rb'
17
+
18
+ Layout/LineLength:
19
+ Max: 120
20
+
21
+ # DSLs produce long blocks
22
+ Metrics/BlockLength:
23
+ Exclude:
24
+ - '*.gemspec'
25
+ - '**/db/migrate/*.rb'
26
+ - 'spec/**/*_spec.rb'
27
+ Metrics/MethodLength:
28
+ Exclude:
29
+ - '**/db/migrate/*.rb'
30
+
31
+ Rails/ApplicationRecord:
32
+ Exclude:
33
+ - 'app/**/*.rb'
34
+ - 'lib/**/*.rb'
35
+
36
+ Rails/I18nLocaleTexts:
37
+ Exclude:
38
+ - 'spec/dummy/**/*.rb'
39
+
40
+ Style/Documentation:
41
+ Exclude:
42
+ - '**/db/migrate/*.rb'
43
+ - 'spec/dummy/**/*.rb'
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-08-06
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in composite_content.gemspec
6
+ gemspec
7
+
8
+ gem 'puma'
9
+ gem 'sprockets-rails'
10
+ gem 'sqlite3'
data/Gemfile.lock ADDED
@@ -0,0 +1,239 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ composite_content (1.0.0)
5
+ active_model_validations_reflection
6
+ acts_as_list (~> 1.0.4)
7
+ cocooned (~> 1.4.0)
8
+ rails (>= 6.1.0)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actioncable (7.0.3.1)
14
+ actionpack (= 7.0.3.1)
15
+ activesupport (= 7.0.3.1)
16
+ nio4r (~> 2.0)
17
+ websocket-driver (>= 0.6.1)
18
+ actionmailbox (7.0.3.1)
19
+ actionpack (= 7.0.3.1)
20
+ activejob (= 7.0.3.1)
21
+ activerecord (= 7.0.3.1)
22
+ activestorage (= 7.0.3.1)
23
+ activesupport (= 7.0.3.1)
24
+ mail (>= 2.7.1)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.0.3.1)
29
+ actionpack (= 7.0.3.1)
30
+ actionview (= 7.0.3.1)
31
+ activejob (= 7.0.3.1)
32
+ activesupport (= 7.0.3.1)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.0)
38
+ actionpack (7.0.3.1)
39
+ actionview (= 7.0.3.1)
40
+ activesupport (= 7.0.3.1)
41
+ rack (~> 2.0, >= 2.2.0)
42
+ rack-test (>= 0.6.3)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
+ actiontext (7.0.3.1)
46
+ actionpack (= 7.0.3.1)
47
+ activerecord (= 7.0.3.1)
48
+ activestorage (= 7.0.3.1)
49
+ activesupport (= 7.0.3.1)
50
+ globalid (>= 0.6.0)
51
+ nokogiri (>= 1.8.5)
52
+ actionview (7.0.3.1)
53
+ activesupport (= 7.0.3.1)
54
+ builder (~> 3.1)
55
+ erubi (~> 1.4)
56
+ rails-dom-testing (~> 2.0)
57
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
58
+ active_model_validations_reflection (0.1.2)
59
+ activemodel (>= 3.2)
60
+ activesupport (>= 3.2)
61
+ activejob (7.0.3.1)
62
+ activesupport (= 7.0.3.1)
63
+ globalid (>= 0.3.6)
64
+ activemodel (7.0.3.1)
65
+ activesupport (= 7.0.3.1)
66
+ activerecord (7.0.3.1)
67
+ activemodel (= 7.0.3.1)
68
+ activesupport (= 7.0.3.1)
69
+ activestorage (7.0.3.1)
70
+ actionpack (= 7.0.3.1)
71
+ activejob (= 7.0.3.1)
72
+ activerecord (= 7.0.3.1)
73
+ activesupport (= 7.0.3.1)
74
+ marcel (~> 1.0)
75
+ mini_mime (>= 1.1.0)
76
+ activesupport (7.0.3.1)
77
+ concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ i18n (>= 1.6, < 2)
79
+ minitest (>= 5.1)
80
+ tzinfo (~> 2.0)
81
+ acts_as_list (1.0.4)
82
+ activerecord (>= 4.2)
83
+ ast (2.4.2)
84
+ builder (3.2.4)
85
+ cocooned (1.4.1)
86
+ rails (>= 5.0, <= 7.1)
87
+ concurrent-ruby (1.1.10)
88
+ crass (1.0.6)
89
+ diff-lcs (1.5.0)
90
+ digest (3.1.0)
91
+ erubi (1.11.0)
92
+ globalid (1.0.0)
93
+ activesupport (>= 5.0)
94
+ i18n (1.12.0)
95
+ concurrent-ruby (~> 1.0)
96
+ json (2.6.2)
97
+ loofah (2.18.0)
98
+ crass (~> 1.0.2)
99
+ nokogiri (>= 1.5.9)
100
+ mail (2.7.1)
101
+ mini_mime (>= 0.1.1)
102
+ marcel (1.0.2)
103
+ method_source (1.0.0)
104
+ mini_mime (1.1.2)
105
+ minitest (5.16.2)
106
+ net-imap (0.2.3)
107
+ digest
108
+ net-protocol
109
+ strscan
110
+ net-pop (0.1.1)
111
+ digest
112
+ net-protocol
113
+ timeout
114
+ net-protocol (0.1.3)
115
+ timeout
116
+ net-smtp (0.3.1)
117
+ digest
118
+ net-protocol
119
+ timeout
120
+ nio4r (2.5.8)
121
+ nokogiri (1.13.8-x86_64-linux)
122
+ racc (~> 1.4)
123
+ parallel (1.22.1)
124
+ parser (3.1.2.1)
125
+ ast (~> 2.4.1)
126
+ puma (5.6.4)
127
+ nio4r (~> 2.0)
128
+ racc (1.6.0)
129
+ rack (2.2.4)
130
+ rack-test (2.0.2)
131
+ rack (>= 1.3)
132
+ rails (7.0.3.1)
133
+ actioncable (= 7.0.3.1)
134
+ actionmailbox (= 7.0.3.1)
135
+ actionmailer (= 7.0.3.1)
136
+ actionpack (= 7.0.3.1)
137
+ actiontext (= 7.0.3.1)
138
+ actionview (= 7.0.3.1)
139
+ activejob (= 7.0.3.1)
140
+ activemodel (= 7.0.3.1)
141
+ activerecord (= 7.0.3.1)
142
+ activestorage (= 7.0.3.1)
143
+ activesupport (= 7.0.3.1)
144
+ bundler (>= 1.15.0)
145
+ railties (= 7.0.3.1)
146
+ rails-dom-testing (2.0.3)
147
+ activesupport (>= 4.2.0)
148
+ nokogiri (>= 1.6)
149
+ rails-html-sanitizer (1.4.3)
150
+ loofah (~> 2.3)
151
+ railties (7.0.3.1)
152
+ actionpack (= 7.0.3.1)
153
+ activesupport (= 7.0.3.1)
154
+ method_source
155
+ rake (>= 12.2)
156
+ thor (~> 1.0)
157
+ zeitwerk (~> 2.5)
158
+ rainbow (3.1.1)
159
+ rake (13.0.6)
160
+ regexp_parser (2.5.0)
161
+ rexml (3.2.5)
162
+ rspec (3.11.0)
163
+ rspec-core (~> 3.11.0)
164
+ rspec-expectations (~> 3.11.0)
165
+ rspec-mocks (~> 3.11.0)
166
+ rspec-core (3.11.0)
167
+ rspec-support (~> 3.11.0)
168
+ rspec-expectations (3.11.0)
169
+ diff-lcs (>= 1.2.0, < 2.0)
170
+ rspec-support (~> 3.11.0)
171
+ rspec-mocks (3.11.1)
172
+ diff-lcs (>= 1.2.0, < 2.0)
173
+ rspec-support (~> 3.11.0)
174
+ rspec-support (3.11.0)
175
+ rubocop (1.34.1)
176
+ json (~> 2.3)
177
+ parallel (~> 1.10)
178
+ parser (>= 3.1.2.1)
179
+ rainbow (>= 2.2.2, < 4.0)
180
+ regexp_parser (>= 1.8, < 3.0)
181
+ rexml (>= 3.2.5, < 4.0)
182
+ rubocop-ast (>= 1.20.0, < 2.0)
183
+ ruby-progressbar (~> 1.7)
184
+ unicode-display_width (>= 1.4.0, < 3.0)
185
+ rubocop-ast (1.21.0)
186
+ parser (>= 3.1.1.0)
187
+ rubocop-performance (1.14.3)
188
+ rubocop (>= 1.7.0, < 2.0)
189
+ rubocop-ast (>= 0.4.0)
190
+ rubocop-rails (2.15.2)
191
+ activesupport (>= 4.2.0)
192
+ rack (>= 1.1)
193
+ rubocop (>= 1.7.0, < 2.0)
194
+ rubocop-rake (0.6.0)
195
+ rubocop (~> 1.0)
196
+ rubocop-rspec (2.12.1)
197
+ rubocop (~> 1.31)
198
+ ruby-progressbar (1.11.0)
199
+ shoulda-matchers (5.1.0)
200
+ activesupport (>= 5.2.0)
201
+ sprockets (4.1.1)
202
+ concurrent-ruby (~> 1.0)
203
+ rack (> 1, < 3)
204
+ sprockets-rails (3.4.2)
205
+ actionpack (>= 5.2)
206
+ activesupport (>= 5.2)
207
+ sprockets (>= 3.0.0)
208
+ sqlite3 (1.4.4)
209
+ strscan (3.0.4)
210
+ thor (1.2.1)
211
+ timeout (0.3.0)
212
+ tzinfo (2.0.5)
213
+ concurrent-ruby (~> 1.0)
214
+ unicode-display_width (2.2.0)
215
+ websocket-driver (0.7.5)
216
+ websocket-extensions (>= 0.1.0)
217
+ websocket-extensions (0.1.5)
218
+ zeitwerk (2.6.0)
219
+
220
+ PLATFORMS
221
+ x86_64-linux
222
+
223
+ DEPENDENCIES
224
+ bundler (~> 2.1)
225
+ composite_content!
226
+ puma
227
+ rake (~> 13.0)
228
+ rspec (~> 3.10)
229
+ rubocop
230
+ rubocop-performance
231
+ rubocop-rails
232
+ rubocop-rake
233
+ rubocop-rspec
234
+ shoulda-matchers (~> 5.0)
235
+ sprockets-rails
236
+ sqlite3
237
+
238
+ BUNDLED WITH
239
+ 2.3.19
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2022 notus.sh
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # CompositeContent
2
+
3
+ [![Build Status](https://app.travis-ci.com/notus-sh/composite_content.svg?branch=master)](https://app.travis-ci.com/notus-sh/composite_content)
4
+ [![Gem Version](https://badge.fury.io/rb/composite_content.svg)](https://badge.fury.io/rb/composite_content)
5
+
6
+ `CompositeContent` add capacities to your Rails application to manage complex contents made of blocks with ease.
7
+
8
+ ## Some Background
9
+
10
+ Rich administrable contents used to be managed through WYSIWYG editors. This leaves you with a very poor control over what is allowed inside such content areas and how it will be rendered afterwards: `img` tags may include the full picture as base64 data or, like `iframe`s (pasted from videos or slides sharing code), can have hard-coded dimensions that makes them hard to manipulate in a responsive design; titles hierarchy may not semantically fit in every context where your content will be displayed; rogue CSS classes can be pasted from word processors without being noticed.
11
+ The list of potential problems in a responsive and multi-channel world goes on…
12
+
13
+ An alternative to a monolithic WYSIWYG editor is to split your content into manageable chunks, or blocks. Each type of block can have its own properties and options and their definition should give you the ability to carefully manage their content to integrate it in various use cases and/or with other parts of your application. Such system should be extensible, so you can create new types of blocks to fit your needs.
14
+
15
+ For example:
16
+
17
+ - An image block can use your favorite attachment solution to retain picture information and be able to render it with the appropriate `src-set` attribute to accommodate screen resolutions you support.
18
+ - A video block can be rendered in a custom made player.
19
+ - A button block can survive your next redesign.
20
+ - Knowing your titles hierarchy inside a long content can gives you the ability to automate building of a table of content.
21
+ - A dedicated block type can help you to integrate descriptions of one or more of your products into a blog post.
22
+
23
+ `CompositeContent` provides basis for a composite content management on your models, in a way that can be compared to article construction on [medium.com](https://medium.com) or to the [WordPress Gutenberg editor](https://wordpress.org/gutenberg/), and aims to integrate well with your Rails application. It's voluntarily kept simple so you can plug your favorite tools in and style it to integrate well with your design.
24
+
25
+ ## Installation
26
+
27
+ `CompositeContent` is distributed as a gem and available on [rubygems.org](https://rubygems.org/gems/composite_content) so you can add it to your `Gemfile` or install it manually with:
28
+
29
+ ```ruby
30
+ gem install composite_content
31
+ ```
32
+
33
+ Once the gem is installed, you need to integrate it with your Rails application.
34
+
35
+ ```shell
36
+ # Copy CompositeContent's engine files into your app:
37
+ # - Views to app/views/composite_content
38
+ # - Database migrations to db/migrate
39
+ $ rails g composite_content:install
40
+
41
+ # Apply migrations
42
+ $ rails db:migrate
43
+ ```
44
+
45
+ **Important:** For forms to work, you also need to integrate assets from the [Cocooned gem](https://github.com/notus-sh/cocooned) with yours. As there is multiple ways to do so, wether you use Sprockets, webpacker/shakapacker or importmaps, we won't describe this step in details here.
46
+
47
+ ## Usage
48
+
49
+ In your models, you can declare one or more CompositeContent per model.
50
+
51
+ ```ruby
52
+ class Article < ApplicationRecord
53
+ # You can use the default content slot name (:composite_content)…
54
+ has_composite_content
55
+ end
56
+
57
+ class Page < ApplicationRecord
58
+ # …or give it a name that is explicit for you.
59
+ has_composite_content :main
60
+
61
+ # You can specify what kinds of blocks you accept in a content slot.
62
+ has_composite_content :aside, types: %w(CompositeContent::Blocks::Text)
63
+ end
64
+ ```
65
+
66
+ ### Strong Parameters
67
+
68
+ In your controllers, allow composite content attributes with:
69
+
70
+ ```ruby
71
+ class ArticleController < ApplicationController
72
+ # […]
73
+ def article_params
74
+ params.require(:article)
75
+ .permit(:title,
76
+ composite_content_attributes: Article.strong_parameters_for_composite_content)
77
+ end
78
+ end
79
+
80
+ class PageController < ApplicationController
81
+ # […]
82
+ def page_params
83
+ params.require(:page)
84
+ .permit(:title,
85
+ main_attributes: Page.strong_parameters_for_main,
86
+ aside_attributes: Page.strong_parameters_for_aside)
87
+ end
88
+ end
89
+ ```
90
+
91
+ ### Views
92
+
93
+ In your forms, make composite content editable with:
94
+
95
+ ```erbruby
96
+ <%= form.fields_for :composite_content do |composite_content_form| %>
97
+ <%= render 'composite_content/slot/form', form: composite_content_form %>
98
+ <% end %>
99
+ ```
100
+
101
+ In your views, render the content of a slot with:
102
+
103
+ ```erbruby
104
+ <%= composite_content_render_slot(article.composite_content) %>
105
+
106
+ <%= composite_content_render_slot(page.main) %>
107
+ <%= composite_content_render_slot(page.aside) %>
108
+ ```
109
+
110
+ ## Contributing
111
+
112
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/notus-sh/composite_content>.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+
5
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
6
+ load 'rails/tasks/engine.rake'
7
+ load 'rails/tasks/statistics.rake'
8
+
9
+ require 'bundler/gem_tasks'
10
+
11
+ require 'rspec/core/rake_task'
12
+ RSpec::Core::RakeTask.new
13
+
14
+ require 'rubocop/rake_task'
15
+ RuboCop::RakeTask.new
16
+
17
+ task default: :spec
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/composite_content/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'composite_content'
7
+ spec.version = CompositeContent::VERSION
8
+ spec.licenses = ['Apache-2.0']
9
+ spec.authors = ['Gaël-Ian Havard']
10
+ spec.email = ['gael-ian@notus.sh']
11
+
12
+ spec.summary = 'Add composite content capacities to your ActiveRecord models.'
13
+ spec.description = 'Build complex contents for your ActiveRecord models in a controllable way.'
14
+ spec.homepage = 'https://github.com/notus-sh/composite_content'
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = spec.homepage
18
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
19
+
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
+ spec.metadata['rubygems_mfa_required'] = 'true'
22
+
23
+ spec.require_paths = ['lib']
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+
30
+ spec.required_ruby_version = '>= 2.6.0'
31
+
32
+ spec.add_dependency 'active_model_validations_reflection'
33
+ spec.add_dependency 'acts_as_list', '~> 1.0.4'
34
+ spec.add_dependency 'cocooned', '~> 1.4.0'
35
+ spec.add_dependency 'rails', '>= 6.1.0'
36
+
37
+ # Development tools
38
+ spec.add_development_dependency 'bundler', '~> 2.1'
39
+ spec.add_development_dependency 'rake', '~> 13.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.10'
41
+ spec.add_development_dependency 'rubocop'
42
+ spec.add_development_dependency 'rubocop-performance'
43
+ spec.add_development_dependency 'rubocop-rails'
44
+ spec.add_development_dependency 'rubocop-rake'
45
+ spec.add_development_dependency 'rubocop-rspec'
46
+ spec.add_development_dependency 'shoulda-matchers', '~> 5.0'
47
+ end
@@ -0,0 +1,10 @@
1
+ ---
2
+ en:
3
+ composite_content:
4
+ blocks:
5
+ heading:
6
+ add: Add a title
7
+ quote:
8
+ add: Add a quote
9
+ text:
10
+ add: Add a text
@@ -0,0 +1,10 @@
1
+ ---
2
+ fr:
3
+ composite_content:
4
+ blocks:
5
+ heading:
6
+ add: Ajouter un titre
7
+ quote:
8
+ add: Ajouter une citation
9
+ text:
10
+ add: Ajouter un text
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCompositeContentSlots < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :composite_content_slots do |t|
6
+ t.string :type,
7
+ null: false,
8
+ index: true
9
+
10
+ t.references :parent,
11
+ polymorphic: true,
12
+ index: { name: 'index_composite_content_slots_on_parent' }
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCompositeContentBlocks < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :composite_content_blocks do |t|
6
+ t.references :slot
7
+ t.references :blockable, polymorphic: true,
8
+ index: { name: 'index_composite_content_blocks_on_blockable' }
9
+ t.integer :position, index: true
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCompositeContentHeadings < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :composite_content_headings do |t|
6
+ t.integer :level, null: false, default: 1
7
+ t.string :content
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCompositeContentQuotes < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :composite_content_quotes do |t|
6
+ t.text :content
7
+ t.string :source
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCompositeContentTexts < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :composite_content_texts do |t|
6
+ t.text :content
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec path: '..'
6
+
7
+ group :development, :test do
8
+ gem 'rails', '~> 6.1.0'
9
+ gem 'sqlite3'
10
+
11
+ gem 'net-smtp'
12
+ gem 'net-pop'
13
+ gem 'net-imap'
14
+ end