devise-bootstrap-form 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9f4f512d9aec46299cf96863bbc67fb56c297bb78c02733535d729ed5ad53d7
4
- data.tar.gz: f92f4bd410f63afd7f7b093a7ffe12218245cf63d2b7e5164960230efdee3370
3
+ metadata.gz: 631361b779275161c55e77746b850396713ff05146e504883ea127b15d45fcb7
4
+ data.tar.gz: 324b22c3e9d0467d915b1161484afd48855d8dbf25bd94102e5dfb97ca3aeed6
5
5
  SHA512:
6
- metadata.gz: da59caa8cd1eb13663d70c9d6fb0f9228247778c8e55df40a12f154f23f261a19834bd3eb36a579ee759c875ca7d3fcda1e3d613c5d612a94bce760cf1ad83bb
7
- data.tar.gz: bb08c554aa8bc6e918013782775feb8d2b0633ac91e29e9103d1ad8318b650e71769a988ead4b5f27adb61eca2a4d5522ffb3828f561dbe8f75149756677655c
6
+ metadata.gz: 1b74d4926bad575e5a966515700d3c63326e7c7010087fa4d16df695593464def4b309382fb3529ebb31d16255eeed8f48d89bd764d42dac3bd4384752ad46f4
7
+ data.tar.gz: 8719cf714ef87b452572ef8e33193f0c33e2a62170c98d3ce0c030a4c15e8cbecbf4c9e1bc3f1f01720a88ef0d5d7256ab1d2986425a080831a5b6d334ee47b4
@@ -3,10 +3,12 @@ rvm:
3
3
  - 2.2.9
4
4
  - 2.3.6
5
5
  - 2.4.3
6
- # - 2.5.0 The latest version is in the include clause and runs with danger.
6
+ - 2.5.0
7
7
  before_install:
8
- - gem update --system
9
- - gem install bundler --no-document
8
+ # https://docs.travis-ci.com/user/languages/ruby/#bundler-20
9
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
10
+ - gem i rubygems-update -v '<3' && update_rubygems
11
+ - gem install bundler -v 1.17.3 --no-document
10
12
 
11
13
  matrix:
12
14
  include:
@@ -12,6 +12,12 @@
12
12
 
13
13
  * None.
14
14
 
15
+ ## [0.3.0]
16
+
17
+ ### New features
18
+
19
+ * Remove `devise_error_messages!` and use `_error_messages.html.erb`.
20
+
15
21
  ## [0.2.0][] (2018-09-30)
16
22
 
17
23
  ### Breaking changes
@@ -41,6 +47,8 @@
41
47
  * N/A.
42
48
 
43
49
  ```
50
+ [Pending Release]: https://github.com/lcreid/devise-bootstrap-form/compare/.v0.3.0...HEAD
51
+ [0.3.0]: https://github.com/lcreid/devise-bootstrap-form/compare/v0.2.0..v0.3.0
44
52
  [0.2.0]: https://github.com/lcreid/devise-bootstrap-form/compare/v0.1.0..v0.2.0
45
53
  [0.1.0]: https://github.com/lcreid/devise-bootstrap-form/compare/...v0.2.0
46
54
  ```
data/README.md CHANGED
@@ -21,6 +21,7 @@ gem 'devise-bootstrap-form'
21
21
  ```
22
22
 
23
23
  And then execute:
24
+
24
25
  ```bash
25
26
  bundle install
26
27
  ```
@@ -28,6 +29,12 @@ bundle install
28
29
  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
29
30
  [`devise-i18n`](https://github.com/tigrish/devise-i18n).
30
31
 
32
+ 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`:
33
+
34
+ ```ruby
35
+ gem 'devise-bootstrap-form', '<= 0.2.0'
36
+ ```
37
+
31
38
  ## Usage
32
39
 
33
40
  Once all the gems are installed and configured, and the user model is generated, you can generate the Bootstrap Form views with:
@@ -50,7 +57,7 @@ To switch back to what Devise gives you, remove the `app/views/devise` folder. Y
50
57
 
51
58
  Each of the forms in enclosed in the following:
52
59
 
53
- ```
60
+ ```html
54
61
  <div class="devise-bootstrap-form">
55
62
  <div class="devise-bootstrap-form-row">
56
63
  <div class="devise-bootstrap-form-col">
@@ -62,7 +69,7 @@ Each of the forms in enclosed in the following:
62
69
 
63
70
  The generator also generates `app/assets/stylesheets/devise_bootstrap_form.scss` that contains the following:
64
71
 
65
- ```
72
+ ```css
66
73
  .devise-bootstrap-form {
67
74
  @extend .container;
68
75
  }
@@ -81,7 +88,7 @@ The generator also generates `app/assets/stylesheets/devise_bootstrap_form.scss`
81
88
 
82
89
  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:
83
90
 
84
- ```
91
+ ```css
85
92
  .devise-bootstrap-form {
86
93
  @extend .container;
87
94
  }
@@ -93,7 +100,7 @@ You can also modify the views to change the surrounding `div`s to your needs, or
93
100
 
94
101
  If you don't want the `devise_bootstrap_form`-generated styles at all, remove the following line from `app/asserts/application.scss`:
95
102
 
96
- ```
103
+ ```css
97
104
  @include "devise_bootstrap_form.scss";
98
105
  ```
99
106
 
@@ -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).
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center">Resend confirmation instructions</h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
 
9
9
  <%= f.email_field :email,
10
10
  autofocus: true,
@@ -4,7 +4,7 @@
4
4
  <h2><%= t 'devise.invitations.edit.header' %></h2>
5
5
 
6
6
  <%= bootstrap_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :put } do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
  <%= f.hidden_field :invitation_token, readonly: true %>
9
9
 
10
10
  <% if f.object.class.require_password_on_accepting %>
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center"><%= t "devise.invitations.new.header" %></h2>
5
5
 
6
6
  <%= bootstrap_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post} do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
 
9
9
  <% resource.class.invite_key_fields.each do |field| -%>
10
10
  <%= f.text_field field %>
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center">Change your password</h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
  <%= f.hidden_field :reset_password_token %>
9
9
 
10
10
  <%= f.password_field :password,
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center">Forgot your password?</h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
  <br>
9
9
  <p class="text-left">Please enter your email address and we will send you a link to reset your password.</p>
10
10
  <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
@@ -3,7 +3,7 @@
3
3
  <div class="devise-bootstrap-form-col">
4
4
  <h2 class="text-center">Edit <%= resource_name.to_s.humanize %></h2>
5
5
  <%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
6
- <%= devise_error_messages! %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
7
 
8
8
  <%= f.email_field :email %>
9
9
 
@@ -3,7 +3,7 @@
3
3
  <div class="devise-bootstrap-form-col">
4
4
  <h2 class="text-center">Sign up</h2>
5
5
  <%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
6
- <%= devise_error_messages! %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
7
 
8
8
  <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
9
  <%= f.password_field :password,
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation">
3
+ <h2>
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h2>
9
+ <ul>
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center">Resend unlock instructions</h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
 
9
9
  <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
10
10
  <%= f.form_group do %>
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center"><%= t('.resend_confirmation_instructions') %></h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
 
9
9
  <%= f.email_field :email,
10
10
  autofocus: true,
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center"><%= t('.change_your_password') %></h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
  <%= f.hidden_field :reset_password_token %>
9
9
 
10
10
  <%= f.password_field :password,
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center"><%= t('.forgot_your_password') %></h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
  <br>
9
9
  <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
10
10
  <%= f.form_group do %>
@@ -3,7 +3,7 @@
3
3
  <div class="devise-bootstrap-form-col">
4
4
  <h2 class="text-center">t('.title', resource: resource_name.to_s.humanize)</h2>
5
5
  <%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
6
- <%= devise_error_messages! %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
7
 
8
8
  <%= f.email_field :email %>
9
9
 
@@ -3,7 +3,7 @@
3
3
  <div class="devise-bootstrap-form-col">
4
4
  <h2 class="text-center"><%= t('.sign_up') %></h2>
5
5
  <%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
6
- <%= devise_error_messages! %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
7
 
8
8
  <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
9
  <%= f.password_field :password,
@@ -4,7 +4,7 @@
4
4
  <h2 class="text-center"><%= t('.resend_unlock_instructions') %></h2>
5
5
 
6
6
  <%= bootstrap_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
7
- <%= devise_error_messages! %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
8
 
9
9
  <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
10
10
  <%= f.form_group do %>
@@ -2,14 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "devise/bootstrap-form"
5
+ require "devise_bootstrap_form"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
9
9
 
10
10
  # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
11
+ require "pry"
12
+ Pry.start
13
13
 
14
- require "irb"
15
- IRB.start
14
+ # require "irb"
15
+ # IRB.start
@@ -37,9 +37,12 @@ forms will use translations.
37
37
  spec.require_paths = ["lib"]
38
38
 
39
39
  spec.add_dependency "bootstrap_form", ">= 4.0.0.alpha1"
40
- spec.add_dependency "devise"
40
+ # Devise deprecated devise_error_messages! at 4.6.0, so for later versions
41
+ # we add a new partial.
42
+ spec.add_dependency "devise", ">= 4.6.0"
41
43
  spec.add_dependency "rails", ">= 5.0.0"
42
44
  spec.add_development_dependency "bundler", "~> 1.12"
43
45
  spec.add_development_dependency "chandler"
44
- spec.add_development_dependency "rake", "~> 10.0"
46
+ spec.add_development_dependency "pry"
47
+ spec.add_development_dependency "rake"
45
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeviseBootstrapForm
4
- VERSION = "0.2.0".freeze
4
+ VERSION = "0.3.0".freeze
5
5
  end
@@ -21,24 +21,36 @@ module Devise
21
21
  source_root File.expand_path("../../../../app", __dir__)
22
22
 
23
23
  def copy_views
24
+ copy_base_devise(BootstrapFormGenerator.i18n ? "i18n" : "devise")
25
+ # The shared error message view is already internationalized.
26
+ copy_file "views/devise/shared/_error_messages.html.erb",
27
+ "app/views/devise/shared/_error_messages.html.erb"
28
+ copy_invitable_devise
29
+ end
30
+
31
+ def copy_assets
32
+ directory "assets/stylesheets", "app/assets/stylesheets"
33
+ append_to_file "app/assets/stylesheets/application.scss" do
34
+ '@import "devise_bootstrap_form";'
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ def copy_base_devise(source)
24
41
  %w[confirmations passwords registrations sessions shared unlocks].each do |dir|
25
- directory File.join("views/#{BootstrapFormGenerator.i18n ? 'i18n' : 'devise'}", dir),
42
+ directory File.join("views/#{source}", dir),
26
43
  "app/views/devise/#{dir}"
27
44
  end
45
+ end
28
46
 
47
+ def copy_invitable_devise
29
48
  if BootstrapFormGenerator.invitable # rubocop:disable Style/GuardClause
30
49
  %w[invitations mailer].each do |dir|
31
50
  directory File.join("views/devise", dir), "app/views/devise/#{dir}"
32
51
  end
33
52
  end
34
53
  end
35
-
36
- def copy_assets
37
- directory "assets/stylesheets", "app/assets/stylesheets"
38
- append_to_file "app/assets/stylesheets/application.scss" do
39
- '@import "devise_bootstrap_form";'
40
- end
41
- end
42
54
  end
43
55
  end
44
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-bootstrap-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Reid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap_form
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 4.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 4.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '10.0'
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '10.0'
110
+ version: '0'
97
111
  description: |
98
112
  This gem generates Devise views styled with Bootstrap via the `bootstrap_form`
99
113
  gem. If you plan to use, or are using, `bootstrap_form` in your app, your Devise
@@ -133,6 +147,7 @@ files:
133
147
  - app/views/devise/registrations/edit.html.erb
134
148
  - app/views/devise/registrations/new.html.erb
135
149
  - app/views/devise/sessions/new.html.erb
150
+ - app/views/devise/shared/_error_messages.html.erb
136
151
  - app/views/devise/shared/_links.html.erb
137
152
  - app/views/devise/unlocks/new.html.erb
138
153
  - app/views/i18n/confirmations/new.html.erb