devise-bootstrap-views 0.0.11 → 1.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -21
- data/README.md +6 -22
- data/Rakefile +1 -2
- data/app/assets/stylesheets/devise_bootstrap_views.scss +0 -10
- data/app/assets/stylesheets/devise_bootstrap_views_less.less +0 -10
- data/app/views/devise/confirmations/new.html.erb +16 -0
- data/app/views/{erb → devise}/mailer/confirmation_instructions.html.erb +4 -2
- data/app/views/{erb → devise}/mailer/reset_password_instructions.html.erb +1 -0
- data/app/views/{erb → devise}/mailer/unlock_instructions.html.erb +0 -0
- data/app/views/devise/passwords/edit.html.erb +23 -0
- data/app/views/devise/passwords/new.html.erb +16 -0
- data/app/views/devise/registrations/edit.html.erb +30 -0
- data/app/views/devise/registrations/new.html.erb +24 -0
- data/app/views/devise/sessions/new.html.erb +28 -0
- data/app/views/devise/shared/_links.html.erb +27 -0
- data/app/views/devise/unlocks/new.html.erb +16 -0
- data/devise-bootstrap-views.gemspec +10 -10
- data/lib/devise-bootstrap-views.rb +1 -4
- data/lib/devise_bootstrap_views_helper.rb +11 -9
- data/lib/generators/devise/views/bootstrap_templates/bootstrap_templates_generator.rb +2 -1
- data/lib/generators/devise/views/locale/locale_generator.rb +3 -4
- data/lib/version.rb +1 -1
- data/locales/pt.yml +1 -1
- data/locales/sl.yml +49 -55
- metadata +23 -47
- data/app/views/erb/confirmations/new.html.erb +0 -18
- data/app/views/erb/passwords/edit.html.erb +0 -24
- data/app/views/erb/passwords/new.html.erb +0 -17
- data/app/views/erb/registrations/edit.html.erb +0 -31
- data/app/views/erb/registrations/new.html.erb +0 -24
- data/app/views/erb/sessions/new.html.erb +0 -26
- data/app/views/erb/shared/_links.html.erb +0 -25
- data/app/views/erb/unlocks/new.html.erb +0 -16
- data/app/views/haml/confirmations/new.html.haml +0 -11
- data/app/views/haml/mailer/confirmation_instructions.html.haml +0 -4
- data/app/views/haml/mailer/reset_password_instructions.html.haml +0 -5
- data/app/views/haml/mailer/unlock_instructions.html.haml +0 -4
- data/app/views/haml/passwords/edit.html.haml +0 -15
- data/app/views/haml/passwords/new.html.haml +0 -11
- data/app/views/haml/registrations/edit.html.haml +0 -27
- data/app/views/haml/registrations/new.html.haml +0 -17
- data/app/views/haml/sessions/new.html.haml +0 -18
- data/app/views/haml/shared/_links.html.haml +0 -19
- data/app/views/haml/unlocks/new.html.haml +0 -11
- data/app/views/slim/confirmations/new.html.slim +0 -12
- data/app/views/slim/mailer/confirmation_instructions.html.slim +0 -7
- data/app/views/slim/mailer/reset_password_instructions.html.slim +0 -10
- data/app/views/slim/mailer/unlock_instructions.html.slim +0 -8
- data/app/views/slim/passwords/edit.html.slim +0 -16
- data/app/views/slim/passwords/new.html.slim +0 -12
- data/app/views/slim/registrations/edit.html.slim +0 -34
- data/app/views/slim/registrations/new.html.slim +0 -18
- data/app/views/slim/sessions/new.html.slim +0 -19
- data/app/views/slim/shared/_links.html.slim +0 -19
- data/app/views/slim/unlocks/new.html.slim +0 -12
- data/lib/generators/devise/views/bootstrap_haml_templates/bootstrap_haml_templates_generator.rb +0 -10
- data/lib/generators/devise/views/bootstrap_slim_templates/bootstrap_slim_templates_generator.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b577437581b06dffb063c28424e4bcff8683e947
|
4
|
+
data.tar.gz: f7037c4921d87f2502bea9ad8e54380d89091441
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c4d649dabff58148a6002b4945308b7f55b8f7c07c36d24788c21699c05c29e6078613d9b3767a67f7eded549159237439c672e88af4a754936ed013a433783
|
7
|
+
data.tar.gz: d98418a9f010ff1058afb6ae655bbefed520b7273e8e8e4720d83495ee2ec0dc9da40e3e79eafc759107c0b6ec24f6cd0618ffd67f80263f6f2114f7ac00390f
|
data/.gitignore
CHANGED
@@ -1,22 +1,11 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
|
1
11
|
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Here are some of the highlights:
|
4
4
|
|
5
|
-
* Devise views with Bootstrap
|
6
|
-
* Used Bootstrap responsive columns
|
7
|
-
* I18n Support
|
5
|
+
* Devise views with Bootstrap 4
|
6
|
+
* Used Bootstrap responsive columns
|
7
|
+
* I18n Support
|
8
8
|
|
9
9
|
WARNING:
|
10
10
|
This gem copies lots of its code from [devise-i18n-views](https://github.com/mcasimir/devise-i18n-views) gem.
|
@@ -22,18 +22,10 @@ And then execute:
|
|
22
22
|
|
23
23
|
$ bundle
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
# SASS
|
28
|
-
*= require devise_bootstrap_views
|
29
|
-
|
30
|
-
# LESS
|
31
|
-
*= require devise_bootstrap_views_less
|
32
|
-
|
33
|
-
Then you need to install the required translations in your `config/locales`. The [devise-i18n-views](https://github.com/mcasimir/devise-i18n-views) project is no longer maintained after being merged into [devise-i18n](https://github.com/tigrish/devise-i18n), which is currently the best source for updated Devise translations. You can manually download locale dictionaries from [devise-i18n/rails/locales](https://github.com/tigrish/devise-i18n/tree/master/rails/locales) or generate them by running `devise:views:locale <chosen_locale>`:
|
25
|
+
Then you can install the required translations in your `config/locales`. Use [devise-i18n](https://github.com/tigrish/devise-i18n) — the best source for updated Devise translations. You can manually generate locale files by executing `rails generate devise:views:locale <chosen_locale>`:
|
34
26
|
|
35
27
|
``` sh
|
36
|
-
rails
|
28
|
+
rails generate devise:views:locale it
|
37
29
|
```
|
38
30
|
|
39
31
|
will generate `config/locales/devise.views.it.yml`.
|
@@ -43,17 +35,9 @@ will generate `config/locales/devise.views.it.yml`.
|
|
43
35
|
The `devise:views:bootstrap_templates` generator will copy all views to your application, so you can modify the files as you wish:
|
44
36
|
|
45
37
|
``` sh
|
46
|
-
rails
|
47
|
-
```
|
48
|
-
Alternatively, you can also generate Haml or Slim templates instead of traditional ERB. Both can be generated with their respective commands below.
|
49
|
-
|
50
|
-
``` sh
|
51
|
-
rails g devise:views:bootstrap_haml_templates
|
38
|
+
rails generate devise:views:bootstrap_templates
|
52
39
|
```
|
53
40
|
|
54
|
-
``` sh
|
55
|
-
rails g devise:views:bootstrap_slim_templates
|
56
|
-
```
|
57
41
|
## Example
|
58
42
|
|
59
43
|
Sample Application can be found at this link - [Devise Boostrap Views Application](https://github.com/ethiraj-srinivasan/devise-boostrap-views)
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= bootstrap_devise_error_messages! %>
|
2
|
+
|
3
|
+
<h1><%= t('.resend_confirmation_instructions', default: 'Resend confirmation instructions') %></h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, role: 'form' }) do |f| %>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, autofocus: true, class: "form-control" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="form-group">
|
12
|
+
<%= f.submit t('.resend_confirmation_instructions', default: 'Resend confirmation instructions'), class: 'btn btn-primary' %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render 'devise/shared/links' %>
|
@@ -2,5 +2,7 @@
|
|
2
2
|
|
3
3
|
<p><%= t('.instruction', default: 'You can confirm your account email through the link below:') %></p>
|
4
4
|
|
5
|
-
<p
|
6
|
-
|
5
|
+
<p>
|
6
|
+
<%= link_to t('.action', default: 'Confirm my account'),
|
7
|
+
confirmation_url(@resource, confirmation_token: @token, locale: I18n.locale) %>
|
8
|
+
</p>
|
@@ -5,4 +5,5 @@
|
|
5
5
|
<p><%= link_to t('.action', default: 'Change my password'), edit_password_url(@resource, reset_password_token: @token, locale: I18n.locale) %></p>
|
6
6
|
|
7
7
|
<p><%= t('.instruction_2', default: "If you didn't request this, please ignore this email.") %></p>
|
8
|
+
|
8
9
|
<p><%= t('.instruction_3', default: "Your password won't change until you access the link above and create a new one.") %></p>
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= bootstrap_devise_error_messages! %>
|
2
|
+
|
3
|
+
<h1><%= t('.change_your_password', default: 'Change your password') %></h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, role: 'form' }) do |f| %>
|
6
|
+
<%= f.hidden_field :reset_password_token %>
|
7
|
+
|
8
|
+
<div class="form-group">
|
9
|
+
<%= f.label :password, t('.new_password', default: 'New password') %>
|
10
|
+
<%= f.password_field :password, autofocus: true, class: 'form-control' %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="form-group">
|
14
|
+
<%= f.label :password_confirmation, t('.confirm_new_password', default: 'Confirm new password') %>
|
15
|
+
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="form-group">
|
19
|
+
<%= f.submit t('.change_my_password', default: 'Change my password'), class: 'btn btn-primary' %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= render 'devise/shared/links' %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= bootstrap_devise_error_messages! %>
|
2
|
+
|
3
|
+
<h1><%= t('.forgot_your_password', default: 'Forgot your password?') %></h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, role: 'form' }) do |f| %>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="form-group">
|
12
|
+
<%= f.submit t('.send_me_reset_password_instructions', default: 'Send me reset password instructions'), class: 'btn btn-primary' %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render 'devise/shared/links' %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= bootstrap_devise_error_messages! %>
|
2
|
+
|
3
|
+
<h1><%= t('.title', resource: resource_class.model_name.human , default: "Edit #{resource_name.to_s.humanize}") %></h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
<div class="form-group">
|
11
|
+
<%= f.label :password %> <i>(<%= t('.leave_blank_if_you_don_t_want_to_change_it', default: "leave blank if you don't want to change it") %>)</i>
|
12
|
+
<%= f.password_field :password, autocomplete: "off", class: 'form-control' %>
|
13
|
+
</div>
|
14
|
+
<div class="form-group">
|
15
|
+
<%= f.label :password_confirmation %>
|
16
|
+
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
17
|
+
</div>
|
18
|
+
<div class="form-group">
|
19
|
+
<%= f.label :current_password %> <i>(<%= t('.we_need_your_current_password_to_confirm_your_changes', default: 'we need your current password to confirm your changes') %>)</i>
|
20
|
+
<%= f.password_field :current_password, class: 'form-control' %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="form-group">
|
24
|
+
<%= f.submit t('.update', default: 'Update'), class: 'btn btn-primary' %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<p><%= t('.unhappy', default: 'Unhappy') %>? <%= link_to t('.cancel_my_account', default: 'Cancel my account'), registration_path(resource_name), data: { confirm: t('.are_you_sure', default: "Are you sure?") }, method: :delete %>.</p>
|
29
|
+
|
30
|
+
<%= link_to t('.back', default: 'Back'), :back %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= bootstrap_devise_error_messages! %>
|
2
|
+
|
3
|
+
<h1><%= t('.sign_up', default: 'Sign up') %></h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { role: 'form' }) do |f| %>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
<div class="form-group">
|
11
|
+
<%= f.label :password %>
|
12
|
+
<%= f.password_field :password, class: 'form-control' %>
|
13
|
+
</div>
|
14
|
+
<div class="form-group">
|
15
|
+
<%= f.label :password_confirmation %>
|
16
|
+
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="form-group">
|
20
|
+
<%= f.submit t('.sign_up', default: 'Sign up'), class: 'btn btn-primary' %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= render 'devise/shared/links' %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<h1><%= t('.sign_in', default: 'Sign in') %></h1>
|
2
|
+
|
3
|
+
|
4
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { role: 'form' }) do |f| %>
|
5
|
+
<div class="form-group">
|
6
|
+
<%= f.label :email %>
|
7
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
10
|
+
<%= f.label :password %>
|
11
|
+
<%= f.password_field :password, autocomplete: 'off', class: 'form-control' %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<% if devise_mapping.rememberable? %>
|
15
|
+
<div class="form-check">
|
16
|
+
<%= f.label :remember_me, class: 'form-check-label' do %>
|
17
|
+
<%= f.check_box :remember_me, class: 'form-check-input' %>
|
18
|
+
<%= t('.remember_me', default: 'Remember me') %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<div class="form-group">
|
24
|
+
<%= f.submit t('.sign_in', default: 'Sign in'), class: 'btn btn-primary' %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<%= render 'devise/shared/links' %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div class="form-group">
|
2
|
+
<% if controller_name != 'sessions' %>
|
3
|
+
<%= link_to t('.sign_in', default: 'Sign in'), new_session_path(resource_name) %><br />
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% if devise_mapping.registerable? && controller_name != 'registrations' %>
|
7
|
+
<%= link_to t('.sign_up', default: 'Sign up'), new_registration_path(resource_name) %><br />
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
11
|
+
<%= link_to t('.forgot_your_password', default: 'Forgot your password?'), new_password_path(resource_name) %><br />
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
15
|
+
<%= link_to t('.didn_t_receive_confirmation_instructions', default: "Didn't receive confirmation instructions?"), new_confirmation_path(resource_name) %><br />
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
19
|
+
<%= link_to t('.didn_t_receive_unlock_instructions', default: "Didn't receive unlock instructions?"), new_unlock_path(resource_name) %><br />
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<% if devise_mapping.omniauthable? %>
|
23
|
+
<% resource_class.omniauth_providers.each do |provider| %>
|
24
|
+
<%= link_to t('.sign_in_with_provider', provider: provider.to_s.titleize, default: "Sign in with #{provider.to_s.titleize}"), omniauth_authorize_path(resource_name, provider) %><br />
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= bootstrap_devise_error_messages! %>
|
2
|
+
|
3
|
+
<h1><%= t('.resend_unlock_instructions', default: 'Resend unlock instructions') %></h1>
|
4
|
+
|
5
|
+
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, html: { role: 'form' } }) do |f| %>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="form-group">
|
12
|
+
<%= f.submit t('.resend_unlock_instructions', default: 'Resend unlock instructions'), class: 'btn btn-primary'%>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render 'devise/shared/links' %>
|
@@ -4,20 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'devise-bootstrap-views'
|
8
8
|
spec.version = DeviseBootstrapViews::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['Yinghai Zhao']
|
10
|
+
spec.email = ['zyinghai@gmail.com']
|
11
|
+
spec.summary = 'Bootstrap views for Devise.'
|
12
|
+
spec.description = 'Bootstrap views for Devise with I18n support.'
|
13
|
+
spec.homepage = 'https://github.com/hisea/devise-bootstrap-views'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_development_dependency 'rake', '~> 11.0'
|
23
23
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require 'devise_bootstrap_views_helper'
|
3
|
+
|
3
4
|
module DeviseBootstrapViews
|
4
5
|
class Engine < ::Rails::Engine
|
5
6
|
end
|
@@ -16,13 +17,9 @@ module DeviseBootstrapViews
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
protected
|
20
|
-
|
21
20
|
def self.pattern_from(args)
|
22
21
|
array = Array(args || [])
|
23
22
|
array.blank? ? '*' : "{#{array.join ','}}"
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
27
|
-
|
28
|
-
|
@@ -1,19 +1,21 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
|
3
1
|
module DeviseBootstrapViewsHelper
|
4
2
|
def bootstrap_devise_error_messages!
|
5
3
|
return '' if resource.errors.empty?
|
6
4
|
|
7
|
-
messages = resource.errors.full_messages.map { |
|
8
|
-
sentence = I18n.t(
|
5
|
+
messages = resource.errors.full_messages.map { |message| content_tag(:li, message) }.join
|
6
|
+
sentence = I18n.t(
|
7
|
+
'errors.messages.not_saved',
|
9
8
|
count: resource.errors.count,
|
10
|
-
resource: resource.class.model_name.human.downcase
|
9
|
+
resource: resource.class.model_name.human.downcase
|
10
|
+
)
|
11
11
|
|
12
12
|
html = <<-HTML
|
13
|
-
<div class="alert alert-danger
|
14
|
-
<button type="button" class="close" data-dismiss="alert"
|
15
|
-
|
16
|
-
|
13
|
+
<div class="alert alert-danger">
|
14
|
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
15
|
+
<span aria-hidden="true">×</span>
|
16
|
+
</button>
|
17
|
+
<h4 class="alert-heading">#{sentence}</h4>
|
18
|
+
<ul class="mb-0">#{messages}</ul>
|
17
19
|
</div>
|
18
20
|
HTML
|
19
21
|
|
@@ -2,8 +2,9 @@ module Devise
|
|
2
2
|
module Views
|
3
3
|
class BootstrapTemplatesGenerator < Rails::Generators::Base
|
4
4
|
source_root File.expand_path('../../../../../../app/views', __FILE__)
|
5
|
+
|
5
6
|
def copy_views
|
6
|
-
|
7
|
+
directory('devise', Rails.root.join('app', 'views', 'devise'))
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
|
3
1
|
module Devise
|
4
2
|
module Views
|
5
3
|
class LocaleGenerator < Rails::Generators::NamedBase
|
@@ -7,8 +5,9 @@ module Devise
|
|
7
5
|
repo_url = 'https://raw.githubusercontent.com/tigrish/devise-i18n/master/rails/locales/'
|
8
6
|
download_url = URI.parse("#{repo_url}#{name}.yml")
|
9
7
|
downloaded_file = Net::HTTP.get(download_url).force_encoding('UTF-8')
|
10
|
-
File.write(
|
11
|
-
|
8
|
+
File.write(
|
9
|
+
Rails.root.join('config', 'locales', "devise.views.#{name}.yml"), downloaded_file
|
10
|
+
)
|
12
11
|
end
|
13
12
|
end
|
14
13
|
end
|