Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/assets/images/mail-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/assets/stylesheets/_footer.css.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 $footer-height;
}


.footer-2 {

$footer-background: desaturate(darken($base-accent-color, 20), 30);
$footer-color: white;
$footer-link-color: transparentize($footer-color, .6);
Expand All @@ -8,6 +18,11 @@
padding: $base-line-height;
width: 100%;

position: absolute;
left: 0;
bottom: 0;
height: $footer-height;

.footer-logo {
margin-right: 1em;
margin-bottom: 1em;
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/_variables.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$footer-height: 100px;
4 changes: 2 additions & 2 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
*= require_self
*/


@import "bourbon";
@import "bitters/bitters";
@import "neat";
@import "variables";
@import "footer";
@import "header";
@import "employees";



.box {
padding-top: 30px;
}
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.

53 changes: 53 additions & 0 deletions app/controllers/job_titles_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
class JobTitlesController < ApplicationController
def index
@job_titles = JobTitle.all
end

def new
@job_title = JobTitle.new
end

def create
@job_title = JobTitle.new(job_title_params)
if @job_title.save
redirect_to @job_title
else
render :new
end
end

def show
@job_title = find_job_title
end

def edit
@job_title = find_job_title

Choose a reason for hiding this comment

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

Trailing whitespace detected.

end

def update
@job_title = find_job_title
if @job_title.update(job_title_params)
redirect_to root_path
else
render :edit
end
end

def destroy
job_title = find_job_title
job_title.destroy
redirect_to root_path
end

private

def job_title_params
params.require(:job_title).permit(:name)
end

def find_job_title
JobTitle.find(params[:id])
end

end

Choose a reason for hiding this comment

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

1 trailing blank lines detected.

8 changes: 8 additions & 0 deletions app/mailers/invite_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class InviteMailer < ActionMailer::Base
default from: "invite@dundermifflin.com"

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)
mail(to: email, subject: 'Welcome to the Dunder Mifflin Family!')
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>
5 changes: 5 additions & 0 deletions app/views/job_titles/_job_title.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ul>
<li>
<%= link_to job_title.name %>
</li>
</ul>
8 changes: 8 additions & 0 deletions app/views/job_titles/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<h2> Edit Job Title </h2>
<div>
<%= form_for(@job_title) do |form| %>
<%= render "form_errors", target: @job_title %>
<%= form.text_field :name, placeholder: "name" %>
<%= form.submit "Update Job Title" %>
<% end %>
</div>
7 changes: 7 additions & 0 deletions app/views/job_titles/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h2>Job Titles</h2>

<nav>
<%= link_to "Create Job title", new_job_title_path %>
</nav>
<br>
<%= render @job_titles %>
6 changes: 6 additions & 0 deletions app/views/job_titles/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h2>Create Job Title</h2>

<%= form_for(@job_title) do |form| %>
<%= form.text_field :name, placeholder: "Name" %>
<%= form.submit "Create Job Title" %>
<% end %>
5 changes: 5 additions & 0 deletions app/views/job_titles/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>Job Title: <%= @job_title.name %></h3>

<% @job_title.users.each do |employee| %>
<p><%= link_to image_tag(employee.profile.avatar), [employee, :profile] %></p>
<% end %>
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" %>
<button type="submit">
<img src="/images/mail-128.png" alt="">
</button>
<% end %>
</div>
6 changes: 5 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@

resources :topics, only: [:edit, :update, :destroy]

resource :job_title_users, only: ['create']
resource :job_title_users, only: [:create]

resources :job_titles

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