-
Notifications
You must be signed in to change notification settings - Fork 0
Jw invites #32
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
base: master
Are you sure you want to change the base?
Jw invites #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| $footer-height: 100px; |
| 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 | ||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1 trailing blank lines detected. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| class InviteMailer < ActionMailer::Base | ||
| default from: "invite@dundermifflin.com" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"> | ||
|
|
@@ -15,3 +16,4 @@ | |
| </ul> | ||
| </div> | ||
| </footer> | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra line |
||
| 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> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <ul> | ||
| <li> | ||
| <%= link_to job_title.name %> | ||
| </li> | ||
| </ul> |
| 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> |
| 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 %> |
| 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 %> |
| 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 %> |
| 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> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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] | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra line |
||
|
|
||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.