bootstrap_form 4.4.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +48 -0
  3. data/.gitignore +28 -3
  4. data/.rubocop.yml +19 -15
  5. data/CHANGELOG.md +82 -1
  6. data/CONTRIBUTING.md +73 -12
  7. data/Dangerfile +5 -7
  8. data/Dockerfile +21 -0
  9. data/Gemfile +8 -11
  10. data/README.md +829 -82
  11. data/RELEASING.md +5 -10
  12. data/UPGRADE-4.0.md +1 -1
  13. data/UPGRADE-5.0.md +25 -0
  14. data/bootstrap_form.gemspec +8 -5
  15. data/demo/.ruby-version +1 -0
  16. data/demo/Gemfile +80 -0
  17. data/demo/Gemfile.lock +261 -0
  18. data/demo/Procfile.dev +2 -0
  19. data/demo/app/assets/builds/.keep +0 -0
  20. data/demo/app/assets/builds/application.js.LICENSE.txt +9 -0
  21. data/demo/app/assets/config/manifest.js +2 -2
  22. data/demo/app/assets/stylesheets/actiontext.css +31 -0
  23. data/demo/app/assets/stylesheets/application.scss +1 -1
  24. data/demo/app/controllers/bootstrap_controller.rb +17 -2
  25. data/demo/app/controllers/users_controller.rb +9 -0
  26. data/demo/app/helpers/bootstrap_helper.rb +5 -5
  27. data/demo/app/javascript/application.js +3 -0
  28. data/demo/app/models/skill.rb +15 -0
  29. data/demo/app/models/user.rb +14 -0
  30. data/demo/app/views/active_storage/blobs/_blob.html.erb +1 -1
  31. data/demo/app/views/bootstrap/form.html.erb +13 -0
  32. data/demo/app/views/layouts/action_text/contents/_content.html.erb +3 -0
  33. data/demo/app/views/layouts/application.html.erb +28 -20
  34. data/demo/bin/dev +9 -0
  35. data/demo/config/environments/development.rb +3 -3
  36. data/demo/config/puma.rb +2 -2
  37. data/demo/config/routes.rb +1 -0
  38. data/demo/db/schema.rb +31 -16
  39. data/demo/doc/screenshots/bootstrap/index/00_horizontal_form.png +0 -0
  40. data/demo/doc/screenshots/bootstrap/index/01_with_validation_error.png +0 -0
  41. data/demo/doc/screenshots/bootstrap/index/02_inline_form.png +0 -0
  42. data/demo/doc/screenshots/bootstrap/index/03_simple_action_text_example.png +0 -0
  43. data/demo/doc/screenshots/bootstrap/index/04_floating_labels.png +0 -0
  44. data/demo/doc/screenshots/bootstrap/readme/00_example.png +0 -0
  45. data/demo/doc/screenshots/bootstrap/readme/01_example.png +0 -0
  46. data/demo/doc/screenshots/bootstrap/readme/02_example.png +0 -0
  47. data/demo/doc/screenshots/bootstrap/readme/03_example.png +0 -0
  48. data/demo/doc/screenshots/bootstrap/readme/04_example.png +0 -0
  49. data/demo/doc/screenshots/bootstrap/readme/05_example.png +0 -0
  50. data/demo/doc/screenshots/bootstrap/readme/06_example.png +0 -0
  51. data/demo/doc/screenshots/bootstrap/readme/07_example.png +0 -0
  52. data/demo/doc/screenshots/bootstrap/readme/08_example.png +0 -0
  53. data/demo/doc/screenshots/bootstrap/readme/09_example.png +0 -0
  54. data/demo/doc/screenshots/bootstrap/readme/10_example.png +0 -0
  55. data/demo/doc/screenshots/bootstrap/readme/11_example.png +0 -0
  56. data/demo/doc/screenshots/bootstrap/readme/12_example.png +0 -0
  57. data/demo/doc/screenshots/bootstrap/readme/13_example.png +0 -0
  58. data/demo/doc/screenshots/bootstrap/readme/14_example.png +0 -0
  59. data/demo/doc/screenshots/bootstrap/readme/15_example.png +0 -0
  60. data/demo/doc/screenshots/bootstrap/readme/16_example.png +0 -0
  61. data/demo/doc/screenshots/bootstrap/readme/17_example.png +0 -0
  62. data/demo/doc/screenshots/bootstrap/readme/18_example.png +0 -0
  63. data/demo/doc/screenshots/bootstrap/readme/19_example.png +0 -0
  64. data/demo/doc/screenshots/bootstrap/readme/20_example.png +0 -0
  65. data/demo/doc/screenshots/bootstrap/readme/21_example.png +0 -0
  66. data/demo/doc/screenshots/bootstrap/readme/22_example.png +0 -0
  67. data/demo/doc/screenshots/bootstrap/readme/23_example.png +0 -0
  68. data/demo/doc/screenshots/bootstrap/readme/24_example.png +0 -0
  69. data/demo/doc/screenshots/bootstrap/readme/25_example.png +0 -0
  70. data/demo/doc/screenshots/bootstrap/readme/26_example.png +0 -0
  71. data/demo/doc/screenshots/bootstrap/readme/27_example.png +0 -0
  72. data/demo/doc/screenshots/bootstrap/readme/28_example.png +0 -0
  73. data/demo/doc/screenshots/bootstrap/readme/29_example.png +0 -0
  74. data/demo/doc/screenshots/bootstrap/readme/30_example.png +0 -0
  75. data/demo/doc/screenshots/bootstrap/readme/31_example.png +0 -0
  76. data/demo/doc/screenshots/bootstrap/readme/32_example.png +0 -0
  77. data/demo/doc/screenshots/bootstrap/readme/33_example.png +0 -0
  78. data/demo/doc/screenshots/bootstrap/readme/34_example.png +0 -0
  79. data/demo/doc/screenshots/bootstrap/readme/35_example.png +0 -0
  80. data/demo/doc/screenshots/bootstrap/readme/36_example.png +0 -0
  81. data/demo/doc/screenshots/bootstrap/readme/37_example.png +0 -0
  82. data/demo/doc/screenshots/bootstrap/readme/38_example.png +0 -0
  83. data/demo/doc/screenshots/bootstrap/readme/39_example.png +0 -0
  84. data/demo/doc/screenshots/bootstrap/readme/40_example.png +0 -0
  85. data/demo/doc/screenshots/bootstrap/readme/41_example.png +0 -0
  86. data/demo/doc/screenshots/bootstrap/readme/42_example.png +0 -0
  87. data/demo/doc/screenshots/bootstrap/readme/43_example.png +0 -0
  88. data/demo/doc/screenshots/bootstrap/readme/44_example.png +0 -0
  89. data/demo/doc/screenshots/bootstrap/readme/45_example.png +0 -0
  90. data/demo/doc/screenshots/bootstrap/readme/46_example.png +0 -0
  91. data/demo/doc/screenshots/bootstrap/readme/47_example.png +0 -0
  92. data/demo/doc/screenshots/bootstrap/readme/48_example.png +0 -0
  93. data/demo/doc/screenshots/bootstrap/readme/49_example.png +0 -0
  94. data/demo/doc/screenshots/bootstrap/readme/50_example.png +0 -0
  95. data/demo/package.json +10 -6
  96. data/demo/test/application_system_test_case.rb +8 -0
  97. data/demo/test/controllers/bootstrap_controller_test.rb +8 -0
  98. data/demo/test/controllers/users_controller_test.rb +13 -0
  99. data/demo/test/fixtures/users.yml +2 -0
  100. data/demo/test/system/bootstrap_test.rb +84 -0
  101. data/demo/test/test_helper.rb +10 -0
  102. data/demo/webpack.config.js +20 -0
  103. data/demo/yarn.lock +4063 -3144
  104. data/docker-compose.yml +49 -0
  105. data/gemfiles/5.2.gemfile +2 -15
  106. data/gemfiles/6.0.gemfile +2 -17
  107. data/gemfiles/6.1.gemfile +4 -0
  108. data/gemfiles/7.0.gemfile +6 -0
  109. data/gemfiles/edge.gemfile +2 -17
  110. data/lib/bootstrap_form/action_view_extensions/form_helper.rb +1 -1
  111. data/lib/bootstrap_form/components/hints.rb +13 -4
  112. data/lib/bootstrap_form/components/labels.rb +2 -2
  113. data/lib/bootstrap_form/components/validation.rb +1 -1
  114. data/lib/bootstrap_form/configuration.rb +22 -0
  115. data/lib/bootstrap_form/form_builder.rb +10 -12
  116. data/lib/bootstrap_form/form_group.rb +26 -11
  117. data/lib/bootstrap_form/form_group_builder.rb +6 -8
  118. data/lib/bootstrap_form/helpers/bootstrap.rb +17 -12
  119. data/lib/bootstrap_form/inputs/base.rb +5 -5
  120. data/lib/bootstrap_form/inputs/check_box.rb +11 -23
  121. data/lib/bootstrap_form/inputs/collection_check_boxes.rb +5 -1
  122. data/lib/bootstrap_form/inputs/collection_select.rb +2 -1
  123. data/lib/bootstrap_form/inputs/file_field.rb +3 -15
  124. data/lib/bootstrap_form/inputs/grouped_collection_select.rb +2 -1
  125. data/lib/bootstrap_form/inputs/radio_button.rb +17 -30
  126. data/lib/bootstrap_form/inputs/select.rb +1 -0
  127. data/lib/bootstrap_form/inputs/time_zone_select.rb +1 -0
  128. data/lib/bootstrap_form/version.rb +1 -1
  129. data/lib/bootstrap_form.rb +17 -7
  130. metadata +94 -16
  131. data/.travis.yml +0 -42
  132. data/demo/config/initializers/assets.rb +0 -14
  133. data/gemfiles/5.0.gemfile +0 -18
  134. data/gemfiles/5.1.gemfile +0 -17
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.4.
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.
data/UPGRADE-4.0.md CHANGED
@@ -33,7 +33,7 @@ One way to make the above behave the same in `bootstrap_form` v4.0 is to write i
33
33
  <%= bootstrap_form_for(@user) do |f| %>
34
34
  <%= f.form_group(:email) do %>
35
35
  <p class="form-control-plaintext">Bar</p>
36
- <%= content_tag(:div, @user.errors[:email].join(", "), class: "invalid-feedback", style: "display: block;") unless @user.errors[:email].empty? %>
36
+ <%= tag.div(@user.errors[:email].join(", "), class: "invalid-feedback", style: "display: block;") unless @user.errors[:email].empty? %>
37
37
  <%= end %>
38
38
  <%= end %>
39
39
  ```
data/UPGRADE-5.0.md ADDED
@@ -0,0 +1,25 @@
1
+ # Upgrading to `bootstrap_form` 5.0
2
+
3
+ We made every effort to make the upgrade from `bootstrap_form` v4 (Bootstrap 4) to `bootstrap_form` 5.0 (Bootstrap 5) as easy as possible. However, Bootstrap 5 is fundamentally different from Bootstrap 4, so some changes may be necessary in your code.
4
+
5
+ ## Bootstrap 5 Changes
6
+
7
+ Upgrading `bootstrap_form` to version 5 means you must upgrade your whole application to Bootstrap 5. Read the [Bootstrap 5 migration guide](https://v5.getbootstrap.com/docs/5.0/migration/) to see what changes you have to make to your views. This will also help you understand changes you might have to make to your `bootstrap_form` code.
8
+
9
+ ## `bootstrap_form` Version 5 Changes
10
+
11
+ ## No `role="form"` Attribute
12
+
13
+ As explained in #560, the `role="form"` attribute generated by `bootstrap_4` caused the W3C validator to output a warning. The `role="form"` attribute was deprecated in the 4.5.0 and is being remove completely in 5.0.0. This has no impact on `bootstrap_form` code itself, but may affect your application if it depended on a form having this attribute set. (Issue #569)
14
+
15
+ ## Different behavior for `errors_on` helper
16
+
17
+ The `errors_on` helper now wraps the error message in a CSS class `invalid-feedback`, instead of `alert` and `alert-danger`, as before.
18
+
19
+ This will display the error as any other [Bootstrap inline form error](https://getbootstrap.com/docs/5.0/forms/validation/#server-side), instead of displaying it as an [Bootstrap alert](https://getbootstrap.com/docs/5.0/components/alerts/).
20
+
21
+ You can use the `custom_class` options for this helper with `alert alert-danger` to restore the old behaviour:
22
+
23
+ ```erb
24
+ <%= f.errors_on :tasks, custom_class: 'alert alert-danger' %>
25
+ ```
@@ -3,6 +3,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  require "bootstrap_form/version"
5
5
 
6
+ REQUIRED_RAILS_VERSION = ">= 5.2".freeze
7
+
6
8
  Gem::Specification.new do |s|
7
9
  s.name = "bootstrap_form"
8
10
  s.version = BootstrapForm::VERSION
@@ -10,10 +12,11 @@ Gem::Specification.new do |s|
10
12
  s.email = ["potenza@gmail.com", "carlos.el.lopes@gmail.com"]
11
13
  s.homepage = "https://github.com/bootstrap-ruby/bootstrap_form"
12
14
  s.summary = "Rails form builder that makes it easy to style forms using "\
13
- "Bootstrap 4"
15
+ "Bootstrap 5"
14
16
  s.description = "bootstrap_form is a rails form builder that makes it super "\
15
- "easy to create beautiful-looking forms using Bootstrap 4"
17
+ "easy to create beautiful-looking forms using Bootstrap 5"
16
18
  s.license = "MIT"
19
+ s.metadata = { "rubygems_mfa_required" => "true" }
17
20
 
18
21
  s.files = `git ls-files -z`.split("\x0").reject do |f|
19
22
  f.match(%r{^(test)/})
@@ -22,8 +25,8 @@ Gem::Specification.new do |s|
22
25
  s.bindir = "exe"
23
26
  s.require_paths = ["lib"]
24
27
 
25
- s.required_ruby_version = ">= 2.3"
28
+ s.required_ruby_version = ">= 2.7"
26
29
 
27
- s.add_dependency("actionpack", ">= 5.0")
28
- s.add_dependency("activemodel", ">= 5.0")
30
+ s.add_dependency("actionpack", REQUIRED_RAILS_VERSION)
31
+ s.add_dependency("activemodel", REQUIRED_RAILS_VERSION)
29
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,2 +1,2 @@
1
- //= link_tree ../images
2
- //= link_directory ../stylesheets .css
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
@@ -2,7 +2,7 @@ module BootstrapHelper
2
2
  def form_with_source(&block)
3
3
  form_html = capture(&block)
4
4
 
5
- content_tag(:div, class: "example") do
5
+ tag.div(class: "example") do
6
6
  concat(form_html)
7
7
  concat(toggle)
8
8
  concat(codemirror(form_html))
@@ -12,16 +12,16 @@ module BootstrapHelper
12
12
  private
13
13
 
14
14
  def codemirror(form_html)
15
- content_tag(:div, class: "code", style: "display: none") do
16
- content_tag(:textarea, class: "codemirror") do
15
+ tag.div(class: "code", style: "display: none") do
16
+ tag.textarea(class: "codemirror") do
17
17
  HtmlBeautifier.beautify(form_html.strip.gsub(">", ">\n").gsub("<", "\n<"))
18
18
  end
19
19
  end
20
20
  end
21
21
 
22
22
  def toggle
23
- content_tag(:button, class: "toggle btn btn-sm btn-info") do
24
- "Show Source Code"
23
+ tag.button(class: "toggle btn btn-sm btn-info") do
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">
@@ -52,3 +52,16 @@
52
52
  <%= form.submit %>
53
53
  <% end %>
54
54
  <% end %>
55
+
56
+ <h3>Floating Labels</h3>
57
+
58
+ <%= form_with_source do %>
59
+ <%= bootstrap_form_for @user do |form| %>
60
+ <%= form.email_field :email, placeholder: "Enter Email", label: "Email address", help: "We'll never share your email with anyone else", floating: true %>
61
+ <%= form.password_field :password, placeholder: "Password", floating: true %>
62
+ <%= form.text_field :misc, floating: true %>
63
+ <%= form.text_area :comments, floating: true %>
64
+ <%= form.select :status, [["Active", 1], ["Inactive", 2]], include_blank: "Select a value", floating: true %>
65
+ <%= form.submit %>
66
+ <% end %>
67
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="trix-content">
2
+ <%= yield -%>
3
+ </div>