bootstrap_form 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -12
  3. data/.gitignore +12 -2
  4. data/.rubocop.yml +2 -1
  5. data/CHANGELOG.md +45 -2
  6. data/CONTRIBUTING.md +17 -16
  7. data/Dangerfile +1 -1
  8. data/Dockerfile +2 -7
  9. data/Gemfile +5 -7
  10. data/README.md +756 -52
  11. data/RELEASING.md +5 -10
  12. data/bootstrap_form.gemspec +2 -3
  13. data/demo/.ruby-version +1 -0
  14. data/demo/Gemfile +80 -0
  15. data/demo/Gemfile.lock +261 -0
  16. data/demo/Procfile.dev +2 -0
  17. data/demo/app/assets/builds/.keep +0 -0
  18. data/demo/app/assets/builds/application.js.LICENSE.txt +9 -0
  19. data/demo/app/assets/config/manifest.js +1 -0
  20. data/demo/app/assets/stylesheets/actiontext.css +31 -0
  21. data/demo/app/assets/stylesheets/application.scss +1 -1
  22. data/demo/app/controllers/bootstrap_controller.rb +17 -2
  23. data/demo/app/controllers/users_controller.rb +9 -0
  24. data/demo/app/helpers/bootstrap_helper.rb +1 -1
  25. data/demo/app/javascript/application.js +3 -0
  26. data/demo/app/models/skill.rb +15 -0
  27. data/demo/app/models/user.rb +14 -0
  28. data/demo/app/views/active_storage/blobs/_blob.html.erb +1 -1
  29. data/demo/app/views/layouts/action_text/contents/_content.html.erb +3 -0
  30. data/demo/app/views/layouts/application.html.erb +28 -20
  31. data/demo/bin/dev +9 -0
  32. data/demo/config/environments/development.rb +3 -3
  33. data/demo/config/routes.rb +1 -0
  34. data/demo/db/schema.rb +29 -14
  35. data/demo/doc/screenshots/bootstrap/index/00_horizontal_form.png +0 -0
  36. data/demo/doc/screenshots/bootstrap/index/01_with_validation_error.png +0 -0
  37. data/demo/doc/screenshots/bootstrap/index/02_inline_form.png +0 -0
  38. data/demo/doc/screenshots/bootstrap/index/03_simple_action_text_example.png +0 -0
  39. data/demo/doc/screenshots/bootstrap/index/04_floating_labels.png +0 -0
  40. data/demo/doc/screenshots/bootstrap/readme/00_example.png +0 -0
  41. data/demo/doc/screenshots/bootstrap/readme/01_example.png +0 -0
  42. data/demo/doc/screenshots/bootstrap/readme/02_example.png +0 -0
  43. data/demo/doc/screenshots/bootstrap/readme/03_example.png +0 -0
  44. data/demo/doc/screenshots/bootstrap/readme/04_example.png +0 -0
  45. data/demo/doc/screenshots/bootstrap/readme/05_example.png +0 -0
  46. data/demo/doc/screenshots/bootstrap/readme/06_example.png +0 -0
  47. data/demo/doc/screenshots/bootstrap/readme/07_example.png +0 -0
  48. data/demo/doc/screenshots/bootstrap/readme/08_example.png +0 -0
  49. data/demo/doc/screenshots/bootstrap/readme/09_example.png +0 -0
  50. data/demo/doc/screenshots/bootstrap/readme/10_example.png +0 -0
  51. data/demo/doc/screenshots/bootstrap/readme/11_example.png +0 -0
  52. data/demo/doc/screenshots/bootstrap/readme/12_example.png +0 -0
  53. data/demo/doc/screenshots/bootstrap/readme/13_example.png +0 -0
  54. data/demo/doc/screenshots/bootstrap/readme/14_example.png +0 -0
  55. data/demo/doc/screenshots/bootstrap/readme/15_example.png +0 -0
  56. data/demo/doc/screenshots/bootstrap/readme/16_example.png +0 -0
  57. data/demo/doc/screenshots/bootstrap/readme/17_example.png +0 -0
  58. data/demo/doc/screenshots/bootstrap/readme/18_example.png +0 -0
  59. data/demo/doc/screenshots/bootstrap/readme/19_example.png +0 -0
  60. data/demo/doc/screenshots/bootstrap/readme/20_example.png +0 -0
  61. data/demo/doc/screenshots/bootstrap/readme/21_example.png +0 -0
  62. data/demo/doc/screenshots/bootstrap/readme/22_example.png +0 -0
  63. data/demo/doc/screenshots/bootstrap/readme/23_example.png +0 -0
  64. data/demo/doc/screenshots/bootstrap/readme/24_example.png +0 -0
  65. data/demo/doc/screenshots/bootstrap/readme/25_example.png +0 -0
  66. data/demo/doc/screenshots/bootstrap/readme/26_example.png +0 -0
  67. data/demo/doc/screenshots/bootstrap/readme/27_example.png +0 -0
  68. data/demo/doc/screenshots/bootstrap/readme/28_example.png +0 -0
  69. data/demo/doc/screenshots/bootstrap/readme/29_example.png +0 -0
  70. data/demo/doc/screenshots/bootstrap/readme/30_example.png +0 -0
  71. data/demo/doc/screenshots/bootstrap/readme/31_example.png +0 -0
  72. data/demo/doc/screenshots/bootstrap/readme/32_example.png +0 -0
  73. data/demo/doc/screenshots/bootstrap/readme/33_example.png +0 -0
  74. data/demo/doc/screenshots/bootstrap/readme/34_example.png +0 -0
  75. data/demo/doc/screenshots/bootstrap/readme/35_example.png +0 -0
  76. data/demo/doc/screenshots/bootstrap/readme/36_example.png +0 -0
  77. data/demo/doc/screenshots/bootstrap/readme/37_example.png +0 -0
  78. data/demo/doc/screenshots/bootstrap/readme/38_example.png +0 -0
  79. data/demo/doc/screenshots/bootstrap/readme/39_example.png +0 -0
  80. data/demo/doc/screenshots/bootstrap/readme/40_example.png +0 -0
  81. data/demo/doc/screenshots/bootstrap/readme/41_example.png +0 -0
  82. data/demo/doc/screenshots/bootstrap/readme/42_example.png +0 -0
  83. data/demo/doc/screenshots/bootstrap/readme/43_example.png +0 -0
  84. data/demo/doc/screenshots/bootstrap/readme/44_example.png +0 -0
  85. data/demo/doc/screenshots/bootstrap/readme/45_example.png +0 -0
  86. data/demo/doc/screenshots/bootstrap/readme/46_example.png +0 -0
  87. data/demo/doc/screenshots/bootstrap/readme/47_example.png +0 -0
  88. data/demo/doc/screenshots/bootstrap/readme/48_example.png +0 -0
  89. data/demo/doc/screenshots/bootstrap/readme/49_example.png +0 -0
  90. data/demo/doc/screenshots/bootstrap/readme/50_example.png +0 -0
  91. data/demo/package.json +10 -6
  92. data/demo/test/application_system_test_case.rb +8 -0
  93. data/demo/test/controllers/bootstrap_controller_test.rb +8 -0
  94. data/demo/test/controllers/users_controller_test.rb +13 -0
  95. data/demo/test/fixtures/users.yml +2 -0
  96. data/demo/test/system/bootstrap_test.rb +84 -0
  97. data/demo/test/test_helper.rb +10 -0
  98. data/demo/webpack.config.js +20 -0
  99. data/demo/yarn.lock +4063 -3144
  100. data/docker-compose.yml +22 -43
  101. data/gemfiles/7.0.gemfile +6 -0
  102. data/lib/bootstrap_form/components/hints.rb +13 -4
  103. data/lib/bootstrap_form/components/labels.rb +1 -1
  104. data/lib/bootstrap_form/form_builder.rb +6 -6
  105. data/lib/bootstrap_form/form_group.rb +6 -2
  106. data/lib/bootstrap_form/helpers/bootstrap.rb +7 -3
  107. data/lib/bootstrap_form/inputs/check_box.rb +5 -3
  108. data/lib/bootstrap_form/inputs/collection_check_boxes.rb +5 -1
  109. data/lib/bootstrap_form/inputs/collection_select.rb +1 -1
  110. data/lib/bootstrap_form/inputs/grouped_collection_select.rb +1 -1
  111. data/lib/bootstrap_form/inputs/radio_button.rb +13 -8
  112. data/lib/bootstrap_form/version.rb +1 -1
  113. metadata +82 -21
  114. data/demo/config/initializers/assets.rb +0 -14
data/RELEASING.md CHANGED
@@ -6,20 +6,15 @@ Follow these steps to release a new version of bootstrap_form to rubygems.org.
6
6
 
7
7
  * You must have commit rights to the bootstrap_form repository.
8
8
  * You must have push rights for the bootstrap_form gem on rubygems.org.
9
- * You must be using Ruby >= 2.5.
10
- * Your GitHub credentials must be available to Chandler via `~/.netrc` or an environment variable, [as explained here](https://github.com/mattbrictson/chandler#2-configure-credentials).
9
+ * You must be using a Ruby version that is not end-of-life.
11
10
 
12
11
  ## How to release
13
12
 
14
- 1. Run `bundle install` to make sure that you have all the gems necessary for testing and releasing.
15
- 2. **Ensure the tests are passing by running `bundle exec rake`.**
13
+ 1. Run `BUNDLE_GEMFILE=gemfiles/7.0.gemfile bundle update` to make sure that you have all the gems necessary for testing and releasing.
14
+ 2. **Ensure the tests are passing by running `BUNDLE_GEMFILE=gemfiles/7.0.gemfile bundle update`.** (Currently this step shows a lot of warnings about method redefinitions, but otherwise everything must be green before release.)
16
15
  3. Determine which would be the correct next version number according to [semver](http://semver.org/).
17
16
  4. Update the version in `./lib/bootstrap_form/version.rb`.
18
- 5. Update the `CHANGELOG.md` (for an illustration of these steps, refer to the [4.0.0.alpha1 commit](https://github.com/bootstrap-ruby/bootstrap_form/commit/8aac3667931a16537ab68038ec4cebce186bd596#diff-4ac32a78649ca5bdd8e0ba38b7006a1e) as an example):
19
- * Rename the Pending Release section to `[version][] (date)` with appropriate values `version` and `date`
20
- * Remove the "Your contribution here!" bullets from the release notes
21
- * Add a new Pending Release section at the top of the file with a template for contributors to fill in, including "Your contribution here!" bullets
22
- * Add the appropriate GitHub diff links to the footer of the document
17
+ 5. Update the GitHub diff links at the beginning of `CHANGELOG.md` (The pattern should be obvious when you look at them).
23
18
  6. Update the installation instructions in `README.md` to use the new version.
24
19
  7. Commit the CHANGELOG and version changes in a single commit; the message should be "Preparing vX.Y.Z" where `X.Y.Z` is the version being released.
25
- 8. Run `bundle exec rake release`; this will tag, push to GitHub, publish to rubygems.org, and upload the latest CHANGELOG entry to the [GitHub releases page](https://github.com/bootstrap-ruby/bootstrap_form/releases).
20
+ 8. Run `bundle exec rake release`; this will tag, push to GitHub, and publish to rubygems.org.
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.description = "bootstrap_form is a rails form builder that makes it super "\
17
17
  "easy to create beautiful-looking forms using Bootstrap 5"
18
18
  s.license = "MIT"
19
+ s.metadata = { "rubygems_mfa_required" => "true" }
19
20
 
20
21
  s.files = `git ls-files -z`.split("\x0").reject do |f|
21
22
  f.match(%r{^(test)/})
@@ -24,10 +25,8 @@ Gem::Specification.new do |s|
24
25
  s.bindir = "exe"
25
26
  s.require_paths = ["lib"]
26
27
 
27
- s.required_ruby_version = ">= 2.5"
28
+ s.required_ruby_version = ">= 2.7"
28
29
 
29
30
  s.add_dependency("actionpack", REQUIRED_RAILS_VERSION)
30
31
  s.add_dependency("activemodel", REQUIRED_RAILS_VERSION)
31
-
32
- s.add_development_dependency("rails", REQUIRED_RAILS_VERSION)
33
32
  end
@@ -0,0 +1 @@
1
+ ruby-2.7.6
data/demo/Gemfile ADDED
@@ -0,0 +1,80 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby File.read("#{__dir__}/.ruby-version").delete_prefix("ruby-").chomp
5
+
6
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7
+ gem "rails", "~> 7.0.0"
8
+
9
+ # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
10
+ gem "sprockets-rails"
11
+
12
+ # Use sqlite3 as the database for Active Record
13
+ gem "sqlite3", "~> 1.4"
14
+
15
+ # Use the Puma web server [https://github.com/puma/puma]
16
+ gem "puma", "~> 5.0"
17
+
18
+ # Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
19
+ gem "jsbundling-rails"
20
+
21
+ # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
22
+ gem "turbo-rails"
23
+
24
+ # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
25
+ gem "stimulus-rails"
26
+
27
+ # Bundle and process CSS [https://github.com/rails/cssbundling-rails]
28
+ gem "cssbundling-rails"
29
+
30
+ # Build JSON APIs with ease [https://github.com/rails/jbuilder]
31
+ gem "jbuilder"
32
+
33
+ # Use Redis adapter to run Action Cable in production
34
+ # gem "redis", "~> 4.0"
35
+
36
+ # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
37
+ # gem "kredis"
38
+
39
+ # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
40
+ # gem "bcrypt", "~> 3.1.7"
41
+
42
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
43
+ gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
44
+
45
+ # Reduces boot times through caching; required in config/boot.rb
46
+ gem "bootsnap", require: false
47
+
48
+ gem "bootstrap_form", "~> 5.0"
49
+
50
+ # Needed for our demo app but not the gem itself
51
+ gem "htmlbeautifier"
52
+
53
+ # Use Sass to process CSS
54
+ gem "sassc-rails"
55
+
56
+ # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
57
+ # gem "image_processing", "~> 1.2"
58
+
59
+ group :development, :test do
60
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
61
+ gem "debug", platforms: %i[mri mingw x64_mingw]
62
+ end
63
+
64
+ group :development do
65
+ # Use console on exceptions pages [https://github.com/rails/web-console]
66
+ gem "web-console"
67
+
68
+ # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
69
+ # gem "rack-mini-profiler"
70
+
71
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
72
+ # gem "spring"
73
+ end
74
+
75
+ group :test do
76
+ # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
77
+ gem "capybara-screenshot-diff"
78
+ gem "selenium-webdriver"
79
+ gem "webdrivers"
80
+ end
data/demo/Gemfile.lock ADDED
@@ -0,0 +1,261 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actioncable (7.0.2.4)
5
+ actionpack (= 7.0.2.4)
6
+ activesupport (= 7.0.2.4)
7
+ nio4r (~> 2.0)
8
+ websocket-driver (>= 0.6.1)
9
+ actionmailbox (7.0.2.4)
10
+ actionpack (= 7.0.2.4)
11
+ activejob (= 7.0.2.4)
12
+ activerecord (= 7.0.2.4)
13
+ activestorage (= 7.0.2.4)
14
+ activesupport (= 7.0.2.4)
15
+ mail (>= 2.7.1)
16
+ net-imap
17
+ net-pop
18
+ net-smtp
19
+ actionmailer (7.0.2.4)
20
+ actionpack (= 7.0.2.4)
21
+ actionview (= 7.0.2.4)
22
+ activejob (= 7.0.2.4)
23
+ activesupport (= 7.0.2.4)
24
+ mail (~> 2.5, >= 2.5.4)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (7.0.2.4)
30
+ actionview (= 7.0.2.4)
31
+ activesupport (= 7.0.2.4)
32
+ rack (~> 2.0, >= 2.2.0)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (7.0.2.4)
37
+ actionpack (= 7.0.2.4)
38
+ activerecord (= 7.0.2.4)
39
+ activestorage (= 7.0.2.4)
40
+ activesupport (= 7.0.2.4)
41
+ globalid (>= 0.6.0)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (7.0.2.4)
44
+ activesupport (= 7.0.2.4)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (7.0.2.4)
50
+ activesupport (= 7.0.2.4)
51
+ globalid (>= 0.3.6)
52
+ activemodel (7.0.2.4)
53
+ activesupport (= 7.0.2.4)
54
+ activerecord (7.0.2.4)
55
+ activemodel (= 7.0.2.4)
56
+ activesupport (= 7.0.2.4)
57
+ activestorage (7.0.2.4)
58
+ actionpack (= 7.0.2.4)
59
+ activejob (= 7.0.2.4)
60
+ activerecord (= 7.0.2.4)
61
+ activesupport (= 7.0.2.4)
62
+ marcel (~> 1.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (7.0.2.4)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ addressable (2.8.0)
70
+ public_suffix (>= 2.0.2, < 5.0)
71
+ bindex (0.8.1)
72
+ bootsnap (1.11.1)
73
+ msgpack (~> 1.2)
74
+ bootstrap_form (5.0.0)
75
+ actionpack (>= 5.2)
76
+ activemodel (>= 5.2)
77
+ builder (3.2.4)
78
+ capybara (3.36.0)
79
+ addressable
80
+ matrix
81
+ mini_mime (>= 0.1.3)
82
+ nokogiri (~> 1.8)
83
+ rack (>= 1.6.0)
84
+ rack-test (>= 0.6.3)
85
+ regexp_parser (>= 1.5, < 3.0)
86
+ xpath (~> 3.2)
87
+ capybara-screenshot-diff (1.6.1)
88
+ actionpack (>= 4.2, < 8)
89
+ capybara (>= 2, < 4)
90
+ chunky_png (~> 1.3)
91
+ childprocess (4.1.0)
92
+ chunky_png (1.4.0)
93
+ concurrent-ruby (1.1.10)
94
+ crass (1.0.6)
95
+ cssbundling-rails (1.1.0)
96
+ railties (>= 6.0.0)
97
+ debug (1.5.0)
98
+ irb (>= 1.3.6)
99
+ reline (>= 0.2.7)
100
+ digest (3.1.0)
101
+ erubi (1.10.0)
102
+ ffi (1.15.5)
103
+ globalid (1.0.0)
104
+ activesupport (>= 5.0)
105
+ htmlbeautifier (1.4.2)
106
+ i18n (1.10.0)
107
+ concurrent-ruby (~> 1.0)
108
+ io-console (0.5.11)
109
+ irb (1.4.1)
110
+ reline (>= 0.3.0)
111
+ jbuilder (2.11.5)
112
+ actionview (>= 5.0.0)
113
+ activesupport (>= 5.0.0)
114
+ jsbundling-rails (1.0.2)
115
+ railties (>= 6.0.0)
116
+ loofah (2.16.0)
117
+ crass (~> 1.0.2)
118
+ nokogiri (>= 1.5.9)
119
+ mail (2.7.1)
120
+ mini_mime (>= 0.1.1)
121
+ marcel (1.0.2)
122
+ matrix (0.4.2)
123
+ method_source (1.0.0)
124
+ mini_mime (1.1.2)
125
+ minitest (5.15.0)
126
+ msgpack (1.5.1)
127
+ net-imap (0.2.3)
128
+ digest
129
+ net-protocol
130
+ strscan
131
+ net-pop (0.1.1)
132
+ digest
133
+ net-protocol
134
+ timeout
135
+ net-protocol (0.1.3)
136
+ timeout
137
+ net-smtp (0.3.1)
138
+ digest
139
+ net-protocol
140
+ timeout
141
+ nio4r (2.5.8)
142
+ nokogiri (1.13.4-x86_64-darwin)
143
+ racc (~> 1.4)
144
+ nokogiri (1.13.4-x86_64-linux)
145
+ racc (~> 1.4)
146
+ public_suffix (4.0.7)
147
+ puma (5.6.4)
148
+ nio4r (~> 2.0)
149
+ racc (1.6.0)
150
+ rack (2.2.3)
151
+ rack-test (1.1.0)
152
+ rack (>= 1.0, < 3)
153
+ rails (7.0.2.4)
154
+ actioncable (= 7.0.2.4)
155
+ actionmailbox (= 7.0.2.4)
156
+ actionmailer (= 7.0.2.4)
157
+ actionpack (= 7.0.2.4)
158
+ actiontext (= 7.0.2.4)
159
+ actionview (= 7.0.2.4)
160
+ activejob (= 7.0.2.4)
161
+ activemodel (= 7.0.2.4)
162
+ activerecord (= 7.0.2.4)
163
+ activestorage (= 7.0.2.4)
164
+ activesupport (= 7.0.2.4)
165
+ bundler (>= 1.15.0)
166
+ railties (= 7.0.2.4)
167
+ rails-dom-testing (2.0.3)
168
+ activesupport (>= 4.2.0)
169
+ nokogiri (>= 1.6)
170
+ rails-html-sanitizer (1.4.2)
171
+ loofah (~> 2.3)
172
+ railties (7.0.2.4)
173
+ actionpack (= 7.0.2.4)
174
+ activesupport (= 7.0.2.4)
175
+ method_source
176
+ rake (>= 12.2)
177
+ thor (~> 1.0)
178
+ zeitwerk (~> 2.5)
179
+ rake (13.0.6)
180
+ regexp_parser (2.3.1)
181
+ reline (0.3.1)
182
+ io-console (~> 0.5)
183
+ rexml (3.2.5)
184
+ rubyzip (2.3.2)
185
+ sassc (2.4.0)
186
+ ffi (~> 1.9)
187
+ sassc-rails (2.1.2)
188
+ railties (>= 4.0.0)
189
+ sassc (>= 2.0)
190
+ sprockets (> 3.0)
191
+ sprockets-rails
192
+ tilt
193
+ selenium-webdriver (4.1.0)
194
+ childprocess (>= 0.5, < 5.0)
195
+ rexml (~> 3.2, >= 3.2.5)
196
+ rubyzip (>= 1.2.2)
197
+ sprockets (4.0.3)
198
+ concurrent-ruby (~> 1.0)
199
+ rack (> 1, < 3)
200
+ sprockets-rails (3.4.2)
201
+ actionpack (>= 5.2)
202
+ activesupport (>= 5.2)
203
+ sprockets (>= 3.0.0)
204
+ sqlite3 (1.4.2)
205
+ stimulus-rails (1.0.4)
206
+ railties (>= 6.0.0)
207
+ strscan (3.0.1)
208
+ thor (1.2.1)
209
+ tilt (2.0.10)
210
+ timeout (0.2.0)
211
+ turbo-rails (1.0.1)
212
+ actionpack (>= 6.0.0)
213
+ railties (>= 6.0.0)
214
+ tzinfo (2.0.4)
215
+ concurrent-ruby (~> 1.0)
216
+ web-console (4.2.0)
217
+ actionview (>= 6.0.0)
218
+ activemodel (>= 6.0.0)
219
+ bindex (>= 0.4.0)
220
+ railties (>= 6.0.0)
221
+ webdrivers (5.0.0)
222
+ nokogiri (~> 1.6)
223
+ rubyzip (>= 1.3.0)
224
+ selenium-webdriver (~> 4.0)
225
+ websocket-driver (0.7.5)
226
+ websocket-extensions (>= 0.1.0)
227
+ websocket-extensions (0.1.5)
228
+ xpath (3.2.0)
229
+ nokogiri (~> 1.8)
230
+ zeitwerk (2.5.4)
231
+
232
+ PLATFORMS
233
+ x86_64-darwin-21
234
+ x86_64-linux
235
+
236
+ DEPENDENCIES
237
+ bootsnap
238
+ bootstrap_form (~> 5.0)
239
+ capybara-screenshot-diff
240
+ cssbundling-rails
241
+ debug
242
+ htmlbeautifier
243
+ jbuilder
244
+ jsbundling-rails
245
+ puma (~> 5.0)
246
+ rails (~> 7.0.0)
247
+ sassc-rails
248
+ selenium-webdriver
249
+ sprockets-rails
250
+ sqlite3 (~> 1.4)
251
+ stimulus-rails
252
+ turbo-rails
253
+ tzinfo-data
254
+ web-console
255
+ webdrivers
256
+
257
+ RUBY VERSION
258
+ ruby 2.7.6p219
259
+
260
+ BUNDLED WITH
261
+ 2.3.12
data/demo/Procfile.dev ADDED
@@ -0,0 +1,2 @@
1
+ web: bin/rails server -p 3000 -b 0.0.0.0
2
+ js: yarn build --watch
File without changes
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
@@ -1 +1,2 @@
1
1
  //= link application.css
2
+ //= link_tree ../builds
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
3
+ * the trix-editor content (whether displayed or under editing). Feel free to incorporate this
4
+ * inclusion directly in any other asset bundle and remove this file.
5
+ *
6
+ *= require trix
7
+ */
8
+
9
+ /*
10
+ * We need to override trix.css’s image gallery styles to accommodate the
11
+ * <action-text-attachment> element we wrap around attachments. Otherwise,
12
+ * images in galleries will be squished by the max-width: 33%; rule.
13
+ */
14
+ .trix-content .attachment-gallery > action-text-attachment,
15
+ .trix-content .attachment-gallery > .attachment {
16
+ flex: 1 0 33%;
17
+ padding: 0 0.5em;
18
+ max-width: 33%;
19
+ }
20
+
21
+ .trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
22
+ .trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
23
+ .trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
24
+ flex-basis: 50%;
25
+ max-width: 50%;
26
+ }
27
+
28
+ .trix-content action-text-attachment .attachment {
29
+ padding: 0 !important;
30
+ max-width: 100% !important;
31
+ }
@@ -1 +1 @@
1
- @import "actiontext";
1
+ // @import "actiontext";
@@ -1,13 +1,28 @@
1
1
  class BootstrapController < ApplicationController
2
2
  def form
3
+ load_models
4
+ end
5
+
6
+ def fragment
7
+ @erb = params[:erb]
8
+
9
+ @erb.prepend '<div class="p-3 border">'
10
+ @erb << "</div>"
11
+ load_models
12
+ render inline: @erb, layout: "application" # rubocop: disable Rails/RenderInline
13
+ end
14
+
15
+ private
16
+
17
+ def load_models
3
18
  @collection = [
4
19
  Address.new(id: 1, street: "Foo"),
5
20
  Address.new(id: 2, street: "Bar")
6
21
  ]
7
22
 
8
- @user = User.new
23
+ @user = User.new email: "steve@example.com"
9
24
 
10
- @user_with_error = User.new
25
+ @user_with_error = User.new email: "steve.example.com"
11
26
  @user_with_error.errors.add(:email)
12
27
  @user_with_error.errors.add(:misc)
13
28
  end
@@ -0,0 +1,9 @@
1
+ class UsersController < ApplicationController
2
+ def create
3
+ redirect_to root_path
4
+ end
5
+
6
+ def update
7
+ redirect_to root_path
8
+ end
9
+ end
@@ -21,7 +21,7 @@ module BootstrapHelper
21
21
 
22
22
  def toggle
23
23
  tag.button(class: "toggle btn btn-sm btn-info") do
24
- "Show Source Code"
24
+ "Toggle Source Code"
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,3 @@
1
+ // Entry point for the build script in your package.json
2
+ import "trix"
3
+ import "@rails/actiontext"
@@ -0,0 +1,15 @@
1
+ class Skill
2
+ attr_accessor :id, :name
3
+
4
+ def initialize(id:, name:)
5
+ @id = id
6
+ @name = name
7
+ end
8
+
9
+ def self.all
10
+ [
11
+ Skill.new(id: 1, name: "Mind reading"),
12
+ Skill.new(id: 2, name: "Farming")
13
+ ]
14
+ end
15
+ end
@@ -1,4 +1,6 @@
1
1
  class User < ApplicationRecord
2
+ attr_accessor :remember_me
3
+
2
4
  serialize :preferences
3
5
 
4
6
  validates :email, presence: true, length: { minimum: 5 }
@@ -8,4 +10,16 @@ class User < ApplicationRecord
8
10
  accepts_nested_attributes_for :address
9
11
 
10
12
  has_rich_text(:life_story) if Rails::VERSION::STRING > "6"
13
+
14
+ def age
15
+ 42
16
+ end
17
+
18
+ def feet
19
+ 5
20
+ end
21
+
22
+ def inches
23
+ 7
24
+ end
11
25
  end
@@ -1,6 +1,6 @@
1
1
  <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
2
2
  <% if blob.representable? %>
3
- <%= image_tag blob.representation(resize_to_fit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
3
+ <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
4
4
  <% end %>
5
5
 
6
6
  <figcaption class="attachment__caption">
@@ -0,0 +1,3 @@
1
+ <div class="trix-content">
2
+ <%= yield -%>
3
+ </div>
@@ -6,12 +6,12 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
7
 
8
8
  <!-- Bootstrap CSS -->
9
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
10
-
9
+ <!-- CSS only -->
10
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
11
11
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/codemirror.min.css">
12
12
 
13
13
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
14
- <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
14
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload', defer: true %>
15
15
 
16
16
  <style type="text/css">
17
17
  .example {
@@ -19,8 +19,11 @@
19
19
  border: .2rem solid #f7f7f9;
20
20
  margin-bottom: 3em;
21
21
  }
22
- form {
23
- margin-bottom: 1.5em;
22
+ .toggle {
23
+ margin-top: 1.5em;
24
+ }
25
+ .code {
26
+ margin-top: 1rem;
24
27
  }
25
28
  .CodeMirror {
26
29
  border: 1px solid #eee;
@@ -34,6 +37,7 @@
34
37
 
35
38
  <title>Hello, world!</title>
36
39
  <%= csrf_meta_tags %>
40
+ <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
37
41
  </head>
38
42
 
39
43
  <body>
@@ -42,26 +46,30 @@
42
46
  </div>
43
47
 
44
48
  <!-- Optional JavaScript -->
45
- <!-- jQuery first, then Popper.js, then Bootstrap JS -->
46
- <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
47
- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js" integrity="sha384-SR1sx49pcuLnqZUnnPwx6FCym0wLsk5JZuNx2bPPENzswTNFaQU1RDvt3wT4gWFG" crossorigin="anonymous"></script>
48
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script>
49
-
49
+ <!-- JavaScript Bundle with Popper -->
50
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
50
51
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/codemirror.min.js"></script>
51
52
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/mode/htmlmixed/htmlmixed.min.js"></script>
52
53
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/mode/xml/xml.min.js"></script>
53
54
 
54
55
  <script type="text/javascript">
55
- $(document).on("click", "button.toggle", function(){
56
- var example = $(this).parent(".example");
57
- $(this).hide();
58
- $(".code", example).show()
59
- CodeMirror.fromTextArea($("textarea.codemirror", example)[0], {
60
- mode: "htmlmixed",
61
- tabSize: 2,
62
- lineNumbers: true,
63
- viewportMargin: Infinity
64
- })
56
+ const buttons = document.querySelectorAll('button.toggle');
57
+ const buttonsArray = Array.prototype.slice.call(buttons);
58
+ buttonsArray.forEach(function(elem) {
59
+ elem.addEventListener('click', function() {
60
+ const example = this.closest('.example');
61
+ if (example.querySelector('.code').style.display === "block") {
62
+ example.querySelector('.code').style.display = "none";
63
+ } else {
64
+ example.querySelector('.code').style.display = "block";
65
+ }
66
+ CodeMirror.fromTextArea(example.querySelector('textarea.codemirror'), {
67
+ mode: 'htmlmixed',
68
+ tabSize: 2,
69
+ lineNumbers: true,
70
+ viewportMargin: Infinity,
71
+ });
72
+ });
65
73
  });
66
74
  </script>
67
75
  </body>
data/demo/bin/dev ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if ! command -v foreman &> /dev/null
4
+ then
5
+ echo "Installing foreman..."
6
+ gem install foreman
7
+ fi
8
+
9
+ foreman start -f Procfile.dev
@@ -1,6 +1,6 @@
1
1
  Rails.application.configure do
2
2
  # Verifies that versions and hashed value of the package contents in the project's package.json
3
- config.webpacker.check_yarn_integrity = true
3
+ # config.webpacker.check_yarn_integrity = true
4
4
  # Settings specified here will take precedence over those in config/application.rb.
5
5
 
6
6
  # In the development environment your application's code is reloaded on
@@ -46,10 +46,10 @@ Rails.application.configure do
46
46
  # Debug mode disables concatenation and preprocessing of assets.
47
47
  # This option may cause significant delays in view rendering with a large
48
48
  # number of complex assets.
49
- config.assets.debug = true
49
+ # config.assets.debug = true
50
50
 
51
51
  # Suppress logger output for asset requests.
52
- config.assets.quiet = true
52
+ # config.assets.quiet = true
53
53
 
54
54
  # Raises error for missing translations
55
55
  # config.action_view.raise_on_missing_translations = true