diff --git a/app/assets/images/mail-128.png b/app/assets/images/mail-128.png new file mode 100644 index 0000000..6b21e4a Binary files /dev/null and b/app/assets/images/mail-128.png differ diff --git a/app/assets/stylesheets/_footer.css.scss b/app/assets/stylesheets/_footer.css.scss index fd26682..64a97f7 100644 --- a/app/assets/stylesheets/_footer.css.scss +++ b/app/assets/stylesheets/_footer.css.scss @@ -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); @@ -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; diff --git a/app/assets/stylesheets/_variables.css.scss b/app/assets/stylesheets/_variables.css.scss new file mode 100644 index 0000000..83ba7c9 --- /dev/null +++ b/app/assets/stylesheets/_variables.css.scss @@ -0,0 +1 @@ +$footer-height: 100px; diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index c6a7c3b..2a6895b 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -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; } diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb new file mode 100644 index 0000000..4b8d543 --- /dev/null +++ b/app/controllers/invites_controller.rb @@ -0,0 +1,7 @@ +class InvitesController < ApplicationController + def create + email = params[:email] + InviteMailer.invite_email(email).deliver + redirect_to root_path + end +end diff --git a/app/controllers/job_titles_controller.rb b/app/controllers/job_titles_controller.rb new file mode 100644 index 0000000..d4a1252 --- /dev/null +++ b/app/controllers/job_titles_controller.rb @@ -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 + 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 + diff --git a/app/mailers/invite_mailer.rb b/app/mailers/invite_mailer.rb new file mode 100644 index 0000000..9c74134 --- /dev/null +++ b/app/mailers/invite_mailer.rb @@ -0,0 +1,8 @@ +class InviteMailer < ActionMailer::Base + default from: "invite@dundermifflin.com" + + def invite_email(email) + mail(to: email, subject: 'Welcome to the Dunder Mifflin Family!') + end + +end diff --git a/app/views/application/_footer.html.erb b/app/views/application/_footer.html.erb index 7511fd5..416958c 100644 --- a/app/views/application/_footer.html.erb +++ b/app/views/application/_footer.html.erb @@ -6,6 +6,7 @@
  • About
  • Contact
  • Products
  • +
  • <%= link_to "Invite Users", invite_path %>
  • + diff --git a/app/views/invite_mailer/invite_email.html.erb b/app/views/invite_mailer/invite_email.html.erb new file mode 100644 index 0000000..3cfcfbf --- /dev/null +++ b/app/views/invite_mailer/invite_email.html.erb @@ -0,0 +1,11 @@ + + + + + + +

    Welcome to Dunder Mifflin!

    +

    + Head over to DunderMifflin.com and create your account!

    + + diff --git a/app/views/job_titles/_job_title.html.erb b/app/views/job_titles/_job_title.html.erb new file mode 100644 index 0000000..7e15ccf --- /dev/null +++ b/app/views/job_titles/_job_title.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/job_titles/edit.html.erb b/app/views/job_titles/edit.html.erb new file mode 100644 index 0000000..ea85fc3 --- /dev/null +++ b/app/views/job_titles/edit.html.erb @@ -0,0 +1,8 @@ +

    Edit Job Title

    +
    + <%= form_for(@job_title) do |form| %> + <%= render "form_errors", target: @job_title %> + <%= form.text_field :name, placeholder: "name" %> + <%= form.submit "Update Job Title" %> + <% end %> +
    diff --git a/app/views/job_titles/index.html.erb b/app/views/job_titles/index.html.erb new file mode 100644 index 0000000..62b01e9 --- /dev/null +++ b/app/views/job_titles/index.html.erb @@ -0,0 +1,7 @@ +

    Job Titles

    + + +
    +<%= render @job_titles %> diff --git a/app/views/job_titles/new.html.erb b/app/views/job_titles/new.html.erb new file mode 100644 index 0000000..74e8b4b --- /dev/null +++ b/app/views/job_titles/new.html.erb @@ -0,0 +1,6 @@ +

    Create Job Title

    + +<%= form_for(@job_title) do |form| %> + <%= form.text_field :name, placeholder: "Name" %> + <%= form.submit "Create Job Title" %> +<% end %> diff --git a/app/views/job_titles/show.html.erb b/app/views/job_titles/show.html.erb new file mode 100644 index 0000000..d838bf9 --- /dev/null +++ b/app/views/job_titles/show.html.erb @@ -0,0 +1,5 @@ +

    Job Title: <%= @job_title.name %>

    + +<% @job_title.users.each do |employee| %> +

    <%= link_to image_tag(employee.profile.avatar), [employee, :profile] %>

    +<% end %> diff --git a/app/views/pages/invite.html.erb b/app/views/pages/invite.html.erb new file mode 100644 index 0000000..e1b6054 --- /dev/null +++ b/app/views/pages/invite.html.erb @@ -0,0 +1,8 @@ +
    + <%= form_for(:invite, url: invite_path, method: :post) do |form| %> + <%= form.text_field :email, placeholder: "Enter Email Address" %> + + <% end %> +
    diff --git a/config/routes.rb b/config/routes.rb index 337efab..9b7aa79 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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] end diff --git a/db/schema.rb b/db/schema.rb index 45dff21..12487f3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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