Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jw invites #32

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
*= require_self
*/

html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 100px; /* bottom = footer height */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you have 3 values for margin? I thought it was either two values (top/bottom left/right) or all four.

Also, instead of the comment, I'd extract an SCSS variable:

$footer-height: 100px; // this is a variable

body {
  margin: 0 0 $footer-height;
}

....

.footer-2 {
  ....
  height: $footer-height;
}

}
.footer-2 {
position: absolute;
left: 0;
bottom: 0;
height: 100px;
width: 100%;
}

@import "bourbon";
@import "bitters/bitters";
@import "neat";
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/invites_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class InvitesController < ApplicationController
def create
email = params[:email]
InviteMailer.invite_email(email).deliver
redirect_to root_path
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

10 changes: 10 additions & 0 deletions app/mailers/invite_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class InviteMailer < ActionMailer::Base
default from: "[email protected]"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.


def invite_email(email)
@email = email
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to set @email? It looks like you only use it on line 7 in mail(to:, so can you use the email parameter directly instead?

@url = 'http://dundermifflin.com'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used in the view? Should it be?

mail(to: @email, subject: 'Welcome to the Dunder Mifflin Family!')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth passing in or somehow setting the company name so that you can easily change it later.

end

end
2 changes: 2 additions & 0 deletions app/views/application/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<li><a href="javascript:void(0)">About</a></li>
<li><a href="javascript:void(0)">Contact</a></li>
<li><a href="javascript:void(0)">Products</a></li>
<li><%= link_to "Invite Users", invite_path %></li>
</ul>

<div class="footer-secondary-links">
Expand All @@ -15,3 +16,4 @@
</ul>
</div>
</footer>

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line

11 changes: 11 additions & 0 deletions app/views/invite_mailer/invite_email.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<h1>Welcome to Dunder Mifflin!</h1>
<p>
Head over to DunderMifflin.com and create your account!</p>
</body>
</html>
8 changes: 8 additions & 0 deletions app/views/pages/invite.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="invite">
<%= form_for(:invite, url: invite_path, method: :post) do |form| %>
<%= form.text_field :email, placeholder: "Enter Email Address" %>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything inside do |form|...end should be indented.

<button type="submit">
<img src="/search-icon.png" alt="">
</button>
<% end %>
</div>
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@

resource :job_title_users, only: ['create']

resource :invite, only: [:create]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line


end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@
t.string "remember_token", limit: 128, null: false
t.boolean "admin", default: false
t.string "name", limit: 50, null: false
t.integer "department_id"
t.text "address"
t.string "phone_number"
t.string "emergency_name"
t.string "emergency_number"
t.string "emergency_relation"
t.integer "department_id"
t.integer "office_branch_id"
end

Expand Down