devise-i18n 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/VERSION +1 -1
- data/app/views/devise/confirmations/new.html.erb +9 -5
- data/app/views/devise/mailer/confirmation_instructions.html.erb +3 -4
- data/app/views/devise/mailer/password_change.html.erb +2 -2
- data/app/views/devise/mailer/reset_password_instructions.html.erb +5 -5
- data/app/views/devise/mailer/unlock_instructions.html.erb +4 -4
- data/app/views/devise/passwords/edit.html.erb +13 -7
- data/app/views/devise/passwords/new.html.erb +9 -5
- data/app/views/devise/registrations/edit.html.erb +25 -17
- data/app/views/devise/registrations/new.html.erb +17 -9
- data/app/views/devise/sessions/new.html.erb +19 -10
- data/app/views/devise/shared/_links.html.erb +6 -6
- data/app/views/devise/unlocks/new.html.erb +9 -5
- data/lib/generators/devise/{views/locale → i18n}/locale_generator.rb +2 -2
- data/lib/generators/devise/i18n/views_generator.rb +105 -0
- data/rails/locales/ar.yml +2 -0
- data/rails/locales/az.yml +2 -0
- data/rails/locales/bg.yml +2 -0
- data/rails/locales/bn.yml +2 -0
- data/rails/locales/bs.yml +2 -0
- data/rails/locales/ca.yml +2 -0
- data/rails/locales/cs.yml +5 -3
- data/rails/locales/da.yml +2 -0
- data/rails/locales/de-CH.yml +5 -3
- data/rails/locales/de.yml +4 -2
- data/rails/locales/el.yml +2 -0
- data/rails/locales/en-GB.yml +2 -0
- data/rails/locales/en.yml +2 -0
- data/rails/locales/es-MX.yml +5 -3
- data/rails/locales/es.yml +3 -1
- data/rails/locales/et.yml +2 -0
- data/rails/locales/fa.yml +2 -0
- data/rails/locales/fi.yml +21 -19
- data/rails/locales/fr-CA.yml +7 -5
- data/rails/locales/fr.yml +2 -0
- data/rails/locales/he.yml +2 -0
- data/rails/locales/hr.yml +2 -0
- data/rails/locales/hu.yml +2 -0
- data/rails/locales/id.yml +48 -46
- data/rails/locales/is.yml +2 -0
- data/rails/locales/it.yml +2 -0
- data/rails/locales/ja.yml +2 -0
- data/rails/locales/ko.yml +2 -0
- data/rails/locales/lt.yml +2 -0
- data/rails/locales/lv.yml +2 -0
- data/rails/locales/my.yml +2 -0
- data/rails/locales/nb.yml +2 -0
- data/rails/locales/nl.yml +2 -0
- data/rails/locales/nn-NO.yml +120 -0
- data/rails/locales/no.yml +2 -0
- data/rails/locales/pl.yml +3 -1
- data/rails/locales/pt-BR.yml +2 -0
- data/rails/locales/pt.yml +2 -0
- data/rails/locales/ro.yml +50 -48
- data/rails/locales/ru.yml +5 -3
- data/rails/locales/sk.yml +2 -0
- data/rails/locales/sl.yml +2 -0
- data/rails/locales/sr-RS.yml +2 -0
- data/rails/locales/sr.yml +2 -0
- data/rails/locales/sv.yml +2 -0
- data/rails/locales/th.yml +2 -0
- data/rails/locales/tr.yml +5 -3
- data/rails/locales/uk.yml +2 -0
- data/rails/locales/vi.yml +2 -0
- data/rails/locales/zh-CN.yml +2 -0
- data/rails/locales/zh-HK.yml +2 -0
- data/rails/locales/zh-TW.yml +2 -0
- metadata +5 -4
- data/lib/generators/devise/views/i18n_templates/i18n_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: a89a0c24c1f3bf8a59e845f155b51283d809453e
|
4
|
+
data.tar.gz: d408786d64fe433285e540d5662f265e6f1f272c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8fa3d1ef3b0115ad4fd5a1926f481325efd3582826027f239eada99018e38831c41b830798b7903f5dfd0ee87303230c13420c70b3f79bfbed3a2199dc50113
|
7
|
+
data.tar.gz: af1b9e8d1d0bb2a42fcce5ec6ecfc31cadf5115e4987e41fda66db478ae14ce85fb4ad191154fbdddc5153fb432bbfa1cec8b23aa051184dc37b98cc6139983a
|
data/README.md
CHANGED
@@ -18,13 +18,14 @@ gem 'devise-i18n'
|
|
18
18
|
|
19
19
|
Assuming you have _not_ previously generated Devise's views into your project, that's all you need to do. If you _have_ previously done this, you will need to regenerate your views (see the next section) and then reapply whatever customizations that made you do this in the first place.
|
20
20
|
|
21
|
+
NOTE: If you have the ```simple_form``` gem in your Gemfile, this command will generate the corresponding views using the simple_form form builder.
|
21
22
|
|
22
23
|
## Customizing views
|
23
24
|
|
24
|
-
The `devise:views
|
25
|
+
The `devise:i18n:views` generator will copy all devise-i18n's views to your application so that you can modify the files as you wish.
|
25
26
|
|
26
27
|
``` sh
|
27
|
-
rails g devise:views
|
28
|
+
rails g devise:i18n:views
|
28
29
|
```
|
29
30
|
You should only do this if you really need to, though, because doing this will make it so that you won't get the updated views should they change in a future version of devise-i18n. To "uncustomize" the views, just delete them, and your app will go back to grabbing devise-i18n's default views.
|
30
31
|
|
@@ -33,10 +34,10 @@ You should only do this if you really need to, though, because doing this will m
|
|
33
34
|
|
34
35
|
If, for whatever reason, you want to change devise-i18n's translations, you can generate the locale file into your project with
|
35
36
|
``` sh
|
36
|
-
rails g devise:
|
37
|
+
rails g devise:i18n:locale it
|
37
38
|
```
|
38
39
|
|
39
|
-
which will generate `config/locales/devise.it.yml`. If you're doing this to add a missing translation or to improve an existing one, it'd be nice if you could share your suggestions with us!
|
40
|
+
which will generate `config/locales/devise.views.it.yml`. If you're doing this to add a missing translation or to improve an existing one, it'd be nice if you could share your suggestions with us!
|
40
41
|
|
41
42
|
|
42
43
|
## Contributing translations to devise-i18n
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
@@ -1,12 +1,16 @@
|
|
1
|
-
<h2><%= t('.resend_confirmation_instructions'
|
1
|
+
<h2><%= t('.resend_confirmation_instructions') %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
3
|
+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
|
6
|
-
<div
|
7
|
-
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
9
|
+
</div>
|
8
10
|
|
9
|
-
<div
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit t('.resend_confirmation_instructions') %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render "devise/shared/links" %>
|
@@ -1,6 +1,5 @@
|
|
1
1
|
<% require 'devise/version' %>
|
2
|
-
<p><%= t('.greeting',
|
2
|
+
<p><%= t('.greeting', recipient: @resource.email) %></p>
|
3
3
|
|
4
|
-
<p><%= t('.instruction'
|
5
|
-
<p><%= link_to t('.action', :
|
6
|
-
confirmation_url(@resource, :confirmation_token => (Devise::VERSION.start_with?('3.') ? @token : @resource.confirmation_token)) %></p>
|
4
|
+
<p><%= t('.instruction') %></p>
|
5
|
+
<p><%= link_to t('.action'), confirmation_url(@resource, confirmation_token: (Devise::VERSION.start_with?('3.') ? @token : @resource.confirmation_token)) %></p>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<% require 'devise/version' %>
|
2
|
-
<p><%= t('.greeting',
|
2
|
+
<p><%= t('.greeting', recipient: @resource.email) %></p>
|
3
3
|
|
4
|
-
<p><%= t('.message'
|
4
|
+
<p><%= t('.message') %></p>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<% require 'devise/version' %>
|
2
|
-
<p><%= t('.greeting',
|
2
|
+
<p><%= t('.greeting', recipient: @resource.email) %></p>
|
3
3
|
|
4
|
-
<p><%= t('.instruction'
|
4
|
+
<p><%= t('.instruction') %></p>
|
5
5
|
|
6
|
-
<p><%= link_to t('.action'
|
6
|
+
<p><%= link_to t('.action'), edit_password_url(@resource, reset_password_token: (Devise::VERSION.start_with?('3.', '4.') ? @token : @resource.reset_password_token)) %></p>
|
7
7
|
|
8
|
-
<p><%= t('.instruction_2'
|
9
|
-
<p><%= t('.instruction_3'
|
8
|
+
<p><%= t('.instruction_2') %></p>
|
9
|
+
<p><%= t('.instruction_3') %></p>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% require 'devise/version' %>
|
2
|
-
<p><%= t('.greeting',
|
2
|
+
<p><%= t('.greeting', recipient: @resource.email) %></p>
|
3
3
|
|
4
|
-
<p><%= t('.message'
|
4
|
+
<p><%= t('.message') %></p>
|
5
5
|
|
6
|
-
<p><%= t('.instruction'
|
6
|
+
<p><%= t('.instruction') %></p>
|
7
7
|
|
8
|
-
<p><%= link_to t('.action'
|
8
|
+
<p><%= link_to t('.action'), unlock_url(@resource, unlock_token: (Devise::VERSION.start_with?('3.') ? @token :@resource.unlock_token)) %></p>
|
@@ -1,16 +1,22 @@
|
|
1
|
-
<h2><%= t('.change_your_password'
|
1
|
+
<h2><%= t('.change_your_password') %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
3
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
<%= f.hidden_field :reset_password_token %>
|
6
6
|
|
7
|
-
<div
|
8
|
-
|
7
|
+
<div class="field">
|
8
|
+
<%= f.label :password, t('.new_password') %><br />
|
9
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
10
|
+
</div>
|
9
11
|
|
10
|
-
<div
|
11
|
-
|
12
|
+
<div class="field">
|
13
|
+
<%= f.label :password_confirmation, t('.confirm_new_password') %><br />
|
14
|
+
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
15
|
+
</div>
|
12
16
|
|
13
|
-
<div
|
17
|
+
<div class="actions">
|
18
|
+
<%= f.submit t('.change_my_password') %>
|
19
|
+
</div>
|
14
20
|
<% end %>
|
15
21
|
|
16
22
|
<%= render "devise/shared/links" %>
|
@@ -1,12 +1,16 @@
|
|
1
|
-
<h2><%= t('.forgot_your_password'
|
1
|
+
<h2><%= t('.forgot_your_password') %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
3
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
|
6
|
-
<div
|
7
|
-
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true %>
|
9
|
+
</div>
|
8
10
|
|
9
|
-
<div
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit t('.send_me_reset_password_instructions') %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render "devise/shared/links" %>
|
@@ -1,31 +1,39 @@
|
|
1
|
-
<h2><%= t('.title', :
|
1
|
+
<h2><%= t('.title', resource: resource_class.model_name.human) %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
3
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
|
6
|
-
<div
|
7
|
-
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email %>
|
9
|
+
</div>
|
8
10
|
|
9
|
-
|
11
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
10
12
|
<p>
|
11
|
-
<%= t('.currently_waiting_confirmation_for_email', :
|
13
|
+
<%= t('.currently_waiting_confirmation_for_email', email: resource.unconfirmed_email) %>
|
12
14
|
</p>
|
13
|
-
|
15
|
+
<% end %>
|
14
16
|
|
15
|
-
<div
|
16
|
-
|
17
|
+
<div class="field">
|
18
|
+
<%= f.label :password %> <i>(<%= t('.leave_blank_if_you_don_t_want_to_change_it') %>)</i><br />
|
19
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
20
|
+
</div>
|
17
21
|
|
18
|
-
<div
|
19
|
-
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :password_confirmation %><br />
|
24
|
+
<%= f.password_field :password_confirmation %>
|
25
|
+
</div>
|
20
26
|
|
21
|
-
<div
|
22
|
-
|
27
|
+
<div class="field">
|
28
|
+
<%= f.label :current_password %> <i>(<%= t('.we_need_your_current_password_to_confirm_your_changes') %>)</i><br />
|
29
|
+
<%= f.password_field :current_password %>
|
30
|
+
</div>
|
23
31
|
|
24
|
-
<div><%= f.submit t('.update'
|
32
|
+
<div><%= f.submit t('.update') %></div>
|
25
33
|
<% end %>
|
26
34
|
|
27
|
-
<h3><%= t('.cancel_my_account'
|
35
|
+
<h3><%= t('.cancel_my_account') %></h3>
|
28
36
|
|
29
|
-
<p><%= t('.unhappy'
|
37
|
+
<p><%= t('.unhappy') %>? <%= link_to t('.cancel_my_account'), registration_path(resource_name), data: { confirm: t('.are_you_sure') }, method: :delete %>.</p>
|
30
38
|
|
31
|
-
<%= link_to t('devise.shared.links.back'
|
39
|
+
<%= link_to t('devise.shared.links.back'), :back %>
|
@@ -1,18 +1,26 @@
|
|
1
|
-
<h2><%= t('.sign_up'
|
1
|
+
<h2><%= t('.sign_up') %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
3
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
|
6
|
-
<div
|
7
|
-
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true %>
|
9
|
+
</div>
|
8
10
|
|
9
|
-
<div
|
10
|
-
|
11
|
+
<div class="field">
|
12
|
+
<%= f.label :password %><br />
|
13
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
14
|
+
</div>
|
11
15
|
|
12
|
-
<div
|
13
|
-
|
16
|
+
<div class="field">
|
17
|
+
<%= f.label :password_confirmation %><br />
|
18
|
+
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
19
|
+
</div>
|
14
20
|
|
15
|
-
<div
|
21
|
+
<div class="actions">
|
22
|
+
<%= f.submit t('.sign_up') %>
|
23
|
+
</div>
|
16
24
|
<% end %>
|
17
25
|
|
18
26
|
<%= render "devise/shared/links" %>
|
@@ -1,17 +1,26 @@
|
|
1
|
-
<h2><%= t('.sign_in'
|
1
|
+
<h2><%= t('.sign_in') %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
4
|
-
<div
|
5
|
-
|
3
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
4
|
+
<div class="field">
|
5
|
+
<%= f.label :email %><br />
|
6
|
+
<%= f.email_field :email, autofocus: true %>
|
7
|
+
</div>
|
6
8
|
|
7
|
-
<div
|
8
|
-
|
9
|
+
<div class="field">
|
10
|
+
<%= f.label :password %><br />
|
11
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
12
|
+
</div>
|
9
13
|
|
10
|
-
<% if devise_mapping.rememberable?
|
11
|
-
<div
|
12
|
-
|
14
|
+
<% if devise_mapping.rememberable? %>
|
15
|
+
<div class="field">
|
16
|
+
<%= f.check_box :remember_me %>
|
17
|
+
<%= f.label :remember_me %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
13
20
|
|
14
|
-
<div
|
21
|
+
<div class="actions">
|
22
|
+
<%= f.submit t('.sign_in') %>
|
23
|
+
</div>
|
15
24
|
<% end %>
|
16
25
|
|
17
26
|
<%= render "devise/shared/links" %>
|
@@ -1,25 +1,25 @@
|
|
1
1
|
<%- if controller_name != 'sessions' %>
|
2
|
-
<%= link_to t(".sign_in"
|
2
|
+
<%= link_to t(".sign_in"), new_session_path(resource_name) %><br />
|
3
3
|
<% end -%>
|
4
4
|
|
5
5
|
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
-
<%= link_to t(".sign_up"
|
6
|
+
<%= link_to t(".sign_up"), new_registration_path(resource_name) %><br />
|
7
7
|
<% end -%>
|
8
8
|
|
9
9
|
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
10
|
-
<%= link_to t(".forgot_your_password"
|
10
|
+
<%= link_to t(".forgot_your_password"), new_password_path(resource_name) %><br />
|
11
11
|
<% end -%>
|
12
12
|
|
13
13
|
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
-
<%= link_to t('.didn_t_receive_confirmation_instructions'
|
14
|
+
<%= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
|
15
15
|
<% end -%>
|
16
16
|
|
17
17
|
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
-
<%= link_to t('.didn_t_receive_unlock_instructions'
|
18
|
+
<%= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name) %><br />
|
19
19
|
<% end -%>
|
20
20
|
|
21
21
|
<%- if devise_mapping.omniauthable? %>
|
22
22
|
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
-
|
23
|
+
<%= link_to t('.sign_in_with_provider', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) %><br />
|
24
24
|
<% end -%>
|
25
25
|
<% end -%>
|
@@ -1,12 +1,16 @@
|
|
1
|
-
<h2><%= t('.resend_unlock_instructions'
|
1
|
+
<h2><%= t('.resend_unlock_instructions') %></h2>
|
2
2
|
|
3
|
-
<%= form_for(resource, :
|
3
|
+
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
4
4
|
<%= devise_error_messages! %>
|
5
5
|
|
6
|
-
<div
|
7
|
-
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true %>
|
9
|
+
</div>
|
8
10
|
|
9
|
-
<div
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit t('.resend_unlock_instructions') %>
|
13
|
+
</div>
|
10
14
|
<% end %>
|
11
15
|
|
12
16
|
<%= render "devise/shared/links" %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Devise
|
2
|
-
module
|
2
|
+
module I18n
|
3
3
|
class LocaleGenerator < Rails::Generators::NamedBase
|
4
|
-
source_root File.expand_path(
|
4
|
+
source_root File.expand_path("../../../../../rails/locales", __FILE__)
|
5
5
|
def copy_locale
|
6
6
|
copy_file("#{name}.yml", Rails.root.join("config", "locales", "devise.views.#{name}.yml"))
|
7
7
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Devise
|
2
|
+
module I18n
|
3
|
+
module ViewPathTemplates #:nodoc:
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
argument :scope, required: false, default: nil, desc: "The scope to copy views to"
|
8
|
+
|
9
|
+
class_option :form_builder, aliases: "-b"
|
10
|
+
class_option :views, aliases: "-v", type: :array, desc: "Select specific view directories to generate (confirmations, passwords, registrations, sessions, unlocks, mailer)"
|
11
|
+
|
12
|
+
public_task :copy_views
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_views
|
16
|
+
if options[:views]
|
17
|
+
options[:views].each { |directory| view_directory(directory.to_sym) }
|
18
|
+
else
|
19
|
+
view_directory :confirmations
|
20
|
+
view_directory :passwords
|
21
|
+
view_directory :registrations
|
22
|
+
view_directory :sessions
|
23
|
+
view_directory :unlocks
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def view_directory(name, target_path = nil)
|
30
|
+
directory name.to_s, target_path || "#{default_target_path}/#{name}" do |content|
|
31
|
+
if scope
|
32
|
+
content.gsub "devise/shared/links", "#{plural_scope}/shared/links"
|
33
|
+
else
|
34
|
+
content
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def default_target_path
|
40
|
+
@default_target_path ||= "app/views/#{plural_scope || :devise}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def plural_scope
|
44
|
+
@plural_scope ||= scope.presence && scope.underscore.pluralize
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class SharedViewsGenerator < Rails::Generators::Base #:nodoc:
|
49
|
+
include ViewPathTemplates
|
50
|
+
source_root File.expand_path("../../../../../app/views/devise", __FILE__)
|
51
|
+
desc "Copies shared Devise views to your application."
|
52
|
+
hide!
|
53
|
+
|
54
|
+
# Override copy_views to just copy mailer and shared.
|
55
|
+
def copy_views
|
56
|
+
view_directory :shared
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class FormForGenerator < Rails::Generators::Base #:nodoc:
|
61
|
+
include ViewPathTemplates
|
62
|
+
source_root File.expand_path("../../../../../app/views/devise", __FILE__)
|
63
|
+
desc "Copies default Devise views to your application."
|
64
|
+
hide!
|
65
|
+
end
|
66
|
+
|
67
|
+
class SimpleFormForGenerator < Rails::Generators::Base #:nodoc:
|
68
|
+
include ViewPathTemplates
|
69
|
+
source_root File.expand_path("../../templates/simple_form_for", __FILE__)
|
70
|
+
desc "Copies simple form enabled views to your application."
|
71
|
+
hide!
|
72
|
+
|
73
|
+
def copy_views
|
74
|
+
options[:views].delete("mailer") if options[:views]
|
75
|
+
super
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class MailerViewsGenerator < Rails::Generators::Base #:nodoc:
|
80
|
+
include ViewPathTemplates
|
81
|
+
source_root File.expand_path("../../../../../app/views/devise", __FILE__)
|
82
|
+
desc "Copies Devise mail erb views to your application."
|
83
|
+
hide!
|
84
|
+
|
85
|
+
def copy_views
|
86
|
+
if !options[:views] || options[:views].include?("mailer")
|
87
|
+
view_directory :mailer
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class ViewsGenerator < Rails::Generators::Base
|
93
|
+
desc "Copies Devise views to your application."
|
94
|
+
|
95
|
+
argument :scope, required: false, default: nil, desc: "The scope to copy views to"
|
96
|
+
|
97
|
+
invoke SharedViewsGenerator
|
98
|
+
invoke MailerViewsGenerator
|
99
|
+
|
100
|
+
hook_for :form_builder, aliases: "-b",
|
101
|
+
desc: "Form builder to be used",
|
102
|
+
default: "i18n:#{defined?(SimpleForm) ? 'simple_form_for' : 'form_for'}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|