Xwitter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.babelrc +26 -0
  3. data/.gitignore +19 -0
  4. data/.postcssrc.yml +3 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +44 -0
  7. data/Gemfile.lock +247 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +35 -0
  10. data/Rakefile +7 -0
  11. data/Schemafile +40 -0
  12. data/Xwitter.gemspec +28 -0
  13. data/app/assets/config/manifest.js +3 -0
  14. data/app/assets/images/.keep +0 -0
  15. data/app/assets/javascripts/application.js +16 -0
  16. data/app/assets/javascripts/cable.js +13 -0
  17. data/app/assets/javascripts/channels/.keep +0 -0
  18. data/app/assets/javascripts/messages.coffee +3 -0
  19. data/app/assets/javascripts/users.coffee +3 -0
  20. data/app/assets/stylesheets/application.css +15 -0
  21. data/app/assets/stylesheets/messages.scss +3 -0
  22. data/app/assets/stylesheets/scaffolds.scss +84 -0
  23. data/app/assets/stylesheets/users.scss +3 -0
  24. data/app/channels/application_cable/channel.rb +4 -0
  25. data/app/channels/application_cable/connection.rb +4 -0
  26. data/app/controllers/application_controller.rb +2 -0
  27. data/app/controllers/concerns/.keep +0 -0
  28. data/app/controllers/messages_controller.rb +79 -0
  29. data/app/controllers/profiles_controller.rb +48 -0
  30. data/app/helpers/application_helper.rb +2 -0
  31. data/app/helpers/messages_helper.rb +2 -0
  32. data/app/helpers/users_helper.rb +2 -0
  33. data/app/javascript/components/.gitkeep +0 -0
  34. data/app/javascript/packs/application.js +14 -0
  35. data/app/javascript/packs/application.scss +1 -0
  36. data/app/javascript/packs/hello_react.jsx +26 -0
  37. data/app/javascript/packs/hello_typescript.ts +4 -0
  38. data/app/javascript/packs/server_rendering.js +5 -0
  39. data/app/jobs/application_job.rb +2 -0
  40. data/app/mailers/application_mailer.rb +4 -0
  41. data/app/models/application_record.rb +3 -0
  42. data/app/models/concerns/.keep +0 -0
  43. data/app/models/message.rb +4 -0
  44. data/app/models/user.rb +6 -0
  45. data/app/views/layouts/application.html.slim +16 -0
  46. data/app/views/layouts/mailer.html.erb +13 -0
  47. data/app/views/layouts/mailer.text.erb +1 -0
  48. data/app/views/messages/_form.html.slim +12 -0
  49. data/app/views/messages/_index.html.slim +12 -0
  50. data/app/views/messages/_message.json.jbuilder +2 -0
  51. data/app/views/messages/_show.html.slim +11 -0
  52. data/app/views/messages/edit.html.slim +8 -0
  53. data/app/views/messages/index.html.slim +20 -0
  54. data/app/views/messages/index.json.jbuilder +1 -0
  55. data/app/views/messages/new.html.slim +5 -0
  56. data/app/views/messages/show.html.slim +9 -0
  57. data/app/views/messages/show.json.jbuilder +1 -0
  58. data/app/views/profiles/_form.html.slim +15 -0
  59. data/app/views/profiles/_user.json.jbuilder +2 -0
  60. data/app/views/profiles/edit.html.slim +5 -0
  61. data/app/views/profiles/show.html.slim +8 -0
  62. data/app/views/profiles/show.json.jbuilder +1 -0
  63. data/app/views/users/confirmations/new.html.erb +16 -0
  64. data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  65. data/app/views/users/mailer/email_changed.html.erb +7 -0
  66. data/app/views/users/mailer/password_change.html.erb +3 -0
  67. data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  68. data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  69. data/app/views/users/passwords/edit.html.erb +25 -0
  70. data/app/views/users/passwords/new.html.erb +16 -0
  71. data/app/views/users/registrations/edit.html.erb +43 -0
  72. data/app/views/users/registrations/new.html.erb +29 -0
  73. data/app/views/users/sessions/new.html.slim +16 -0
  74. data/app/views/users/shared/_links.html.slim +21 -0
  75. data/app/views/users/unlocks/new.html.erb +16 -0
  76. data/bin/bundle +3 -0
  77. data/bin/console +14 -0
  78. data/bin/rails +9 -0
  79. data/bin/rake +9 -0
  80. data/bin/setup +8 -0
  81. data/bin/spring +17 -0
  82. data/bin/update +31 -0
  83. data/bin/webpack +15 -0
  84. data/bin/webpack-dev-server +15 -0
  85. data/bin/yarn +11 -0
  86. data/config/application.rb +19 -0
  87. data/config/boot.rb +4 -0
  88. data/config/cable.yml +10 -0
  89. data/config/credentials.yml.enc +1 -0
  90. data/config/database.yml +26 -0
  91. data/config/environment.rb +5 -0
  92. data/config/environments/development.rb +63 -0
  93. data/config/environments/production.rb +96 -0
  94. data/config/environments/test.rb +46 -0
  95. data/config/initializers/application_controller_renderer.rb +8 -0
  96. data/config/initializers/assets.rb +14 -0
  97. data/config/initializers/backtrace_silencers.rb +7 -0
  98. data/config/initializers/content_security_policy.rb +25 -0
  99. data/config/initializers/cookies_serializer.rb +5 -0
  100. data/config/initializers/devise.rb +290 -0
  101. data/config/initializers/filter_parameter_logging.rb +4 -0
  102. data/config/initializers/inflections.rb +16 -0
  103. data/config/initializers/mime_types.rb +4 -0
  104. data/config/initializers/wrap_parameters.rb +14 -0
  105. data/config/locales/devise.en.yml +64 -0
  106. data/config/locales/en.yml +33 -0
  107. data/config/puma.rb +34 -0
  108. data/config/routes.rb +7 -0
  109. data/config/spring.rb +6 -0
  110. data/config/storage.yml +34 -0
  111. data/config/webpack/development.js +5 -0
  112. data/config/webpack/environment.js +5 -0
  113. data/config/webpack/loaders/typescript.js +6 -0
  114. data/config/webpack/production.js +5 -0
  115. data/config/webpack/test.js +5 -0
  116. data/config/webpacker.yml +71 -0
  117. data/config.ru +5 -0
  118. data/db/seeds.rb +7 -0
  119. data/lib/Xwitter/version.rb +3 -0
  120. data/lib/Xwitter.rb +6 -0
  121. data/lib/assets/.keep +0 -0
  122. data/lib/tasks/.keep +0 -0
  123. data/log/.keep +0 -0
  124. data/package.json +20 -0
  125. data/public/404.html +67 -0
  126. data/public/422.html +67 -0
  127. data/public/500.html +66 -0
  128. data/public/apple-touch-icon-precomposed.png +0 -0
  129. data/public/apple-touch-icon.png +0 -0
  130. data/public/favicon.ico +0 -0
  131. data/public/robots.txt +1 -0
  132. data/storage/.keep +0 -0
  133. data/tsconfig.json +20 -0
  134. data/vendor/.keep +0 -0
  135. data/yarn.lock +6051 -0
  136. metadata +206 -0
@@ -0,0 +1,79 @@
1
+ class MessagesController < ApplicationController
2
+ before_action :set_message, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /messages
5
+ # GET /messages.json
6
+ def index
7
+ if user_signed_in? && current_user.name.blank?
8
+ redirect_to edit_profile_url
9
+ return
10
+ end
11
+ @messages = Message.all
12
+ end
13
+
14
+ # GET /messages/1
15
+ # GET /messages/1.json
16
+ def show
17
+ end
18
+
19
+ # GET /messages/new
20
+ def new
21
+ @message = Message.new
22
+ end
23
+
24
+ # GET /messages/1/edit
25
+ def edit
26
+ end
27
+
28
+ # POST /messages
29
+ # POST /messages.json
30
+ def create
31
+ @message = Message.new(message_params)
32
+ @message.user = current_user
33
+
34
+ respond_to do |format|
35
+ if @message.save
36
+ format.html { redirect_to @message, notice: 'Message was successfully created.' }
37
+ format.json { render :show, status: :created, location: @message }
38
+ else
39
+ format.html { render :new }
40
+ format.json { render json: @message.errors, status: :unprocessable_entity }
41
+ end
42
+ end
43
+ end
44
+
45
+ # PATCH/PUT /messages/1
46
+ # PATCH/PUT /messages/1.json
47
+ def update
48
+ respond_to do |format|
49
+ if @message.update(message_params)
50
+ format.html { redirect_to @message, notice: 'Message was successfully updated.' }
51
+ format.json { render :show, status: :ok, location: @message }
52
+ else
53
+ format.html { render :edit }
54
+ format.json { render json: @message.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # DELETE /messages/1
60
+ # DELETE /messages/1.json
61
+ def destroy
62
+ @message.destroy
63
+ respond_to do |format|
64
+ format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }
65
+ format.json { head :no_content }
66
+ end
67
+ end
68
+
69
+ private
70
+ # Use callbacks to share common setup or constraints between actions.
71
+ def set_message
72
+ @message = Message.find(params[:id])
73
+ end
74
+
75
+ # Never trust parameters from the scary internet, only allow the white list through.
76
+ def message_params
77
+ params.require(:message).permit(:text)
78
+ end
79
+ end
@@ -0,0 +1,48 @@
1
+ class ProfilesController < ApplicationController
2
+ before_action :set_user, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /users/1
5
+ # GET /users/1.json
6
+ def show
7
+ @user = User.find_by(name: params[:username])
8
+ end
9
+
10
+ # GET /users/1/edit
11
+ def edit
12
+ end
13
+
14
+ # PATCH/PUT /users/1
15
+ # PATCH/PUT /users/1.json
16
+ def update
17
+ respond_to do |format|
18
+ if @user.update(user_params)
19
+ format.html { redirect_to root_url, notice: 'User was successfully updated.' }
20
+ format.json { render :show, status: :ok, location: @user }
21
+ else
22
+ format.html { render :edit }
23
+ format.json { render json: @user.errors, status: :unprocessable_entity }
24
+ end
25
+ end
26
+ end
27
+
28
+ # DELETE /users/1
29
+ # DELETE /users/1.json
30
+ def destroy
31
+ @user.destroy
32
+ respond_to do |format|
33
+ format.html { redirect_to root_url, notice: 'User was successfully destroyed.' }
34
+ format.json { head :no_content }
35
+ end
36
+ end
37
+
38
+ private
39
+ # Use callbacks to share common setup or constraints between actions.
40
+ def set_user
41
+ @user = current_user
42
+ end
43
+
44
+ # Never trust parameters from the scary internet, only allow the white list through.
45
+ def user_params
46
+ params.require(:user).permit(:name, :screen_name)
47
+ end
48
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module MessagesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
File without changes
@@ -0,0 +1,14 @@
1
+ /* eslint no-console:0 */
2
+ // This file is automatically compiled by Webpack, along with any other files
3
+ // present in this directory. You're encouraged to place your actual application logic in
4
+ // a relevant structure within app/javascript and only use these pack files to reference
5
+ // that code so it'll be compiled.
6
+ //
7
+ // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8
+ // layout file, like app/views/layouts/application.html.erb
9
+
10
+ console.log('Hello World from Webpacker')
11
+ // Support component names relative to this directory:
12
+ var componentRequireContext = require.context("components", true)
13
+ var ReactRailsUJS = require("react_ujs")
14
+ ReactRailsUJS.useContext(componentRequireContext)
@@ -0,0 +1 @@
1
+ @import '~bootstrap/dist/css/bootstrap'
@@ -0,0 +1,26 @@
1
+ // Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2
+ // like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
3
+ // of the page.
4
+
5
+ import React from 'react'
6
+ import ReactDOM from 'react-dom'
7
+ import PropTypes from 'prop-types'
8
+
9
+ const Hello = props => (
10
+ <div>Hello {props.name}!</div>
11
+ )
12
+
13
+ Hello.defaultProps = {
14
+ name: 'David'
15
+ }
16
+
17
+ Hello.propTypes = {
18
+ name: PropTypes.string
19
+ }
20
+
21
+ document.addEventListener('DOMContentLoaded', () => {
22
+ ReactDOM.render(
23
+ <Hello name="React" />,
24
+ document.body.appendChild(document.createElement('div')),
25
+ )
26
+ })
@@ -0,0 +1,4 @@
1
+ // Run this example by adding <%= javascript_pack_tag 'hello_typescript' %> to the head of your layout file,
2
+ // like app/views/layouts/application.html.erb.
3
+
4
+ console.log('Hello world from typescript');
@@ -0,0 +1,5 @@
1
+ // By default, this pack is loaded for server-side rendering.
2
+ // It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
3
+ var componentRequireContext = require.context("components", true)
4
+ var ReactRailsUJS = require("react_ujs")
5
+ ReactRailsUJS.useContext(componentRequireContext)
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ class Message < ApplicationRecord
2
+ belongs_to :user
3
+ validates :text, length: { maximum: 140 }
4
+ end
@@ -0,0 +1,6 @@
1
+ class User < ApplicationRecord
2
+ # Include default devise modules. Others available are:
3
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
4
+ devise :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :validatable
6
+ end
@@ -0,0 +1,16 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title Xwitter
5
+ = csrf_meta_tags
6
+ = csp_meta_tag
7
+ = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
8
+ = javascript_pack_tag 'application'
9
+ = stylesheet_pack_tag 'application'
10
+ = stylesheet_link_tag 'https://cdnjs.cloudflare.com/ajax/libs/open-iconic/1.1.1/font/css/open-iconic-bootstrap.min.css'
11
+ body
12
+ .navbar
13
+ = link_to '/', root_path
14
+
15
+ .container
16
+ = yield
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,12 @@
1
+ = form_for @message do |f|
2
+ - if @message.errors.any?
3
+ #error_explanation
4
+ h2 = "#{pluralize(@message.errors.count, "error")} prohibited this message from being saved:"
5
+ ul
6
+ - @message.errors.full_messages.each do |message|
7
+ li = message
8
+
9
+ .field
10
+ = f.label :text
11
+ = f.text_area :text
12
+ .actions = f.submit
@@ -0,0 +1,12 @@
1
+ - messages.each do |message|
2
+ div
3
+ p
4
+ = message.user.screen_name
5
+ | &nbsp;
6
+ = link_to '@' + message.user.name, '/' + message.user.name
7
+
8
+ p= message.text
9
+ p= l message.created_at
10
+ - if user_signed_in? && message.user == current_user
11
+ .oi.oi-trash
12
+ = link_to 'Destroy', message, data: { confirm: 'Are you sure?' }, method: :delete
@@ -0,0 +1,2 @@
1
+ json.extract! message, :id, :text, :created_at, :updated_at
2
+ json.url message_url(message, format: :json)
@@ -0,0 +1,11 @@
1
+ div
2
+ p
3
+ = message.user.screen_name
4
+ | &nbsp;
5
+ = link_to '@' + message.user.name, '/' + message.user.name
6
+
7
+ p= message.text
8
+ p= l message.created_at
9
+ - if user_signed_in? && message.user == current_user
10
+ .oi.oi-trash
11
+ = link_to 'Destroy', message, data: { confirm: 'Are you sure?' }, method: :delete
@@ -0,0 +1,8 @@
1
+ h1 Editing message
2
+
3
+ == render 'form'
4
+
5
+ => link_to 'Show', @message
6
+ '|
7
+ =< link_to 'Back', messages_path
8
+
@@ -0,0 +1,20 @@
1
+ h1
2
+ | Xwitter&nbsp;
3
+ - if user_signed_in?
4
+ = link_to 'New Message', new_message_path, class: 'btn btn-primary'
5
+ - else
6
+ = link_to 'Sign in', new_user_session_path, class: 'btn btn-primary'
7
+ = link_to 'Sign up', new_user_registration_path, class: 'btn btn-default'
8
+
9
+ - @messages.each do |message|
10
+ div
11
+ p
12
+ = message.user.screen_name
13
+ | &nbsp;
14
+ = link_to '@' + message.user.name, '/' + message.user.name
15
+
16
+ p= message.text
17
+ p= l message.created_at
18
+ - if user_signed_in? && message.user == current_user
19
+ .oi.oi-trash
20
+ = link_to 'Destroy', message, data: { confirm: 'Are you sure?' }, method: :delete
@@ -0,0 +1 @@
1
+ json.array! @messages, partial: 'messages/message', as: :message
@@ -0,0 +1,5 @@
1
+ h1 New message
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Back', messages_path
@@ -0,0 +1,9 @@
1
+ p#notice = notice
2
+
3
+ p
4
+ strong Text:
5
+ = @message.text
6
+
7
+ => link_to 'Edit', edit_message_path(@message)
8
+ '|
9
+ =< link_to 'Back', messages_path
@@ -0,0 +1 @@
1
+ json.partial! "messages/message", message: @message
@@ -0,0 +1,15 @@
1
+ = form_for @user, url: profile_path do |f|
2
+ - if @user.errors.any?
3
+ #error_explanation
4
+ h2 = "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:"
5
+ ul
6
+ - @user.errors.full_messages.each do |message|
7
+ li = message
8
+
9
+ .field
10
+ = f.label :name
11
+ = f.text_field :name
12
+ .field
13
+ = f.label :screen_name
14
+ = f.text_field :screen_name
15
+ .actions = f.submit
@@ -0,0 +1,2 @@
1
+ json.extract! user, :id, :name, :screen_name, :created_at, :updated_at
2
+ json.url user_url(user, format: :json)
@@ -0,0 +1,5 @@
1
+ h1 Editing profile
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Back', root_path
@@ -0,0 +1,8 @@
1
+ h2
2
+ = @user.screen_name
3
+ | &nbsp;
4
+ small= '@' + @user.name
5
+ - if @user == current_user
6
+ = link_to 'Edit', edit_profile_path, class: 'btn'
7
+
8
+ = render 'messages/index', messages: Message.where(user: @user)
@@ -0,0 +1 @@
1
+ json.partial! "users/user", user: @user
@@ -0,0 +1,16 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend confirmation instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "users/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,7 @@
1
+ <p>Hello <%= @email %>!</p>
2
+
3
+ <% if @resource.try(:unconfirmed_email?) %>
4
+ <p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
5
+ <% else %>
6
+ <p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
7
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>We're contacting you to notify you that your password has been changed.</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,25 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <div class="field">
8
+ <%= f.label :password, "New password" %><br />
9
+ <% if @minimum_password_length %>
10
+ <em>(<%= @minimum_password_length %> characters minimum)</em><br />
11
+ <% end %>
12
+ <%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
13
+ </div>
14
+
15
+ <div class="field">
16
+ <%= f.label :password_confirmation, "Confirm new password" %><br />
17
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
18
+ </div>
19
+
20
+ <div class="actions">
21
+ <%= f.submit "Change my password" %>
22
+ </div>
23
+ <% end %>
24
+
25
+ <%= render "users/shared/links" %>
@@ -0,0 +1,16 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Send me reset password instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "users/shared/links" %>
@@ -0,0 +1,43 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
12
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
13
+ <% end %>
14
+
15
+ <div class="field">
16
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
17
+ <%= f.password_field :password, autocomplete: "new-password" %>
18
+ <% if @minimum_password_length %>
19
+ <br />
20
+ <em><%= @minimum_password_length %> characters minimum</em>
21
+ <% end %>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= f.label :password_confirmation %><br />
26
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
31
+ <%= f.password_field :current_password, autocomplete: "current-password" %>
32
+ </div>
33
+
34
+ <div class="actions">
35
+ <%= f.submit "Update" %>
36
+ </div>
37
+ <% end %>
38
+
39
+ <h3>Cancel my account</h3>
40
+
41
+ <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
42
+
43
+ <%= link_to "Back", :back %>
@@ -0,0 +1,29 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :password %>
13
+ <% if @minimum_password_length %>
14
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
15
+ <% end %><br />
16
+ <%= f.password_field :password, autocomplete: "new-password" %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= f.label :password_confirmation %><br />
21
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
22
+ </div>
23
+
24
+ <div class="actions">
25
+ <%= f.submit "Sign up" %>
26
+ </div>
27
+ <% end %>
28
+
29
+ <%= render "users/shared/links" %>
@@ -0,0 +1,16 @@
1
+ h2 Log in
2
+
3
+ = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
4
+ .field
5
+ = f.label :email
6
+ = f.email_field :email, autofocus: true, autocomplete: "email"
7
+ .field
8
+ = f.label :password
9
+ = f.password_field :password, autocomplete: "current-password"
10
+ .field
11
+ = f.check_box :remember_me
12
+ = f.label :remember_me
13
+ .actions
14
+ = f.submit "Log in"
15
+
16
+ = render "users/shared/links"
@@ -0,0 +1,21 @@
1
+ - if controller_name != 'sessions'
2
+ = link_to "Log in", new_session_path(resource_name)
3
+ br
4
+ - if devise_mapping.registerable? && controller_name != 'registrations'
5
+ = link_to "Sign up", new_registration_path(resource_name)
6
+ br
7
+ - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
8
+ = link_to "Forgot your password?", new_password_path(resource_name)
9
+ br
10
+ - if devise_mapping.confirmable? && controller_name != 'confirmations'
11
+ = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
12
+ br
13
+ - if devise_mapping.lockable? && \
14
+ resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
15
+ = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
16
+ br
17
+ - if devise_mapping.omniauthable?
18
+ - resource_class.omniauth_providers.each do |provider|
19
+ = link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}",
20
+ omniauth_authorize_path(resource_name, provider)
21
+ br
@@ -0,0 +1,16 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend unlock instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "users/shared/links" %>
data/bin/bundle ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+ load Gem.bin_path('bundler', 'bundle')