devise-uikit-views 0.0.2
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 +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +57 -0
- data/Rakefile +2 -0
- data/app/assets/stylesheets/devise_uikit_views.scss +6 -0
- data/app/assets/stylesheets/devise_uikit_views_less.less +6 -0
- data/app/views/devise/confirmations/new.html.erb +19 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +6 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +26 -0
- data/app/views/devise/passwords/new.html.erb +19 -0
- data/app/views/devise/registrations/edit.html.erb +32 -0
- data/app/views/devise/registrations/new.html.erb +29 -0
- data/app/views/devise/sessions/new.html.erb +29 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +19 -0
- data/devise-uikit-views.gemspec +25 -0
- data/lib/devise-uikit-views.rb +26 -0
- data/lib/devise_uikit_views_helper.rb +22 -0
- data/lib/generators/devise/views/locale/locale_generator.rb +10 -0
- data/lib/generators/devise/views/uikit_templates/uikit_templates_generator.rb +10 -0
- data/lib/version.rb +3 -0
- data/locales/ar.yml +157 -0
- data/locales/ca.yml +59 -0
- data/locales/cs.yml +132 -0
- data/locales/de.yml +138 -0
- data/locales/en.yml +141 -0
- data/locales/es-AR.yml +51 -0
- data/locales/es-ES.yml +59 -0
- data/locales/es.yml +51 -0
- data/locales/fr.yml +51 -0
- data/locales/hu.yml +59 -0
- data/locales/it.yml +51 -0
- data/locales/ja.yml +142 -0
- data/locales/nl.yml +59 -0
- data/locales/pl.yml +57 -0
- data/locales/pt-BR.yml +56 -0
- data/locales/ru.yml +133 -0
- data/locales/tr.yml +51 -0
- data/locales/uk.yml +56 -0
- data/locales/zh-CN.yml +58 -0
- data/locales/zh-TW.yml +57 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6401cf17ea08fce14c10ddfe9c047512b0821b19
|
4
|
+
data.tar.gz: 418b707702cc4b543e3271e40cafa36f84220d40
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7585fa3b9b31e4067e079d80edad4abb322ed72c6d8b76ed5cb6c4efeeae44f2844c499f1791f3737219baf52af25535e2b00af60f07eec9c7218b00b8b714cf
|
7
|
+
data.tar.gz: a4197cf8bc31ee41ff21f14c0078c2b5d86607ba3c8cbcf6be5224b56595258811113bbe72644193cf7c3aa615a328ed22d824aafc31ed878ab4782bccaec2ec
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Devise::Uikit::Views
|
2
|
+
|
3
|
+
このgemはRailsのログイン認証管理を行う際によく利用されるdeviseのviewにUIkitを適用するgemです。
|
4
|
+
このgemのソースのほとんどはこちらを参考にしています。
|
5
|
+
[devise-bootstrap-views](https://github.com/hisea/devise-bootstrap-views)
|
6
|
+
|
7
|
+
あと、UIkitのリポジトリはこちらです。
|
8
|
+
[UIkit](https://github.com/uikit/uikit)
|
9
|
+
|
10
|
+
## インストール
|
11
|
+
|
12
|
+
gemファイルに以下のコードを追加してください。
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'devise-uikit-views'
|
16
|
+
```
|
17
|
+
|
18
|
+
そのあとはbundle installをします。
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
$ bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
アッセトパイプラインで使用するためにapp/assets/stylesheets/application.cssに以下のコードを記述します。
|
25
|
+
SASSとLESSで違うので気をつけてください。
|
26
|
+
|
27
|
+
### SASS
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
*= require devise_uikit_views
|
31
|
+
```
|
32
|
+
|
33
|
+
### LESS
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
*= require devise_uikit_views_less
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
## カスタマイズ
|
41
|
+
|
42
|
+
参考元と同じく以下のコマンドを入力することで言語ファイルやviewのファイルの生成ができます
|
43
|
+
カスタマイズをしたい場合はこちらのコマンドを入力してください。
|
44
|
+
|
45
|
+
``` sh
|
46
|
+
# 原語ファイル
|
47
|
+
rails g devise:views:locale ja
|
48
|
+
```
|
49
|
+
|
50
|
+
``` sh
|
51
|
+
# viewファイル
|
52
|
+
rails g devise:views:uikit_templates
|
53
|
+
```
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
バグとかプルリクエストとかは大歓迎ですのでよろしくお願いします。 https://github.com/eskey/devise-uikit-views.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= uikit_devise_error_messages! %>
|
2
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
3
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
4
|
+
<div class="uk-panel uk-panel-box">
|
5
|
+
<h1><%= t('.resend_confirmation_instructions', :default => 'Resend confirmation instructions') %></h1>
|
6
|
+
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, role: "form" }) do |f| %>
|
7
|
+
<div class="uk-form uk-form-stacked">
|
8
|
+
<div class="uk-form-row">
|
9
|
+
<%= f.label :email, :class => "uk-form-label" %>
|
10
|
+
<%= f.email_field :email, autofocus: true, class: "uk-form-controls uk-form-width-large" %>
|
11
|
+
</div>
|
12
|
+
<br />
|
13
|
+
<%= f.submit t('.resend_confirmation_instructions', :default => 'Resend confirmation instructions'), class: "uk-button uk-button-primary" %>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%= render "devise/shared/links" %>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<p><%= t('.greeting', :recipient => @resource.email, :default => "Welcome #{@resource.email}!") %></p>
|
2
|
+
|
3
|
+
<p><%= t('.instruction', :default => "You can confirm your account email through the link below:") %></p>
|
4
|
+
|
5
|
+
<p><%= link_to t('.action', :default => "Confirm my account"),
|
6
|
+
confirmation_url(@resource, :confirmation_token => @token, locale: I18n.locale) %></p>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p><%= t('.greeting', :recipient => @resource.email, :default => "Hello #{@resource.email}!") %></p>
|
2
|
+
|
3
|
+
<p><%= t('.instruction', :default => "Someone has requested a link to change your password, and you can do this through the link below.") %></p>
|
4
|
+
|
5
|
+
<p><%= link_to t('.action', :default => "Change my password"), edit_password_url(@resource, :reset_password_token => @token, locale: I18n.locale) %></p>
|
6
|
+
|
7
|
+
<p><%= t('.instruction_2', :default => "If you didn't request this, please ignore this email.") %></p>
|
8
|
+
<p><%= t('.instruction_3', :default => "Your password won't change until you access the link above and create a new one.") %></p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p><%= t('.greeting', :recipient => @resource.email, :default => "Hello #{@resource.email}!") %></p>
|
2
|
+
|
3
|
+
<p><%= t('.message', :default => "Your account has been locked due to an excessive amount of unsuccessful sign in attempts.") %></p>
|
4
|
+
|
5
|
+
<p><%= t('.instruction', :default => "Click the link below to unlock your account:") %></p>
|
6
|
+
|
7
|
+
<p><%= link_to t('.action', :default => "Unlock my account"), unlock_url(@resource, :unlock_token => @resource.unlock_token, locale: I18n.locale) %></p>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<%= uikit_devise_error_messages! %>
|
2
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
3
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
4
|
+
<div class="uk-panel uk-panel-box">
|
5
|
+
<h1><%= t('.change_your_password', :default => 'Change your password') %></h1>
|
6
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, role: "form" }) do |f| %>
|
7
|
+
<%= f.hidden_field :reset_password_token %>
|
8
|
+
|
9
|
+
<div class="uk-form uk-form-stacked">
|
10
|
+
<div class="uk-form-row">
|
11
|
+
<%= f.label :password, t('.new_password', :default => 'New password'), :class => "uk-form-label" %>
|
12
|
+
<%= f.password_field :password, autofocus: true, :class => "uk-form-controls uk-form-width-large" %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="uk-form-row">
|
16
|
+
<%= f.label :password_confirmation, t('.confirm_new_password', :default => 'Confirm new password'), :class => "uk-form-label" %>
|
17
|
+
<%= f.password_field :password_confirmation, :class => "uk-form-controls uk-form-width-large" %>
|
18
|
+
</div>
|
19
|
+
<br />
|
20
|
+
<%= f.button t('.change_my_password', :default => 'Change my password'), :class => 'uk-button uk-button-primary' %>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<%= render "devise/shared/links" %>
|
25
|
+
</div>
|
26
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= uikit_devise_error_messages! %>
|
2
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
3
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
4
|
+
<div class="uk-panel uk-panel-box">
|
5
|
+
<h1><%= t('.forgot_your_password', :default => 'Forgot your password?') %></h1>
|
6
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, role: "form" }) do |f| %>
|
7
|
+
<div class="uk-form uk-form-stacked">
|
8
|
+
<div class="uk-form-row">
|
9
|
+
<%= f.label :email, :class => "uk-form-label" %>
|
10
|
+
<%= f.email_field :email, autofocus: true, :class => "uk-form-controls uk-form-width-large" %>
|
11
|
+
</div>
|
12
|
+
<br />
|
13
|
+
<%= f.button t('.send_me_reset_password_instructions', :default => "Send me reset password instructions"), :class => 'uk-button uk-button-primary' %>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%= render "devise/shared/links" %>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%= uikit_devise_error_messages! %>
|
2
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
3
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
4
|
+
<div class="uk-panel uk-panel-box">
|
5
|
+
<h1><%= t('.title', :resource => resource_class.model_name.human , :default => "Edit #{resource_name.to_s.humanize}") %></h1>
|
6
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
7
|
+
<div class="uk-form uk-form-stacked">
|
8
|
+
<div class="uk-form-row">
|
9
|
+
<%= f.label :email, :class => "uk-form-label" %>
|
10
|
+
<%= f.email_field :email, autofocus: true, :class => "uk-form-controls uk-form-width-large" %>
|
11
|
+
</div>
|
12
|
+
<div class="uk-form-row">
|
13
|
+
<%= f.label :password, :class => "uk-form-label" %> <i>(<%= t('.leave_blank_if_you_don_t_want_to_change_it', :default => "leave blank if you don't want to change it") %>)</i><br />
|
14
|
+
<%= f.password_field :password, :autocomplete => "off", :class => "uk-form-controls uk-form-width-large" %>
|
15
|
+
</div>
|
16
|
+
<div class="uk-form-row">
|
17
|
+
<%= f.label :password_confirmation, :class => "uk-form-label" %><br />
|
18
|
+
<%= f.password_field :password_confirmation, :class => "uk-form-controls uk-form-width-large" %>
|
19
|
+
</div>
|
20
|
+
<div class="uk-form-row">
|
21
|
+
<%= f.label :current_password, :class => "uk-form-label" %> <i>(<%= t('.we_need_your_current_password_to_confirm_your_changes', :default => 'we need your current password to confirm your changes') %>)</i>
|
22
|
+
<%= f.password_field :current_password, :class => "uk-form-controls uk-form-width-large" %>
|
23
|
+
</div>
|
24
|
+
<br />
|
25
|
+
<%= f.button t('.update', :default => "Update"), :class => 'uk-button uk-button-primary' %>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<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>
|
30
|
+
<%= link_to t('.back', :default => 'Back'), :back %>
|
31
|
+
</div>
|
32
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<%= uikit_devise_error_messages! %>
|
2
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
3
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
4
|
+
<div class="uk-panel uk-panel-box">
|
5
|
+
<h1><%= t('.sign_up', :default => "Sign up") %></h1>
|
6
|
+
<div class="uk-form uk-form-stacked">
|
7
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
8
|
+
<%= devise_error_messages! %>
|
9
|
+
|
10
|
+
<div class="uk-form-row"><%= f.label :email, :class => "uk-form-label" %>
|
11
|
+
<%= f.email_field :email, :class => "uk-form-controls uk-form-width-large" %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="uk-form-row"><%= f.label :password, :class => "uk-form-label" %>
|
15
|
+
<%= f.password_field :password, :class => "uk-form-controls uk-form-width-large" %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="uk-form-row"><%= f.label :password_confirmation, :class => "uk-form-label" %>
|
19
|
+
<%= f.password_field :password_confirmation, :class => "uk-form-controls uk-form-width-large" %>
|
20
|
+
</div>
|
21
|
+
<br />
|
22
|
+
<div><%= f.button t('.sign_up', :default => "Sign up"), :class => 'uk-button uk-button-primary' %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<%= render "devise/shared/links" %>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
2
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
3
|
+
<div class="uk-panel uk-panel-box">
|
4
|
+
<h1><%= t('.sign_in', :default => "Sign in") %></h1>
|
5
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { role: "form" }) do |f| %>
|
6
|
+
<div class="uk-form uk-form-stacked">
|
7
|
+
<div class="uk-form-row">
|
8
|
+
<%= f.label :email, :class => "uk-form-label" %>
|
9
|
+
<%= f.email_field :email, autofocus: true, :class => "uk-form-controls uk-form-width-large" %>
|
10
|
+
</div>
|
11
|
+
<div class="uk-form-row">
|
12
|
+
<%= f.label :password, :class => "uk-form-label" %>
|
13
|
+
<%= f.password_field :password, autocomplete: "off", :class => "uk-form-controls uk-form-width-large" %>
|
14
|
+
</div>
|
15
|
+
<% if devise_mapping.rememberable? %>
|
16
|
+
<div class="uk-form-row">
|
17
|
+
<div class="uk-form-controls">
|
18
|
+
<%= f.check_box :remember_me %>
|
19
|
+
<%= f.label :remember_me %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<%= f.button t('.sign_in', :default => "Sign in"), class: "uk-button uk-button-primary" %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<%= render "devise/shared/links" %>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to t(".sign_in", :default => "Sign in"), new_session_path(resource_name) %><br />
|
3
|
+
<% end -%>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to t(".sign_up", :default => "Sign up"), new_registration_path(resource_name) %><br />
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
10
|
+
<%= link_to t(".forgot_your_password", :default => "Forgot your password?"), new_password_path(resource_name) %><br />
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to t('.didn_t_receive_confirmation_instructions', :default => "Didn't receive confirmation instructions?"), new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to t('.didn_t_receive_unlock_instructions', :default => "Didn't receive unlock instructions?"), new_unlock_path(resource_name) %><br />
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= 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 />
|
24
|
+
<% end -%>
|
25
|
+
<% end -%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= uikit_devise_error_messages! %>
|
2
|
+
<div class="uk-grid uk-panel-devise" data-uk-grid-margin>
|
3
|
+
<div class="uk-width-medium-1-2 uk-container-center uk-row-first">
|
4
|
+
<div class="uk-panel uk-panel-box">>
|
5
|
+
<h1><%= t('.resend_unlock_instructions', :default => "Resend unlock instructions") %></h1>
|
6
|
+
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post, html: { role: "form" } }) do |f| %>
|
7
|
+
<div class="uk-form uk-form-stacked">
|
8
|
+
<div class="uk-form-row">
|
9
|
+
<%= f.label :email, :class => "uk-form-label" %>
|
10
|
+
<%= f.email_field :email, autofocus: true, class: "uk-form-controls uk-form-width-large" %>
|
11
|
+
</div>
|
12
|
+
<br />
|
13
|
+
<%= f.button t('.resend_unlock_instructions', :default => "Resend unlock instructions"), class: "uk-button uk-button-primary"%>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%= render "devise/shared/links" %>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "devise-uikit-views"
|
8
|
+
spec.version = DeviseUikitViews::VERSION
|
9
|
+
spec.authors = ["eskey"]
|
10
|
+
spec.email = ["esplants@outlook.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Devise UIkit views with i18n support.}
|
13
|
+
spec.description = %q{Devise UIkit views with i18n support.}
|
14
|
+
spec.homepage = ""
|
15
|
+
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'devise_uikit_views_helper'
|
3
|
+
module DeviseUikitViews
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
end
|
6
|
+
|
7
|
+
class Railtie < ::Rails::Railtie #:nodoc:
|
8
|
+
initializer 'rails-devise-uikit-views' do |app|
|
9
|
+
DeviseUikitViews::Railtie.instance_eval do
|
10
|
+
pattern = pattern_from app.config.i18n.available_locales
|
11
|
+
|
12
|
+
files = Dir[File.join(File.dirname(__FILE__), '../locales', "#{pattern}.yml")]
|
13
|
+
I18n.load_path.concat(files)
|
14
|
+
|
15
|
+
ActionView::Base.send :include, DeviseUikitViewsHelper
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def self.pattern_from(args)
|
22
|
+
array = Array(args || [])
|
23
|
+
array.blank? ? '*' : "{#{array.join ','}}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
module DeviseUikitViewsHelper
|
4
|
+
def uikit_devise_error_messages!
|
5
|
+
return '' if resource.errors.empty?
|
6
|
+
|
7
|
+
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
|
8
|
+
sentence = I18n.t('errors.messages.not_saved',
|
9
|
+
count: resource.errors.count,
|
10
|
+
resource: resource.class.model_name.human.downcase)
|
11
|
+
|
12
|
+
html = <<-HTML
|
13
|
+
<div class="uk-alert uk-alert-danger" data-uk-alert>
|
14
|
+
<a href="" class="uk-alert-close uk-close"></a>
|
15
|
+
<h5>#{sentence}</h5>
|
16
|
+
<ul>#{messages}</ul>
|
17
|
+
</div>
|
18
|
+
HTML
|
19
|
+
|
20
|
+
html.html_safe
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Devise
|
2
|
+
module Views
|
3
|
+
class LocaleGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../../../../../../locales', __FILE__)
|
5
|
+
def copy_locale
|
6
|
+
copy_file("#{name}.yml", Rails.root.join("config", "locales", "devise.views.#{name}.yml"))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Devise
|
2
|
+
module Views
|
3
|
+
class UikitTemplatesGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../../../../../../app/views', __FILE__)
|
5
|
+
def copy_views
|
6
|
+
directory("devise", Rails.root.join("app", "views", "devise"))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|