devise-bootstrap-views 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +51 -0
  6. data/Rakefile +2 -0
  7. data/Screenshot.png +0 -0
  8. data/app/assets/stylesheets/devise_bootstrap_views.scss +10 -0
  9. data/app/helpers/devise_bootstrap_views_helper.rb +20 -0
  10. data/app/views/devise/confirmations/new.html.erb +18 -0
  11. data/app/views/devise/mailer/confirmation_instructions.html.erb +6 -0
  12. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  13. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  14. data/app/views/devise/passwords/edit.html.erb +24 -0
  15. data/app/views/devise/passwords/new.html.erb +17 -0
  16. data/app/views/devise/registrations/edit.html.erb +30 -0
  17. data/app/views/devise/registrations/new.html.erb +24 -0
  18. data/app/views/devise/sessions/new.html.erb +26 -0
  19. data/app/views/devise/shared/_links.erb +25 -0
  20. data/app/views/devise/unlocks/new.html.erb +16 -0
  21. data/devise-bootstrap-views.gemspec +23 -0
  22. data/lib/devise-bootstrap-views.rb +23 -0
  23. data/lib/generators/devise/views/bootstrap_templates/bootstrap_templates_generator.rb +10 -0
  24. data/lib/generators/devise/views/locale/locale_generator.rb +10 -0
  25. data/lib/version.rb +3 -0
  26. data/locales/ca.yml +59 -0
  27. data/locales/de.yml +110 -0
  28. data/locales/en.yml +110 -0
  29. data/locales/es-AR.yml +51 -0
  30. data/locales/es-ES.yml +59 -0
  31. data/locales/es.yml +51 -0
  32. data/locales/fr.yml +51 -0
  33. data/locales/hu.yml +59 -0
  34. data/locales/it.yml +51 -0
  35. data/locales/nl.yml +59 -0
  36. data/locales/pl.yml +57 -0
  37. data/locales/pt-BR.yml +51 -0
  38. data/locales/ru.yml +56 -0
  39. data/locales/tr.yml +51 -0
  40. data/locales/zh-CN.yml +57 -0
  41. data/locales/zh-TW.yml +57 -0
  42. metadata +112 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 32d447d978731a77f131e95233583426e7ccb681
4
+ data.tar.gz: f226b1a961d9588ad0aafbdf8d087b269aca2fb5
5
+ SHA512:
6
+ metadata.gz: f133d667f1dbb6ea075a14c23b3d64e4b167d4e1ac68b22617c4e00a50c61fc3add0d15d61abb61e574748adca81eaa9a2c99aa9108309a8d4501af492410386
7
+ data.tar.gz: 4f3f8db514dc0f32a86c9698d4736eb92c4311ba75a90e6a9aaae2608476f532f27548cc41d4fcded98caf5fc00a3b4d92927e5f6c13dd39740389b1f9602a9d
@@ -0,0 +1,22 @@
1
+ *.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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in devise-bootstrap-views.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yinghai Zhao
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ # Devise Bootstrap Views
2
+
3
+ Here are some of the highlights:
4
+
5
+ * Devise views with Bootstrap 3.
6
+ * Used Bootstrap responsive columns.
7
+ * I18n Support.
8
+
9
+ WARNING:
10
+ This gem copies lots of its code from [devise-i18n-views](https://github.com/mcasimir/devise-i18n-views) gem.
11
+
12
+ ## Screenshot
13
+ ![Screenshot](https://raw.githubusercontent.com/hisea/devise-bootstrap-views/master/Screenshot.png)
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ gem 'devise-bootstrap-views'
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Add some minor css fix to your rails asset pipeline manifest
26
+
27
+ *= require devise_bootstrap_views
28
+
29
+ Then you need to install the required translations in your `config/locales`. You can do this either manually (downloading them from [devise-i18n-views/locales](https://github.com/mcasimir/devise-i18n-views/tree/master/locales)) or through the apposite generator `devise:views:locale`, eg.
30
+
31
+ ``` sh
32
+ rails g devise:views:locale it
33
+ ```
34
+
35
+ will generate `config/locales/devise.views.it.yml`.
36
+
37
+ ## Customizing Views
38
+
39
+ The `devise:views:bootstrap_templates` generator will copy all views to your application, so you can modify the files as you wish:
40
+
41
+ ``` sh
42
+ rails g devise:views:bootstrap_templates
43
+ ```
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it ( https://github.com/hisea/devise-bootstrap-views/fork )
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
Binary file
@@ -0,0 +1,10 @@
1
+ .float-none {
2
+ float: none;
3
+ }
4
+
5
+ .panel-heading {
6
+ padding: 15px;
7
+ h4 {
8
+ margin: 0px;
9
+ }
10
+ }
@@ -0,0 +1,20 @@
1
+ module DeviseBootstrapViewsHelper
2
+ def devise_error_messages!
3
+ return '' if resource.errors.empty?
4
+
5
+ messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
6
+ sentence = I18n.t('errors.messages.not_saved',
7
+ count: resource.errors.count,
8
+ resource: resource.class.model_name.human.downcase)
9
+
10
+ html = <<-HTML
11
+ <div class="alert alert-danger alert-block">
12
+ <button type="button" class="close" data-dismiss="alert">x</button>
13
+ <h5>#{sentence}</h4>
14
+ #{messages}
15
+ </div>
16
+ HTML
17
+
18
+ html.html_safe
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ <%= devise_error_messages! %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4><%= t('.resend_confirmation_instructions', :default => 'Resend confirmation instructions') %></h4>
5
+ </div>
6
+ <div class="panel-body">
7
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, role: "form" }) do |f| %>
8
+ <div class="form-group">
9
+ <%= f.label :email %>
10
+ <%= f.email_field :email, class: "form-control" %>
11
+ </div>
12
+
13
+ <%= f.submit t('.resend_confirmation_instructions', :default => 'Resend confirmation instructions'), class: "btn btn-primary" %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+
18
+ <%= render "devise/shared/links" %>o
@@ -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 => @resource.confirmation_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,24 @@
1
+ <%= devise_error_messages! %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4><%= t('.change_your_password', :default => 'Change your password') %></h4>
5
+ </div>
6
+ <div class="panel-body">
7
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, role: "form" }) do |f| %>
8
+ <%= f.hidden_field :reset_password_token %>
9
+
10
+ <div class="form-group">
11
+ <%= f.label :password, t('.new_password', :default => 'New password') %>
12
+ <%= f.password_field :password, class: "form-control" %>
13
+ </div>
14
+
15
+ <div class="form-group">
16
+ <%= f.label :password_confirmation, t('.confirm_new_password', :default => 'Confirm new password') %>
17
+ <%= f.password_field :password_confirmation, class: "form-control" %>
18
+ </div>
19
+
20
+ <%= f.submit t('.change_my_password', :default => 'Change my password'), class: "btn btn-primary" %>
21
+ <% end %>
22
+ </div>
23
+ </div>
24
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,17 @@
1
+ <%= devise_error_messages! %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4><%= t('.forgot_your_password', :default => 'Forgot your password?') %></h4>
5
+ </div>
6
+ <div class="panel-body">
7
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, role: "form" }) do |f| %>
8
+ <div class="form-group">
9
+ <%= f.label :email %>
10
+ <%= f.email_field :email, class: "form-control" %>
11
+ </div>
12
+
13
+ <%= f.submit t('.send_me_reset_password_instructions', :default => "Send me reset password instructions"), class: "btn btn-primary" %>
14
+ <% end %>
15
+ </div>
16
+ </div>
17
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,30 @@
1
+ <%= devise_error_messages! %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4><%= t('.title', :resource => resource_class.model_name.human , :default => 'Edit #{resource_name.to_s.humanize}') %></h4>
5
+ </div>
6
+ <div class="panel-body">
7
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
8
+ <div class="form-group">
9
+ <%= f.label :email %>
10
+ <%= f.email_field :email, class: "form-control" %>
11
+ </div>
12
+ <div class="form-group">
13
+ <%= 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><br />
14
+ <%= f.password_field :password, :autocomplete => "off" %>
15
+ </div>
16
+ <div class="form-group">
17
+ <%= f.label :password_confirmation %><br />
18
+ <%= f.password_field :password_confirmation, class: "form-control" %>
19
+ </div>
20
+ <div class="form-group">
21
+ <%= 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>
22
+ <%= f.password_field :current_password, class: "form-control" %>
23
+ </div>
24
+ <%= f.submit t('.update', :default => "Update"), class: "btn btn-primary" %></div>
25
+ <% end %>
26
+ </div>
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 "Back", :back %>
@@ -0,0 +1,24 @@
1
+ <%= devise_error_messages! %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4><%= t('.sign_up', :default => "Sign up") %></h4>
5
+ </div>
6
+ <div class="panel-body">
7
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: { role: "form" }) do |f| %>
8
+ <div class="form-group">
9
+ <%= f.label :email %>
10
+ <%= f.email_field :email, class: "form-control" %>
11
+ </div>
12
+ <div class="form-group">
13
+ <%= f.label :password %><br />
14
+ <%= f.password_field :password, class: "form-control" %>
15
+ </div>
16
+ <div class="form-group">
17
+ <%= f.label :password_confirmation %>
18
+ <%= f.password_field :password_confirmation, class: "form-control" %>
19
+ </div>
20
+ <%= f.submit t('.sign_up', :default => "Sign up"), class: "btn btn-primary" %>
21
+ <% end %>
22
+ </div>
23
+ </div>
24
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,26 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h4><%= t('.sign_in', :default => "Sign in") %></h4>
4
+ </div>
5
+ <div class="panel-body">
6
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { role: "form" }) do |f| %>
7
+ <div class="form-group">
8
+ <%= f.label :email %>
9
+ <%= f.email_field :email, autofocus: true, class: "form-control" %>
10
+ </div>
11
+ <div class="form-group">
12
+ <%= f.label :password %>
13
+ <%= f.password_field :password, autocomplete: "off", class: "form-control" %>
14
+ </div>
15
+ <% if devise_mapping.rememberable? %>
16
+ <div class="checkbox">
17
+ <label>
18
+ <%= f.check_box :remember_me %>
19
+ <%= f.label :remember_me %>
20
+ </div>
21
+ <% end %>
22
+ <%= f.submit t('.sign_in', :default => "Sign in"), class: "btn btn-primary" %>
23
+ <% end %>
24
+ </div>
25
+ </div>
26
+ <%= render "devise/shared/links" %>
@@ -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,16 @@
1
+ <%= devise_error_messages! %>
2
+ <div class="panel panel-default">
3
+ <div class="panel-heading">
4
+ <h4><%= t('.resend_unlock_instructions', :default => "Resend unlock instructions") %></h4>
5
+ </div>
6
+ <div class="panel-body">
7
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post, html: { role: "form" } }) do |f| %>
8
+ <div class="form-group">
9
+ <%= f.label :email %>
10
+ <%= f.email_field :email, class: "form-control" %>
11
+ </div>
12
+ <%= f.submit t('.resend_unlock_instructions', :default => "Resend unlock instructions"), class: "btn btn-primary"%>
13
+ <% end %>
14
+ </div>
15
+ </div>
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,23 @@
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-bootstrap-views"
8
+ spec.version = DeviseBootstrapViews::VERSION
9
+ spec.authors = ["Yinghai Zhao"]
10
+ spec.email = ["zyinghai@gmail.com"]
11
+ spec.summary = %q{Devise Bootstrap views with i18n support.}
12
+ spec.description = %q{Devise Bootstrap views with i18n support.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'rails'
2
+ module DeviseBootstrapViews
3
+ class Engine < ::Rails::Engine
4
+ end
5
+
6
+ class Railtie < ::Rails::Railtie #:nodoc:
7
+ initializer 'rails-i18n-views' do |app|
8
+ DeviseBootstrapViews::Railtie.instance_eval do
9
+ pattern = pattern_from app.config.i18n.available_locales
10
+
11
+ files = Dir[File.join(File.dirname(__FILE__), '../locales', "#{pattern}.yml")]
12
+ I18n.load_path.concat(files)
13
+ end
14
+ end
15
+
16
+ protected
17
+
18
+ def self.pattern_from(args)
19
+ array = Array(args || [])
20
+ array.blank? ? '*' : "{#{array.join ','}}"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ module Devise
2
+ module Views
3
+ class BootstrapTemplatesGenerator < 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
@@ -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