rails-replicator 0.1.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.
Files changed (58) hide show
  1. data/.gitignore +85 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +87 -0
  4. data/LICENSE +21 -0
  5. data/README.md +41 -0
  6. data/bin/replicator +16 -0
  7. data/lib/replicator/actions.rb +40 -0
  8. data/lib/replicator/app_builder.rb +337 -0
  9. data/lib/replicator/generators/app_generator.rb +207 -0
  10. data/lib/replicator/version.rb +3 -0
  11. data/replicator.gemspec +29 -0
  12. data/templates/Gemfile_clean +68 -0
  13. data/templates/Procfile +2 -0
  14. data/templates/README.md.erb +5 -0
  15. data/templates/_flashes.html.slim.erb +13 -0
  16. data/templates/_javascript.html.slim.erb +7 -0
  17. data/templates/ability.rb +15 -0
  18. data/templates/admin_base_controller.rb +14 -0
  19. data/templates/admin_dashboard_controller.rb +4 -0
  20. data/templates/application.css.sass +12 -0
  21. data/templates/application.html.slim.erb +24 -0
  22. data/templates/application.js +8 -0
  23. data/templates/application_helper.rb +5 -0
  24. data/templates/background_jobs_rspec.rb +19 -0
  25. data/templates/bin_setup +26 -0
  26. data/templates/config_locales_en.yml +11 -0
  27. data/templates/database.yml.erb +12 -0
  28. data/templates/database_cleaner_rspec.rb +21 -0
  29. data/templates/devise/confirmations/new.html.slim +12 -0
  30. data/templates/devise/mailer/confirmation_instructions.html.erb +5 -0
  31. data/templates/devise/mailer/reset_password_instructions.html.erb +8 -0
  32. data/templates/devise/mailer/unlock_instructions.html.erb +7 -0
  33. data/templates/devise/passwords/edit.html.slim +19 -0
  34. data/templates/devise/passwords/new.html.slim +14 -0
  35. data/templates/devise/registrations/edit.html.slim +36 -0
  36. data/templates/devise/registrations/new.html.slim +22 -0
  37. data/templates/devise/sessions/new.html.slim +20 -0
  38. data/templates/devise/shared/_links.html.slim +24 -0
  39. data/templates/devise/unlocks/new.html.slim +13 -0
  40. data/templates/devise_login.html.slim +20 -0
  41. data/templates/devise_shared_links.html.slim +24 -0
  42. data/templates/disable_xml_params.rb +3 -0
  43. data/templates/errors.rb +28 -0
  44. data/templates/factories_spec.rb +13 -0
  45. data/templates/factories_spec_rake_task.rb +9 -0
  46. data/templates/factory_girl_syntax_rspec.rb +3 -0
  47. data/templates/gitignore +85 -0
  48. data/templates/rack_timeout.rb +1 -0
  49. data/templates/routes.rb.erb +15 -0
  50. data/templates/sample.env +2 -0
  51. data/templates/smtp.rb +10 -0
  52. data/templates/spec_helper.rb +25 -0
  53. data/templates/stylesheets/layout/.keep +0 -0
  54. data/templates/stylesheets/typography/.keep +0 -0
  55. data/templates/stylesheets/typography/_forms.css.sass +2 -0
  56. data/templates/stylesheets/widgets/.keep +0 -0
  57. data/templates/unicorn.rb +26 -0
  58. metadata +140 -0
@@ -0,0 +1,207 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/app/app_generator'
3
+
4
+ module Replicator
5
+ class AppGenerator < Rails::Generators::AppGenerator
6
+ class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
7
+ :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
8
+
9
+ class_option :heroku, :type => :boolean, :aliases => '-H', :default => false,
10
+ :desc => 'Create staging and production Heroku apps'
11
+
12
+ class_option :github, :type => :string, :aliases => '-G', :default => nil,
13
+ :desc => 'Create Github repository and add remote origin pointed to repo'
14
+
15
+ class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
16
+ :desc => 'Skip Test::Unit files'
17
+
18
+ def finish_template
19
+ invoke :replicator_customization
20
+ super
21
+ end
22
+
23
+ def replicator_customization
24
+ invoke :remove_files_we_dont_need
25
+ invoke :customize_gemfile
26
+ invoke :setup_database
27
+ invoke :setup_development_environment
28
+ invoke :setup_test_environment
29
+ invoke :setup_production_environment
30
+ invoke :setup_staging_environment
31
+ invoke :create_replicator_views
32
+ invoke :setup_coffeescript
33
+ invoke :configure_app
34
+ invoke :setup_stylesheets
35
+ invoke :copy_miscellaneous_files
36
+ invoke :customize_error_pages
37
+ invoke :update_routes
38
+ invoke :migrate_database
39
+ invoke :setup_git
40
+ invoke :create_heroku_apps
41
+ invoke :create_github_repo
42
+ invoke :outro
43
+ end
44
+
45
+ def remove_files_we_dont_need
46
+ build :remove_public_index
47
+ build :remove_rails_logo_image
48
+ end
49
+
50
+ def customize_gemfile
51
+ build :replace_gemfile
52
+ build :set_ruby_to_version_being_used
53
+ build :setup_rvmrc
54
+ bundle_command 'install'
55
+ end
56
+
57
+ def setup_database
58
+ say 'Setting up database'
59
+
60
+ if 'postgresql' == options[:database]
61
+ build :use_postgres_config_template
62
+ end
63
+
64
+ build :create_database
65
+ end
66
+
67
+ def setup_development_environment
68
+ say 'Setting up the development environment'
69
+ build :raise_on_delivery_errors
70
+ build :raise_on_unpermitted_parameters
71
+ build :provide_setup_script
72
+ build :configure_generators
73
+ end
74
+
75
+ def setup_test_environment
76
+ say 'Setting up the test environment'
77
+ build :enable_factory_girl_syntax
78
+ build :test_factories_first
79
+ build :generate_rspec
80
+ build :configure_rspec
81
+ build :use_rspec_binstub
82
+ build :configure_background_jobs_for_rspec
83
+ build :enable_database_cleaner
84
+ build :configure_capybara_webkit
85
+ end
86
+
87
+ def setup_production_environment
88
+ say 'Setting up the production environment'
89
+ build :configure_smtp
90
+ end
91
+
92
+ def setup_staging_environment
93
+ say 'Setting up the staging environment'
94
+ build :setup_staging_environment
95
+ end
96
+
97
+ def create_replicator_views
98
+ say 'Creating replicator views'
99
+ build :create_partials_directory
100
+ build :create_shared_flashes
101
+ build :create_shared_javascripts
102
+ build :create_application_layout
103
+ end
104
+
105
+ def setup_coffeescript
106
+ say 'Setting up CoffeeScript defaults'
107
+ build :remove_turbolinks
108
+ build :create_common_javascripts
109
+ end
110
+
111
+ def configure_app
112
+ say 'Configuring app'
113
+ build :configure_action_mailer
114
+ build :blacklist_active_record_attributes
115
+ build :configure_strong_parameters
116
+ build :configure_time_zone
117
+ build :configure_time_formats
118
+ build :configure_rack_timeout
119
+ build :disable_xml_params
120
+ build :setup_default_rake_task
121
+ build :setup_application_helper
122
+ build :configure_unicorn
123
+ build :setup_foreman
124
+ build :setup_guard
125
+ build :setup_devise_and_cancan
126
+ build :generate_pages_controller
127
+ build :setup_admin_section
128
+ end
129
+
130
+ def setup_stylesheets
131
+ say 'Set up stylesheets'
132
+ build :setup_stylesheets
133
+ end
134
+
135
+ def setup_git
136
+ say 'Initializing git'
137
+ invoke :setup_gitignore
138
+ invoke :init_git
139
+ end
140
+
141
+ def create_heroku_apps
142
+ if options[:heroku]
143
+ say 'Creating Heroku apps'
144
+ build :create_heroku_apps
145
+ build :set_heroku_remotes
146
+ end
147
+ end
148
+
149
+ def create_github_repo
150
+ if options[:github]
151
+ say 'Creating Github repo'
152
+ build :create_github_repo, options[:github]
153
+ end
154
+ end
155
+
156
+ def setup_gitignore
157
+ build :gitignore_files
158
+ end
159
+
160
+ def init_git
161
+ build :init_git
162
+ end
163
+
164
+ def copy_libraries
165
+ say 'Copying libraries'
166
+ build :copy_libraries
167
+ end
168
+
169
+ def copy_miscellaneous_files
170
+ say 'Copying miscellaneous support files'
171
+ build :copy_miscellaneous_files
172
+ end
173
+
174
+ def customize_error_pages
175
+ say 'Customizing the 500/404/422 pages'
176
+ build :customize_error_pages
177
+ end
178
+
179
+ def update_routes
180
+ build :update_routes
181
+ end
182
+
183
+ def migrate_database
184
+ say 'Migrating database'
185
+ build :migrate_database
186
+ end
187
+
188
+ def outro
189
+ say 'Congratulations! Replication complete!'
190
+ say "Remember to run 'rails generate airbrake' with your API key."
191
+ end
192
+
193
+ def run_bundle
194
+ # Let's not: We'll bundle manually at the right spot
195
+ end
196
+
197
+ protected
198
+
199
+ def get_builder_class
200
+ Replicator::AppBuilder
201
+ end
202
+
203
+ def using_active_record?
204
+ !options[:skip_active_record]
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,3 @@
1
+ module Replicator
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'replicator/version'
4
+ require 'date'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.required_ruby_version = '>= 2.0.0'
8
+ s.add_dependency 'bundler', '~> 1.3'
9
+ s.add_dependency 'rails', '4.0.0'
10
+ s.authors = ['teleporter']
11
+ s.date = Date.today.strftime('%Y-%m-%d')
12
+
13
+ s.description = <<-HERE
14
+ Rails application generator used at Teleporter, based on thoughtbot/suspenders.
15
+ HERE
16
+
17
+ s.email = 'hire@teleporter.io'
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |file| File.basename(file) }
19
+ s.extra_rdoc_files = %w[README.md LICENSE]
20
+ s.files = `git ls-files`.split("\n")
21
+ s.homepage = 'http://github.com/teleporter/replicator'
22
+ s.license = 'MIT'
23
+ s.name = 'rails-replicator'
24
+ s.rdoc_options = ['--charset=UTF-8']
25
+ s.require_paths = ['lib']
26
+ s.summary = "Generate a Rails app using Teleporter's best practices."
27
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
28
+ s.version = Replicator::VERSION
29
+ end
@@ -0,0 +1,68 @@
1
+ source 'https://rubygems.org'
2
+
3
+ ruby '2.0.0'
4
+
5
+ gem 'airbrake', '~> 3.1'
6
+ # gem 'ancestry', '~> 2.0'
7
+ gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass', branch: '3'
8
+ gem 'cancan', '~> 1.6'
9
+ gem 'coffee-rails', '~> 4.0'
10
+ gem 'delayed_job_active_record', '~> 4.0'
11
+ gem 'devise', '~> 3.1'
12
+ gem 'email_validator', '~> 1.4'
13
+ gem 'figaro', '~> 0.7'
14
+ gem 'font-awesome-rails', '~> 3.2'
15
+ gem 'jquery-rails', '~> 3.0'
16
+ gem 'neat', '~> 1.4'
17
+ gem 'newrelic_rpm', '~> 3.6'
18
+ gem 'pg', '~> 0.17'
19
+ gem 'rack-timeout', '~> 0.0'
20
+ gem 'rails', '4.0.0'
21
+ gem 'recipient_interceptor', '~> 0.1'
22
+ gem 'rolify', '~> 3.2'
23
+ gem 'sass-rails', '~> 4.0'
24
+ gem 'slim', '~> 2.0'
25
+ # gem 'stripe', '~> 1.7'
26
+ gem 'tinymce-rails', '~> 4.0'
27
+ gem 'turbolinks', '~> 1.3'
28
+ gem 'uglifier', '~> 1.3'
29
+
30
+ group :development do
31
+ gem 'better_errors', '~> 1.0'
32
+ gem 'binding_of_caller', platforms: [:mri_19, :mri_20, :rbx]
33
+ gem 'guard-bundler', '~> 1.0'
34
+ gem 'guard-rails', '~> 0.4'
35
+ gem 'guard-rspec', '~> 2.5'
36
+ gem 'haml-rails', '~> 0.4'
37
+ gem 'haml2slim', '~> 0.4'
38
+ gem 'html2haml', '~> 1.0'
39
+ gem 'hub', '~> 1.10', require: nil
40
+ gem 'quiet_assets', '~> 1.0'
41
+ gem 'rb-fchange', '~> 0.0', require: false
42
+ gem 'rb-fsevent', '~> 0.9', require: false
43
+ gem 'rb-inotify', '~> 0.9', require: false
44
+ end
45
+
46
+ group :development, :test do
47
+ gem 'factory_girl_rails', '~> 4.2'
48
+ gem 'guard-spork', '~> 1.5'
49
+ gem 'guard-rspec', '~> 2.5'
50
+ gem 'rspec-rails', '~> 2.14'
51
+ gem 'spork-rails', github: 'sporkrb/spork-rails'
52
+ end
53
+
54
+ group :staging, :production do
55
+ gem 'rails_12factor', '~> 0.0' # heroku asset pipeline helper
56
+ gem 'unicorn', '~> 4.6'
57
+ end
58
+
59
+ group :test do
60
+ gem 'capybara', '~> 2.1'
61
+ gem 'database_cleaner', '~> 1.0'
62
+ gem 'email_spec', '~> 1.5'
63
+ gem 'launchy', '~> 2.3'
64
+ gem 'shoulda-matchers', '~> 2.4'
65
+ gem 'simplecov', '~> 0.7', require: false
66
+ gem 'timecop', '~> 0.6'
67
+ gem 'webmock', '~> 1.13'
68
+ end
@@ -0,0 +1,2 @@
1
+ web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
2
+ worker: bundle exec rake jobs:work
@@ -0,0 +1,5 @@
1
+ # <%= app_name %>
2
+
3
+ Congrats! You've just created a Rails applications using [Replicator](https://github.com/teleporter/replicator).
4
+
5
+ Now it's time to get to work!
@@ -0,0 +1,13 @@
1
+ - flash.each do |name, msg|
2
+ - if name.to_s == 'alert'
3
+ .alert.alert-danger
4
+ = link_to "&times;".html_safe, '#', 'data-dismiss' => 'alert', 'aria-hidden' => 'true', class: 'close'
5
+ i.icon-remove
6
+ | &nbsp;&nbsp;
7
+ = msg
8
+ - else
9
+ .alert.alert-success
10
+ = link_to "&times;".html_safe, '#', 'data-dismiss' => 'alert', 'aria-hidden' => 'true', class: 'close'
11
+ i.icon-ok
12
+ | &nbsp;&nbsp;
13
+ = msg
@@ -0,0 +1,7 @@
1
+ = javascript_include_tag :application
2
+
3
+ = yield :javascript
4
+
5
+ - if Rails.env.test?
6
+ javascript:
7
+ $.ajaxSetup({ async: false });
@@ -0,0 +1,15 @@
1
+ class Ability
2
+ include CanCan::Ability
3
+
4
+ def initialize(user)
5
+ user ||= User.new # guest user (not logged in)
6
+ if user.has_role? :admin
7
+ can :manage, :all
8
+ else
9
+ can :read, :all
10
+ # can :read, Page do |page|
11
+ # page.published?
12
+ # end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ class Admin::BaseController < ApplicationController
2
+ before_filter :authenticate_as_admin
3
+
4
+ private
5
+ def authenticate_as_admin
6
+ unless user_is_an_admin?
7
+ redirect_to root_path, alert: 'You must first login as an admin to do that!'
8
+ end
9
+ end
10
+
11
+ def user_is_an_admin?
12
+ current_user && current_user.has_role?(:admin)
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ class Admin::DashboardController < Admin::BaseController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,12 @@
1
+ // vendor
2
+ @import bootstrap
3
+ @import font-awesome
4
+
5
+ // core
6
+ @import typography/forms
7
+
8
+ // layout
9
+ // @import layout/header
10
+
11
+ // widgets
12
+ // @import widgets/some-widget
@@ -0,0 +1,24 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title = content_for?(:title) ? yield(:title) : "<%= app_name %>"
5
+ meta name="viewport" content="width=device-width, initial-scale=1.0"
6
+ = stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
7
+ = javascript_include_tag "application", "data-turbolinks-track" => true
8
+ = csrf_meta_tags
9
+ body
10
+ .page
11
+ nav.page-nav.navbar.navbar-default role="navigation"
12
+ .container
13
+ = link_to "<%= app_name %>", '/', class: 'navbar-brand'
14
+ ul.nav.navbar-nav
15
+ ul.nav.navbar-nav.pull-right
16
+ - if user_signed_in?
17
+ li = link_to "Logout", logout_path, method: :delete
18
+ - else
19
+ li = link_to "Sign Up", signup_path
20
+ li = link_to "Login", login_path
21
+ .container
22
+ = render 'flashes'
23
+ = yield
24
+ = render 'javascript'
@@ -0,0 +1,8 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require turbolinks
4
+ //= require bootstrap
5
+
6
+ $(function () {
7
+ // jquery onload...
8
+ });
@@ -0,0 +1,5 @@
1
+ module ApplicationHelper
2
+ def set_title(value)
3
+ content_for(:title, value)
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ module BackgroundJobs
2
+ def run_background_jobs_immediately
3
+ delay_jobs = Delayed::Worker.delay_jobs
4
+ Delayed::Worker.delay_jobs = false
5
+ yield
6
+ ensure
7
+ Delayed::Worker.delay_jobs = delay_jobs
8
+ end
9
+ end
10
+
11
+ RSpec.configure do |config|
12
+ config.around(:each, type: :feature) do |example|
13
+ run_background_jobs_immediately do
14
+ example.run
15
+ end
16
+ end
17
+
18
+ config.include BackgroundJobs
19
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env sh
2
+
3
+ # Set up Rails app. Run this script immediately after cloning the codebase.
4
+ # https://github.com/thoughtbot/guides/tree/master/protocol
5
+
6
+ # Set up Ruby dependencies via Bundler
7
+ bundle install
8
+
9
+ # Set up the database
10
+ bundle exec rake db:setup
11
+
12
+ # Set up configurable environment variables
13
+ if [ ! -f .env ]; then
14
+ cp .sample.env .env
15
+ fi
16
+
17
+ # Pick a port for Foreman
18
+ echo "port: 3000" > .foreman
19
+
20
+ # Set up DNS via Pow
21
+ # if [ -d ~/.pow ]
22
+ # then
23
+ # echo 7000 > ~/.pow/`basename $PWD`
24
+ # else
25
+ # echo "Pow not set up but the team uses it for this project. Setup: http://goo.gl/RaDPO"
26
+ # fi
@@ -0,0 +1,11 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ default: '%m/%d/%Y'
5
+ with_weekday: '%a %m/%d/%y'
6
+
7
+ time:
8
+ formats:
9
+ default: '%a, %b %-d, %Y at %r'
10
+ date: '%b %-d, %Y'
11
+ short: '%B %d'
@@ -0,0 +1,12 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: <%= app_name %>_dev
4
+ host: localhost
5
+ encoding: utf8
6
+ min_messages: warning
7
+ pool: 5
8
+ timeout: 5000
9
+
10
+ test:
11
+ <<: *default
12
+ database: <%= app_name %>_test
@@ -0,0 +1,21 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.clean_with(:deletion)
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+
10
+ config.before(:each, :js => true) do
11
+ DatabaseCleaner.strategy = :deletion
12
+ end
13
+
14
+ config.before(:each) do
15
+ DatabaseCleaner.start
16
+ end
17
+
18
+ config.after(:each) do
19
+ DatabaseCleaner.clean
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ h1.page-header Resend confirmation instructions
2
+
3
+ = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
4
+ = devise_error_messages!
5
+ .form-group
6
+ = f.label :email, class: 'form-label'
7
+ = f.email_field :email, autofocus: true, class: 'form-control'
8
+
9
+ .form-actions
10
+ = f.submit 'Resend confirmation instructions', class: 'btn btn-primary btn-lg'
11
+
12
+ = render 'devise/shared/links'
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @email %>!</p>
2
+
3
+ <p>You can confirm your account email through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password. You can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %></p>
@@ -0,0 +1,19 @@
1
+ .col-md-6.col-md-offset-3
2
+ h1.page-header Change your password
3
+
4
+ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
5
+ = devise_error_messages!
6
+ = f.hidden_field :reset_password_token
7
+
8
+ .form-group
9
+ = f.label :password, 'New password', class: 'form-label'
10
+ = f.password_field :password, autofocus: true, class: 'form-control'
11
+
12
+ .form-group
13
+ = f.label :password_confirmation, 'Confirm new password', class: 'form-label'
14
+ = f.password_field :password_confirmation, class: 'form-control'
15
+
16
+ .form-action
17
+ = f.submit 'Change my password', class: 'btn btn-primary btn-lg'
18
+
19
+ = render 'devise/shared/links'
@@ -0,0 +1,14 @@
1
+ .col-md-6.col-md-offset-3
2
+ h1.page-header Forgot your password?
3
+
4
+ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
5
+ = devise_error_messages!
6
+
7
+ .form-group
8
+ = f.label :email, class: 'form-label'
9
+ = f.email_field :email, autofocus: true, class: 'form-control'
10
+
11
+ .form-actions
12
+ = f.submit 'Send me reset password instructions', class: 'btn btn-primary btn-lg'
13
+
14
+ = render 'devise/shared/links'
@@ -0,0 +1,36 @@
1
+ .col-md-6.col-md-offset-3
2
+ h1.page-header Edit #{resource_name.to_s.humanize}
3
+
4
+ = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
5
+ = devise_error_messages!
6
+
7
+ .form-group
8
+ = f.label :email, class: 'form-label'
9
+ = f.email_field :email, autofocus: true, class: 'form-control'
10
+
11
+ - if devise_mapping.confirmable? && resource.pending_reconfirmation?
12
+ .alert.alert-success Currently waiting confirmation for: #{resource.unconfirmed_email}
13
+
14
+ .form-group
15
+ = f.label :password, class: 'form-label'
16
+ i (leave blank if you don't want to change it)
17
+ = f.password_field :password, autocomplete: "off", class: 'form-control'
18
+
19
+ .form-group
20
+ = f.label :password_confirmation, class: 'form-label'
21
+ = f.password_field :password_confirmation, class: 'form-control'
22
+
23
+ .form-group
24
+ = f.label :current_password, class: 'form-label'
25
+ i (we need your current password to confirm your changes)
26
+ = f.password_field :current_password, class: 'form-control'
27
+
28
+ = f.submit "Update", class: 'btn btn-primary btn-lg'
29
+
30
+ h3 Cancel my account
31
+
32
+ p
33
+ | Unhappy?
34
+ = button_to 'Cancel my account', registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger'
35
+
36
+ p = link_to 'Back', :back
@@ -0,0 +1,22 @@
1
+ .col-md-6.col-md-offset-3
2
+ h1.page-header Sign up
3
+
4
+ = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
5
+ = devise_error_messages!
6
+
7
+ .form-group
8
+ = f.label :email, class: 'form-label'
9
+ = f.email_field :email, autofocus: true, class: 'form-control'
10
+
11
+ .form-group
12
+ = f.label :password, class: 'form-label'
13
+ = f.password_field :password, class: 'form-control'
14
+
15
+ .form-group
16
+ = f.label :password_confirmation, class: 'form-label'
17
+ = f.password_field :password_confirmation, class: 'form-control'
18
+
19
+ .form-actions
20
+ = f.submit 'Sign up', class: 'btn btn-primary btn-lg'
21
+
22
+ = render 'devise/shared/links'