devise-bootstrap-form 0.1.0 → 1.0.0.alpha.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +46 -0
  3. data/.gitignore +17 -0
  4. data/.rubocop.yml +31 -12
  5. data/CHANGELOG.md +54 -1
  6. data/CONTRIBUTING.md +38 -14
  7. data/Dangerfile +11 -13
  8. data/Gemfile +1 -1
  9. data/README.md +67 -44
  10. data/RELEASING.md +2 -1
  11. data/app/views/devise/confirmations/new.html.erb +13 -19
  12. data/app/views/devise/invitations/edit.html.erb +10 -16
  13. data/app/views/devise/invitations/new.html.erb +8 -14
  14. data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
  15. data/app/views/devise/mailer/invitation_instructions.text.erb +1 -1
  16. data/app/views/devise/passwords/edit.html.erb +19 -25
  17. data/app/views/devise/passwords/new.html.erb +11 -18
  18. data/app/views/devise/registrations/edit.html.erb +20 -26
  19. data/app/views/devise/registrations/new.html.erb +16 -22
  20. data/app/views/devise/sessions/new.html.erb +15 -21
  21. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  22. data/app/views/devise/shared/_links.html.erb +5 -5
  23. data/app/views/devise/unlocks/new.html.erb +10 -16
  24. data/app/views/i18n/confirmations/new.html.erb +17 -0
  25. data/app/views/i18n/mailer/confirmation_instructions.html.erb +4 -0
  26. data/app/views/i18n/mailer/email_changed.html.erb +7 -0
  27. data/app/views/i18n/mailer/password_change.html.erb +3 -0
  28. data/app/views/i18n/mailer/reset_password_instructions.html.erb +8 -0
  29. data/app/views/i18n/mailer/unlock_instructions.html.erb +7 -0
  30. data/app/views/i18n/passwords/edit.html.erb +23 -0
  31. data/app/views/i18n/passwords/new.html.erb +12 -0
  32. data/app/views/i18n/registrations/edit.html.erb +27 -0
  33. data/app/views/i18n/registrations/new.html.erb +19 -0
  34. data/app/views/i18n/sessions/new.html.erb +18 -0
  35. data/app/views/i18n/shared/_links.html.erb +25 -0
  36. data/app/views/i18n/unlocks/new.html.erb +14 -0
  37. data/bin/console +5 -5
  38. data/devise-bootstrap-form.gemspec +22 -13
  39. data/gemfiles/5.2.gemfile +14 -0
  40. data/gemfiles/6.0.gemfile +14 -0
  41. data/gemfiles/6.1.gemfile +14 -0
  42. data/gemfiles/7.0.gemfile +14 -0
  43. data/lib/devise_bootstrap_form/railtie.rb +6 -0
  44. data/lib/devise_bootstrap_form/version.rb +6 -0
  45. data/lib/{devise/bootstrap_form.rb → devise_bootstrap_form.rb} +1 -1
  46. data/lib/generators/devise/views/bootstrap_form_generator.rb +25 -8
  47. metadata +59 -28
  48. data/.travis.yml +0 -23
  49. data/lib/devise/bootstrap_form/railtie.rb +0 -6
  50. data/lib/devise/bootstrap_form/version.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eba5fdc6f0531e026e8aca13381f2befd5a99c5b9489aa5ebd3e8b0281ef890d
4
- data.tar.gz: 3966109984c9cd2f861a7151c23e0958600babe2c5756f1518d5bfa91f2ef78c
3
+ metadata.gz: 15bc335b3fe1c26d69757d7f3a8f0ec576b256f46b28af3ed55704053cf223e5
4
+ data.tar.gz: 4f2c6270e99305531bd0b883e04adc0788860097a73441efa1398da785f5972d
5
5
  SHA512:
6
- metadata.gz: 07e793153c7ad34be04a8da081259d06c89350e7ffe7767ae9faf8fdfa1da097de640b2dfa2bf62c2c3d3a9c261696eaa64410849667afd13d32f58e5af891ed
7
- data.tar.gz: a5d4025d26e22fa603600e1ee5146e5d0b53603f3534f20b3200dfb0e456cbaa030f5d73b53e428f5dba830cf2bae397f6a7b709bf22bc69c94de92c8fba9cbf
6
+ metadata.gz: 301fc9fd13d272c6e2123c91a9e710c041eedac49dabc2f45e791431dfeea2a8638650ddc35c278f2cf0b57bb00d7b06930af5abb676240c412fa8d1881544fb
7
+ data.tar.gz: fba754597c59efe3ad7defe844bc0c4658d5e877586898d732993d2301f6feb40bf81840519c6ca2ba4848772f7efcbad27af626ef9389aae1bc7653b82bb7cb
@@ -0,0 +1,46 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ Lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7.2
15
+ bundler-cache: true
16
+ - name: Danger
17
+ if: ${{ github.event_name == 'pull_request' }}
18
+ run: |
19
+ gem install danger
20
+ export DANGER_GITHUB_API_TOKEN=${{ github.token }}
21
+ danger
22
+ - name: Rubocop
23
+ run: bundle exec rubocop --auto-correct
24
+ Test:
25
+ runs-on: ubuntu-latest
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ ruby-version: [ '3.1', '3.0', '2.7', '2.6' ]
30
+ gemfile: [ '7.0', '6.1', '6.0', '5.2', 'edge' ]
31
+ exclude:
32
+ - { ruby-version: '3.1', gemfile: "6.1" } # Triggers some deprecations that might never get fixed
33
+ - { ruby-version: '3.1', gemfile: "6.0" }
34
+ - { ruby-version: '3.1', gemfile: "5.2" }
35
+ - { ruby-version: '3.0', gemfile: "5.2" }
36
+ - { ruby-version: '2.6', gemfile: "edge" }
37
+ - { ruby-version: '2.6', gemfile: "7.0" }
38
+ steps:
39
+ - uses: actions/checkout@v2
40
+ - name: Set up Ruby
41
+ uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{ matrix.ruby-version }}
44
+ bundler-cache: true
45
+ - name: Run tests
46
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,15 +1,32 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
+ *.gemfile.lock
4
5
  /_yardoc/
5
6
  /coverage/
6
7
  /doc/
7
8
  /pkg/
8
9
  /tmp/
9
10
  *.gem
11
+ .cache/
12
+
13
+ .netrc
14
+ .node_repl_history
15
+ .yarnrc
10
16
 
11
17
  .vagrant/
12
18
  # For some reason, the test cases generate the mailer views in this directory,
13
19
  # as well as the `test/rails_app/app/views/devise/mailer` directory.
14
20
  # TODO: Figure out why and stop it from happening.
15
21
  # app/views/devise/mailer/
22
+
23
+ # or .local/share/pry/pry_history if you need to be more exact
24
+ .local/
25
+ .irb_history
26
+ .byebug_history
27
+ # For Debian images with Bash
28
+ .bash_history
29
+ # For Alpine images
30
+ .ash_history
31
+
32
+ vendor/bundle
data/.rubocop.yml CHANGED
@@ -8,8 +8,9 @@ Style/StringLiterals:
8
8
  ConsistentQuotesInMultiline: false
9
9
  Exclude:
10
10
  - "test/rails_app/app/mailers/*"
11
+ - "test/es_rails_app/app/mailers/*"
11
12
 
12
- Layout/AlignParameters:
13
+ Layout/ParameterAlignment:
13
14
  # Alignment of parameters in multi-line method calls.
14
15
  #
15
16
  # The `with_first_parameter` style aligns the following lines along the same
@@ -31,7 +32,7 @@ Layout/AlignParameters:
31
32
  # But it can be overridden by setting this parameter
32
33
  # IndentationWidth: ~
33
34
 
34
- Metrics/LineLength:
35
+ Layout/LineLength:
35
36
  Max: 132
36
37
  # To make it possible to copy or click on URIs in the code, we allow lines
37
38
  # containing a URI to be longer than Max.
@@ -50,12 +51,11 @@ Metrics/LineLength:
50
51
 
51
52
  # Rails 5 only requires 2.2.2.
52
53
  AllCops:
54
+ NewCops: enable
53
55
  DisplayCopNames: true
54
56
  DisplayStyleGuide: true
55
- TargetRubyVersion: 2.2
56
- # TargetRubyVersion: <%= RUBY_VERSION[/\d+\.\d+/] %>
57
+ TargetRubyVersion: 2.6
57
58
  Exclude:
58
- # - "test/rails_app/**/*"
59
59
  - Capfile
60
60
  - Gemfile
61
61
  - "test/rails_app/bin/**/*"
@@ -65,24 +65,43 @@ AllCops:
65
65
  - "test/rails_app/log/**/*"
66
66
  - "test/rails_app/tmp/**/*"
67
67
  - "test/rails_app/vendor/**/*"
68
- # - test/rails_app/config/boot.rb
69
- # - test/rails_app/config/application.rb
70
- # - test/rails_app/config/environment.rb
71
- # - "test/rails_app/config/environments/*"
72
- # - "test/rails_app/config/initializers/*"
73
- # - test/rails_app/db/schema.rb
74
68
  - "test/rails_app/node_modules/**/*"
75
69
  - "test/rails_app/bower_components/**/*"
76
70
  - test/rails_app/Gemfile
77
71
  - test/rails_app/Guardfile
78
72
  - test/rails_app/Rakefile
73
+ - "test/es_rails_app/bin/**/*"
74
+ - "test/es_rails_app/config/**/*"
75
+ - test/es_rails_app/config.ru
76
+ - "test/es_rails_app/db/**/*"
77
+ - "test/es_rails_app/log/**/*"
78
+ - "test/es_rails_app/tmp/**/*"
79
+ - "test/es_rails_app/vendor/**/*"
80
+ - "test/es_rails_app/node_modules/**/*"
81
+ - "test/es_rails_app/bower_components/**/*"
82
+ - test/es_rails_app/Gemfile
83
+ - test/es_rails_app/Guardfile
84
+ - test/es_rails_app/Rakefile
85
+ - vendor/bundle/**/*
79
86
 
80
87
  Metrics/BlockLength:
81
88
  Exclude:
82
89
  - devise-bootstrap-form.gemspec
83
90
 
91
+ Metrics/AbcSize:
92
+ Exclude:
93
+ - test/**/*.rb
94
+
95
+ Metrics/ClassLength:
96
+ Exclude:
97
+ - test/**/*.rb
98
+
99
+ Metrics/MethodLength:
100
+ Exclude:
101
+ - test/**/*.rb
102
+
84
103
  # TODO: Remove this when minimum Ruby is 2.3.
85
- Layout/IndentHeredoc:
104
+ Layout/HeredocIndentation:
86
105
  Exclude:
87
106
  - Dangerfile
88
107
  - devise-bootstrap-form.gemspec
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [Pending Release][0.1.0]
1
+ ## [Pending Release][0.0.0]
2
2
 
3
3
  ### Breaking changes
4
4
 
@@ -11,3 +11,56 @@
11
11
  ### Bugfixes
12
12
 
13
13
  * Your contribution here!
14
+
15
+ ## [0.4.0][] (2022-01-02)
16
+
17
+ ### New features
18
+
19
+ * Use GitHub actions instead of Travis.
20
+ * New RuboCop rules.
21
+
22
+ ### Bugfixes
23
+
24
+ * Fix dependencies so we only use Bootstrap 4.
25
+
26
+ ## [0.3.0]
27
+
28
+ ### New features
29
+
30
+ * Remove `devise_error_messages!` and use `_error_messages.html.erb`.
31
+
32
+ ## [0.2.0][] (2018-09-30)
33
+
34
+ ### Breaking changes
35
+
36
+ * None.
37
+
38
+ ### New features
39
+
40
+ * Initial support for internationalization.
41
+
42
+ ### Bugfixes
43
+
44
+ * None.
45
+
46
+ ## [0.1.0][] (2018-08-27)
47
+
48
+ ### Breaking changes
49
+
50
+ * N/A.
51
+
52
+ ### New features
53
+
54
+ * Devise forms using [`bootstrap_form`](https://github.com/bootstrap-ruby/bootstrap_form).
55
+
56
+ ### Bugfixes
57
+
58
+ * N/A.
59
+
60
+ ```
61
+ [Pending Release]: https://github.com/lcreid/devise-bootstrap-form/compare/.v0.4.0...HEAD
62
+ [0.4.0]: https://github.com/lcreid/devise-bootstrap-form/compare/v0.3.0..v0.4.0
63
+ [0.3.0]: https://github.com/lcreid/devise-bootstrap-form/compare/v0.2.0..v0.3.0
64
+ [0.2.0]: https://github.com/lcreid/devise-bootstrap-form/compare/v0.1.0..v0.2.0
65
+ [0.1.0]: https://github.com/lcreid/devise-bootstrap-form/compare/...v0.2.0
66
+ ```
data/CONTRIBUTING.md CHANGED
@@ -1,4 +1,5 @@
1
- ## Contributing
1
+ # Contributing
2
+
2
3
  If you find a bug or have an idea for a feature:
3
4
 
4
5
  1. Search the issues to see if the bug has been found, or the feature has already been requested. If so, feel free to add your constructive input to the existing issue. Otherwise...
@@ -7,38 +8,61 @@ If you find a bug or have an idea for a feature:
7
8
  4. If you don't want to submit your own pull request, your issue is still welcome and we'll review it and respond appropriately.
8
9
 
9
10
  ## Testing
11
+
12
+ There are automated tests, and test apps that allow you do manual testing and explore the gem.
13
+
10
14
  ### Manual and Exploratory Testing
11
- There is a test app in `test/rails_app`.
12
15
 
13
- To use the `devise-bootstrap-form` gem:
16
+ There are test apps in `test/rails_app`, for the default locale, and `es_rails_app` for a Spanish locale.
14
17
 
15
- ```
16
- cd rails_app
18
+ To use the `devise-bootstrap-form` gem in a test app:
19
+
20
+ ```bash
21
+ cd test/rails_app # or cd test/es_rails_app
17
22
  # Generate the view in the test app
18
23
  rails g devise:views:bootstrap_form
19
24
  rails s -b 0.0.0.0 &
20
25
  # Navigate to localhost:3000/people/sign_in
21
26
  ```
22
27
 
23
- ### Automated Testing
28
+ To change the version of Rails for the test app:
24
29
 
30
+ ```bash
31
+ export BUNDLE_GEMFILE=gemfiles/7.0.gemfile # change this to the version of Rails you need
32
+ bundle update
33
+ rails s -b 0.0.0.0 &
25
34
  ```
35
+
36
+ ### Automated Testing
37
+
38
+ To test locally against a specific version of Rails, do the following:
39
+
40
+ ```bash
41
+ export BUNDLE_GEMFILE=gemfiles/7.0.gemfile # change this to the version of Rails you need
42
+ bundle update
26
43
  rake test
27
44
  ```
28
45
 
46
+ To run the tests and the RuboCop checks, assuming you've set the `BUNDLE_GEMFILE` as above:
47
+
48
+ ```bash
49
+ rake
50
+ ```
51
+
29
52
  ## Gotchas
30
- To test that the views work for a model other than the default `User`, the test app uses `Person` as the Devise model. It's a bit frustrating to remember that you can't just cut and paste examples that assume the model is `User`.
31
53
 
32
- ## Coding guidelines
54
+ To test that the views work for a model other than the default `User`, the test apps use `Person` as the Devise model. It's a bit frustrating to remember that you can't just cut and paste examples that assume the model is `User`.
55
+
56
+ ## Coding Guidelines
33
57
 
34
58
  This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce standard Ruby coding
35
59
  guidelines. The coding standards are close to the out-of-the-box RuboCop standards. The main differences are:
36
60
 
37
- * We prefer double-quoted strings
38
- * We allow 132 characters per line
39
- * We don't lint most of the Rails-generated files in the test application
61
+ * We prefer double-quoted strings.
62
+ * We allow 132 characters per line.
63
+ * We don't lint most of the Rails-generated files in the test application.
40
64
 
41
- Note the Travis build will fail and your PR cannot be merged if the linter finds errors
65
+ Note the GitHub actions build will fail and your PR cannot be merged if the linter finds errors.
42
66
 
43
- * Test that your contributions pass with `rake lint`
44
- * The linter is also run as part of the default rake task `rake`
67
+ * Test that your contributions pass with `rake lint`.
68
+ * The linter is also run as part of the default rake task `rake`.
data/Dangerfile CHANGED
@@ -24,19 +24,19 @@ if has_lib_changes && !has_test_changes
24
24
  warn("There are code changes, but no corresponding tests. "\
25
25
  "Please include tests if this PR introduces any modifications in "\
26
26
  "#{project_name}'s behavior.",
27
- sticky: false)
27
+ sticky: false)
28
28
  end
29
29
 
30
30
  # ------------------------------------------------------------------------------
31
31
  # Have you updated CHANGELOG.md?
32
32
  # ------------------------------------------------------------------------------
33
33
  if !has_changelog_changes && has_lib_changes
34
- markdown <<-MARKDOWN
35
- Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
34
+ markdown <<~MARKDOWN
35
+ Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
36
36
 
37
- ```markdown
38
- * [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
39
- ```
37
+ ```markdown
38
+ * [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
39
+ ```
40
40
  MARKDOWN
41
41
  warn("Please update CHANGELOG.md with a description of your changes. "\
42
42
  "If this PR is not a user-facing change (e.g. just refactoring), "\
@@ -46,11 +46,9 @@ end
46
46
  # ------------------------------------------------------------------------------
47
47
  # Did you remove the CHANGELOG's "Your contribution here!" line?
48
48
  # ------------------------------------------------------------------------------
49
- if has_changelog_changes
50
- if IO.read("CHANGELOG.md").scan(/^\s*[-\*] Your contribution here/i).count < 3
51
- raise(
52
- "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
53
- sticky: false
54
- )
55
- end
49
+ if has_changelog_changes && File.read("CHANGELOG.md").scan(/^\s*[-*] Your contribution here/i).count < 3
50
+ raise(
51
+ "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
52
+ sticky: false
53
+ )
56
54
  end
data/Gemfile CHANGED
@@ -4,10 +4,10 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in devise-bootstrap-form.gemspec
6
6
  gemspec
7
- # eval_gemfile("test/rails_app/Gemfile")
8
7
 
9
8
  group :development do
10
9
  gem "chandler", ">= 0.7.0"
11
10
  # gem "htmlbeautifier"
12
11
  gem "rubocop", require: false
12
+ gem "rubocop-rake", require: false
13
13
  end
data/README.md CHANGED
@@ -4,11 +4,9 @@ This gem gives you a nicer place to start customizing views for your Devise mode
4
4
 
5
5
  It also makes the Devise views simpler, because the code to define forms using `bootstrap_form` is simpler than the code for a "raw" Rails form. So any customization you do to the Devise views will be simpler.
6
6
 
7
- You can find usage information below, but the gist of it is you'll run `rails g devise:views:bootstrap-form` instead of the normal `rails g devise:views`.
7
+ You can find usage information below, but the gist of it is you'll run `rails g devise:views:bootstrap_form` instead of the normal `rails g devise:views`.
8
8
 
9
- If you want to switch back to what Devise gives you, no problem. Just remove the `app/views/devise` folder. You will then use the default Devise views, or you can run the normal Devise `rails g devise:views` generator command and customize the default Devise views.
10
-
11
- If you're just looking for Bootstrap markup on your Devise views, and don't want to use `bootstrap_form`, then you should look into the [`devise-bootstrapped`](https://github.com/king601/devise-bootstrapped) gem, or one of its forks.
9
+ If you're just looking for Bootstrap markup on your Devise views, and don't want to use `bootstrap_form`, then you should look into the [`devise-bootstrapped`](https://github.com/king601/devise-bootstrapped) gem, or [`devise-bootstrap-views`](https://github.com/hisea/devise-bootstrap-views).
12
10
 
13
11
  ## Installation
14
12
 
@@ -16,24 +14,34 @@ Add these lines to your application's `Gemfile`:
16
14
 
17
15
  ```ruby
18
16
  gem 'bootstrap', '~> 4.0'
19
- gem "bootstrap_form", ">= 4.0.0.alpha1"
17
+ gem "bootstrap_form", "~> 4.0"
20
18
  gem 'devise'
21
- gem 'devise-bootstrap-form', github: "lcreid/devise-bootstrap-form"
19
+ # gem 'devise-i18n'
20
+ # gem 'devise_invitable'
21
+ gem 'devise-bootstrap-form'
22
22
  ```
23
23
 
24
24
  And then execute:
25
+
25
26
  ```bash
26
27
  bundle install
27
28
  ```
28
29
 
29
- There are additional installation instructions for both [`bootstrap_form`](https://github.com/bootstrap-ruby/bootstrap_form#installation) and [`bootstrap`](https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails) that yu must complete before using `devise-bootstrap-form`.
30
+ There are additional installation instructions for [`bootstrap_form`](https://github.com/bootstrap-ruby/bootstrap_form#installation), [`bootstrap`](https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails), [`devise`](https://github.com/plataformatec/devise) that you must complete before using `devise-bootstrap-form`, and
31
+ [`devise-i18n`](https://github.com/tigrish/devise-i18n).
32
+
33
+ Note that as of Devise 4.6.0, `devise_error_messages!` is deprecated in favour of the `_error_messages.html.erb` partial. `devise-bootstrap-form` versions 0.3.0 and higher generate views that use the `_error_messages.html.erb` partial. If you need to use `devise_error_messages!`, use this line in your `Gemfile`:
34
+
35
+ ```ruby
36
+ gem 'devise-bootstrap-form', '<= 0.2.0'
37
+ ```
30
38
 
31
39
  ## Usage
32
40
 
33
- To use the Bootstrap views generator you'll want to have Devise installed per normal installation. Once you've installed Devise and generated your user model you can generate the views with:
41
+ Once all the gems are installed and configured, and the user model is generated, you can generate the Bootstrap Form views with:
34
42
 
35
43
  ```bash
36
- rails generate devise:views:bootstrap-form
44
+ rails generate devise:views:bootstrap_form
37
45
  ```
38
46
 
39
47
  If you've already generated the Devise views you can use the `-f` argument to force an override, but that will erase any of the changes you've made to the views.
@@ -44,57 +52,72 @@ Generate the mailer views from normal Devise, as they're not included in `devise
44
52
  rails generate devise:views -v mailer
45
53
  ```
46
54
 
55
+ To switch back to what Devise gives you, remove the `app/views/devise` folder. Your application will then use the default Devise views, or you can run the normal Devise `rails g devise:views` generator command and customize the default Devise views.
56
+
47
57
  ## Generated Layout
48
58
 
49
- Each of the forms in enclosed in the following:
59
+ The generated view is just like the default Devise, but any form elements (e.g. e-mail field) are created using the `bootstrap_form` helpers rather than the stock Rails helpers. This ensures that your Devise forms will have a consistent look with the rest of the forms in your application.
50
60
 
51
- ```
52
- <div class="devise-bootstrap-form">
53
- <div class="devise-bootstrap-form-row">
54
- <div class="devise-bootstrap-form-col">
55
- <!-- the form... -->
56
- </div>
57
- </div>
61
+ The generated view provides a pretty simple vertical layout. You can, and probably will, customize the generated views to your own tastes.
62
+
63
+ Here's what the sign in view looks like (internationalized version):
64
+
65
+ ```html
66
+ <h2 class="text-center"><%= t(".sign_in") %></h2>
67
+ <%= bootstrap_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
68
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
69
+ <%= f.password_field :password, autocomplete: "current-password", placeholder: "Password" %>
70
+
71
+ <% if devise_mapping.rememberable? -%>
72
+ <%= f.form_group do %>
73
+ <%= f.check_box :remember_me %>
74
+ <% end %>
75
+ <% end -%>
76
+
77
+ <%= f.form_group class: "d-grid" do %>
78
+ <%= f.submit t(".sign_in"), class: "btn btn-primary btn-lg" %>
79
+ <% end %>
80
+ <% end %>
81
+ <div class="text-center">
82
+ <%= render "devise/shared/links" %>
58
83
  </div>
59
84
  ```
60
85
 
61
- The generator also generates `app/assets/stylesheets/devise_bootstrap_form.scss` that contains the following:
86
+ ## Internationalization
62
87
 
63
- ```
64
- .devise-bootstrap-form {
65
- @extend .container;
66
- }
67
-
68
- .devise-bootstrap-form-col {
69
- @extend .col-12;
70
- @extend .col-sm-8;
71
- @extend .col-lg-6;
72
- }
73
-
74
- .devise-bootstrap-form-row {
75
- @extend .row;
76
- @extend .justify-content-around;
77
- }
78
- ```
88
+ If your `Gemfile` includes `devise-i18n`, `devise-bootstrap-form` will generate views with translations. If you're also using `devise_invitable`, you have to manually copy its translations into your application from the [`devise_invitable` wiki](https://github.com/scambra/devise_invitable/wiki/I18n).
79
89
 
80
- You may want to adjust to your own tastes. For example, if the layout used by your Devise views already wraps the view in a `.container`, you can remove the:
90
+ Also, don't forget to add `gem "rails-i18n"` to your `Gemfile`.
81
91
 
82
- ```
83
- .devise-bootstrap-form {
84
- @extend .container;
85
- }
86
- ```
92
+ ## Differences from the Previous Version
87
93
 
88
- from `app/assets/stylesheets/devise_bootstrap_form.scss` file.
94
+ - The generator no longer provides styles to format the Devise pages.
95
+ - The generator no longer makes assumptions about the asset pipeline you're using, i.e. it doesn't assume you're using SASS, and it doesn't modify `app/assets/stylesheets/application.scss`.
96
+ - The views are no longer wrapped in rows and columns. Out of the box the views are easier to drop into whatever formatting and layout you want.
97
+ - Bootstrap 5 dropped the `btn-block` class, and `devise-bootstrap-form` used it on the default button in each view. See below for the view change.
89
98
 
90
- Of course, you can also modify the views to change the surrounding `div`s to your needs.
99
+ ### Changes in the Generated Views
91
100
 
92
- If you don't want the `devise_bootstrap_form`-generated styles at all, remove the following line from `app/asserts/application.scss`:
101
+ Each view has a submit button, and the Bootstrap 4 mark-up looks like this:
93
102
 
103
+ ```ruby
104
+ <%= f.form_group do %>
105
+ <%= f.submit t('.sign_up'), class: "btn btn-primary btn-block btn-lg" %>
106
+ <% end %>
94
107
  ```
95
- @include "devise_bootstrap_form.scss";
108
+
109
+ With Bootstrap 5, it looks like this:
110
+
111
+ ```ruby
112
+ <%= f.form_group class: "d-grid" do %>
113
+ <%= f.submit t(".sign_up"), class: "btn btn-primary btn-lg" %>
114
+ <% end %>
96
115
  ```
97
116
 
117
+ ## Upgrading an Existing App to Bootstrap 5
118
+
119
+ If you're upgrading an existing app to Bootstrap 5, it's probably easiest to just apply the [changes to the views](changes-in-the-generated-views) manually. The only time it would be worthwhile to regenerate the Bootstrap 5 forms would be if hadn't modified the generated forms.
120
+
98
121
  ## Contributing
99
122
 
100
123
  This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).
data/RELEASING.md CHANGED
@@ -12,7 +12,7 @@ Follow these steps to release a new version of `devise-bootstrap-form` to `rubyg
12
12
  ## How to release
13
13
 
14
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 `rake`.
15
+ 2. **Ensure the tests are passing** by running `rake`.
16
16
  3. Determine which would be the correct next version number according to [semver](http://semver.org/).
17
17
  4. Update the version in `./lib/devise_bootstrap_form/version.rb`.
18
18
  5. Update the `CHANGELOG.md` (for an illustration of these steps, refer to the [bootstrap_form 4.0.0.alpha1 commit](https://github.com/bootstrap-ruby/devise-bootstrap-form/commit/8aac3667931a16537ab68038ec4cebce186bd596#diff-4ac32a78649ca5bdd8e0ba38b7006a1e) as an example):
@@ -25,6 +25,7 @@ Follow these steps to release a new version of `devise-bootstrap-form` to `rubyg
25
25
  [Pending Release]: https://github.com/lcreid/devise-bootstrap-form/compare/.v0.0.1...HEAD
26
26
  [0.0.1]: https://github.com/lcreid/devise-bootstrap-form/compare/...v0.0.1
27
27
  ```
28
+
28
29
  6. Update the installation instructions in `README.md` to use the new version.
29
30
  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.
30
31
  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/lcreid/devise-bootstrap-form/releases).
@@ -1,23 +1,17 @@
1
- <div class="devise-bootstrap-form">
2
- <div class="devise-bootstrap-form-row">
3
- <div class="devise-bootstrap-form-col">
4
- <h2 class="text-center">Resend confirmation instructions</h2>
1
+ <h2 class="text-center">Resend confirmation instructions</h2>
5
2
 
6
- <%= bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
3
+ <%= bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
8
5
 
9
- <%= f.email_field :email,
10
- autofocus: true,
11
- autocomplete: "email",
12
- value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
13
- <%= f.form_group do %>
14
- <%= f.submit "Resend confirmation instructions", class: 'btn btn-primary btn-lg btn-block' %>
15
- <% end %>
16
- <% end %>
6
+ <%= f.email_field :email,
7
+ autofocus: true,
8
+ autocomplete: "email",
9
+ value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
10
+ <%= f.form_group class: "d-grid" do %>
11
+ <%= f.submit "Resend confirmation instructions", class: "btn btn-primary btn-lg btn-block" %>
12
+ <% end %>
13
+ <% end %>
17
14
 
18
- <div class="text-center">
19
- <%= render "devise/shared/links" %>
20
- </div>
21
- </div>
22
- </div>
15
+ <div class="text-center">
16
+ <%= render "devise/shared/links" %>
23
17
  </div>
@@ -1,19 +1,13 @@
1
- <div class="devise-bootstrap-form">
2
- <div class="devise-bootstrap-form-row">
3
- <div class="devise-bootstrap-form-col">
4
- <h2><%= t 'devise.invitations.edit.header' %></h2>
1
+ <h2><%= t "devise.invitations.edit.header" %></h2>
5
2
 
6
- <%= bootstrap_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :put } do |f| %>
7
- <%= devise_error_messages! %>
8
- <%= f.hidden_field :invitation_token, readonly: true %>
3
+ <%= bootstrap_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :put } do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
+ <%= f.hidden_field :invitation_token, readonly: true %>
9
6
 
10
- <% if f.object.class.require_password_on_accepting %>
11
- <%= f.password_field :password %>
12
- <%= f.password_field :password_confirmation, class: "required" %>
13
- <% end %>
7
+ <% if f.object.class.require_password_on_accepting %>
8
+ <%= f.password_field :password %>
9
+ <%= f.password_field :password_confirmation, class: "required" %>
10
+ <% end %>
14
11
 
15
- <%= f.submit t("devise.invitations.edit.submit_button"), class: "btn btn-primary btn-lg btn-block" %>
16
- <% end %>
17
- </div>
18
- </div>
19
- </div>
12
+ <%= f.submit t("devise.invitations.edit.submit_button"), class: "btn btn-primary btn-lg btn-block" %>
13
+ <% end %>
@@ -1,17 +1,11 @@
1
- <div class="devise-bootstrap-form">
2
- <div class="devise-bootstrap-form-row">
3
- <div class="devise-bootstrap-form-col">
4
- <h2 class="text-center"><%= t "devise.invitations.new.header" %></h2>
1
+ <h2 class="text-center"><%= t "devise.invitations.new.header" %></h2>
5
2
 
6
- <%= bootstrap_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post} do |f| %>
7
- <%= devise_error_messages! %>
3
+ <%= bootstrap_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post} do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
8
5
 
9
- <% resource.class.invite_key_fields.each do |field| -%>
10
- <%= f.text_field field %>
11
- <% end -%>
6
+ <% resource.class.invite_key_fields.each do |field| -%>
7
+ <%= f.text_field field %>
8
+ <% end -%>
12
9
 
13
- <%= f.submit t("devise.invitations.new.submit_button"), class: "btn btn-primary btn-lg btn-block" %>
14
- <% end %>
15
- </div>
16
- </div>
17
- </div>
10
+ <%= f.submit t("devise.invitations.new.submit_button"), class: "btn btn-primary btn-lg btn-block" %>
11
+ <% end %>