-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
249 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@import "bootstrap"; | ||
|
||
@import "layout"; | ||
@import "signin"; | ||
@import "signin"; | ||
@import "typography"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.color-success { color: #3C763D; } | ||
.extra-margin-top { margin-top: 40px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class User < ActiveRecord::Base | ||
devise :database_authenticatable, :recoverable, :rememberable, :validatable | ||
devise :invitable, :database_authenticatable, :recoverable, :rememberable, :validatable | ||
|
||
validates :name, presence: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="col-md-6 col-md-offset-3 panel panel-default"> | ||
<div class="panel-body"> | ||
<h2>Create an Account</h2> | ||
|
||
<%= simple_form_for resource, :as => resource_name, | ||
:url => invitation_path(resource_name), | ||
:html => { :method => :put } do |f| %> | ||
<%= f.input :invitation_token, as: :hidden %> | ||
<%= f.input :name %> | ||
<%= f.input :password %> | ||
<%= f.input :password_confirmation %> | ||
<%= f.button :submit, "Create Account", class: 'btn-primary' %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="col-md-6 col-md-offset-3 panel panel-default"> | ||
<div class="panel-body"> | ||
<h2>Send Invitation</h2> | ||
|
||
<%= simple_form_for resource, :as => resource_name, | ||
:url => invitation_path(resource_name), | ||
:html => {:method => :post} do |f| %> | ||
<%= f.input :email %> | ||
<%= f.button :submit, "Create Account", class: 'btn-primary' %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<p>Hello <%= @resource.email %>!</p> | ||
|
||
<p>Someone has invited you to <%= root_url %>, you can accept it through the link below.</p> | ||
|
||
<p><%= link_to 'Accept invitation', accept_invitation_url(@resource, :invitation_token => @token) %></p> | ||
|
||
<p>If you don't want to accept the invitation, please ignore this email.<br /> | ||
Your account won't be created until you access the link above and set your password.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
en: | ||
devise: | ||
invitations: | ||
send_instructions: 'An invitation email has been sent to %{email}.' | ||
invitation_token_invalid: 'The invitation token provided is not valid!' | ||
updated: 'Your account was created successfully. You are now signed in.' | ||
no_invitations_remaining: "No invitations remaining" | ||
invitation_removed: 'Your invitation was removed.' | ||
new: | ||
header: "Send invitation" | ||
submit_button: "Send an invitation" | ||
edit: | ||
header: "Set your password" | ||
submit_button: "Set my password" | ||
mailer: | ||
invitation_instructions: | ||
subject: 'Invitation instructions' |
26 changes: 26 additions & 0 deletions
26
db/migrate/20140414210524_devise_invitable_add_to_users.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class DeviseInvitableAddToUsers < ActiveRecord::Migration | ||
def up | ||
change_table :users do |t| | ||
t.string :invitation_token | ||
t.datetime :invitation_created_at | ||
t.datetime :invitation_sent_at | ||
t.datetime :invitation_accepted_at | ||
t.integer :invitation_limit | ||
t.references :invited_by, :polymorphic => true | ||
t.integer :invitations_count, default: 0 | ||
t.index :invitations_count | ||
t.index :invitation_token, :unique => true # for invitable | ||
t.index :invited_by_id | ||
end | ||
|
||
# And allow null encrypted_password and password_salt: | ||
change_column_null :users, :encrypted_password, true | ||
end | ||
|
||
def down | ||
change_table :users do |t| | ||
t.remove_references :invited_by, :polymorphic => true | ||
t.remove :invitations_count, :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token, :invitation_created_at | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.