From da36a01cb6dee9436f3639fc843780fe76f24f92 Mon Sep 17 00:00:00 2001 From: Jesse Waites Date: Wed, 23 Apr 2014 10:35:16 -0400 Subject: [PATCH 1/4] fixed sticky footer --- app/assets/stylesheets/application.css.scss | 15 +++++++++++++++ db/schema.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index c6a7c3b..f3d251b 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -12,6 +12,21 @@ *= require_self */ + html { + position: relative; + min-height: 100%; +} +body { + margin: 0 0 100px; /* bottom = footer height */ +} +.footer-2 { + position: absolute; + left: 0; + bottom: 0; + height: 100px; + width: 100%; +} + @import "bourbon"; @import "bitters/bitters"; @import "neat"; 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 From 6b66d93c3abdced37d51ef2ef66cb30cbd267e72 Mon Sep 17 00:00:00 2001 From: Jesse Waites Date: Wed, 23 Apr 2014 16:13:10 -0400 Subject: [PATCH 2/4] added ability to send invitations --- app/controllers/invites_controller.rb | 7 +++++++ app/mailers/invite_mailer.rb | 10 ++++++++++ app/views/application/_footer.html.erb | 2 ++ app/views/invite_mailer/invite_email.html.erb | 11 +++++++++++ app/views/pages/invite.html.erb | 8 ++++++++ config/routes.rb | 2 ++ 6 files changed, 40 insertions(+) create mode 100644 app/controllers/invites_controller.rb create mode 100644 app/mailers/invite_mailer.rb create mode 100644 app/views/invite_mailer/invite_email.html.erb create mode 100644 app/views/pages/invite.html.erb 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/mailers/invite_mailer.rb b/app/mailers/invite_mailer.rb new file mode 100644 index 0000000..b461d4d --- /dev/null +++ b/app/mailers/invite_mailer.rb @@ -0,0 +1,10 @@ +class InviteMailer < ActionMailer::Base + default from: "invite@dundermifflin.com" + + def invite_email(email) + @email = email + @url = 'http://dundermifflin.com' + 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/pages/invite.html.erb b/app/views/pages/invite.html.erb new file mode 100644 index 0000000..159f5a4 --- /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..56dfad3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,5 +32,7 @@ resource :job_title_users, only: ['create'] + resource :invite, only: [:create] + end From a66598c82b2e684adb41574d25aaa7339901fa30 Mon Sep 17 00:00:00 2001 From: Jesse Waites Date: Thu, 24 Apr 2014 11:27:14 -0400 Subject: [PATCH 3/4] added ability to create job titles --- app/assets/images/mail-128.png | Bin 0 -> 1048 bytes app/controllers/job_titles_controller.rb | 53 +++++++++++++++++++++++ app/mailers/invite_mailer.rb | 4 +- app/views/job_titles/_job_title.html.erb | 5 +++ app/views/job_titles/edit.html.erb | 8 ++++ app/views/job_titles/index.html.erb | 7 +++ app/views/job_titles/new.html.erb | 6 +++ app/views/job_titles/show.html.erb | 5 +++ app/views/pages/invite.html.erb | 16 +++---- config/routes.rb | 4 +- 10 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 app/assets/images/mail-128.png create mode 100644 app/controllers/job_titles_controller.rb create mode 100644 app/views/job_titles/_job_title.html.erb create mode 100644 app/views/job_titles/edit.html.erb create mode 100644 app/views/job_titles/index.html.erb create mode 100644 app/views/job_titles/new.html.erb create mode 100644 app/views/job_titles/show.html.erb diff --git a/app/assets/images/mail-128.png b/app/assets/images/mail-128.png new file mode 100644 index 0000000000000000000000000000000000000000..6b21e4a996665d05f079b073d9606fbc9964a144 GIT binary patch literal 1048 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSY)RhkE)4%caKYZ?lNlJ8&w9Ez zhE&XXdsnwVCRO6t$N$r~gbci$WV@C~1RPcFRyepp>}2?Xi4T5>PKb~(U8^l8!YPq; zKv6-!Ltqb2(l^etMeom5o_qay&hP);eY59UK0k9cCVcx`9*;>Xo=~)8uO%~I^!%1> z#o4cgFKpv+C}LBvWS%gG(c>J0N;<=l#6ur>3(EfnUt7BSz;>T%e)Yc}7=Q3qqu{d6cQ|`wzzB)pp0L%}-CB@>sB7-;JfO=RCHZ_u1C^ zXG8l`{}*}@$Fi?{|NER-uJ{vU`hoTX@uK=~^k#(T-v7^8bD;kJ4RcL~qqPr~cTFx3 z_c34gzMkdYu0KB`nHfH4eJDM8Ql>z>rSI5G!fj zzWz004WE+UHCYvZt4+DeAo8y1^0XJfPpC06lppksOPaZ_KSzwAK-^{8o8KpvF>0tk z(6iXZP?!FrcE#J@C!R5C7`<=W`pfQ;4}-#UJ&DWT**;qINhE9YbVfz5{88M-49Y9aF$*- zO26+ui=UzAHmkp7S&sHQ#{0qLyv5&Zmvl2s5tiM|trupsfA*G3-zVlV1$^1U9rgOR zM>%7IUD-j|TR`S?#)fU>2W=m;pDK<9+IN?Y;np2iU7+sQ3?jO3n&f`jZR%z?uxU;@*8^F(3<)!1FBIQ*FOy}M zQ7*p6^FC0pmLXwY?1uJz{Yy9;KI(nYK79Yk{>J`>{*}M~SM6tbzox`Dcqtdi2d3_) zYvnz~86>uIx5=#iUaOMIkZ?zD$GaCx-z#S_2kh~^`<{E9+}eMC>sEYWZ1}i)!S;Rq z5)Iy4cP}^&Vx;o`9rnHU2m{Ny+pK#*jF`u-^lmuccjr04drI$y_kDLiwuBSn?(=jj z+oX3N-Pc@q?Bn%2*LUr`)Vbx=vDuRw?@LaBrRYh<3@0TUo}edm5{0EdJ-i^cf3g4J tIe${VPv~#YKE4LiOn4>(GRmICACHO*nfCXV1u&~Kc)I$ztaD0e0ssLz +
  • + <%= link_to job_title.name %> +
  • + 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..2085d21 --- /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 employee.name, employee %>

    +<% end %> diff --git a/app/views/pages/invite.html.erb b/app/views/pages/invite.html.erb index 159f5a4..e1b6054 100644 --- a/app/views/pages/invite.html.erb +++ b/app/views/pages/invite.html.erb @@ -1,8 +1,8 @@ -
    - <%= form_for(:invite, url: invite_path, method: :post) do |form| %> - <%= form.text_field :email, placeholder: "Enter Email Address" %> - - <% end %> -
    +
    + <%= 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 56dfad3..9b7aa79 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,7 +30,9 @@ 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] From 72c0fcbb359a637592e350557946889d5bc4303e Mon Sep 17 00:00:00 2001 From: Jesse Waites Date: Thu, 24 Apr 2014 14:44:59 -0400 Subject: [PATCH 4/4] refactoring with gabe --- app/assets/stylesheets/_footer.css.scss | 15 +++++++++++++++ app/assets/stylesheets/_variables.css.scss | 1 + app/assets/stylesheets/application.css.scss | 17 +---------------- app/views/job_titles/show.html.erb | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 app/assets/stylesheets/_variables.css.scss 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 f3d251b..2a6895b 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -12,30 +12,15 @@ *= require_self */ - html { - position: relative; - min-height: 100%; -} -body { - margin: 0 0 100px; /* bottom = footer height */ -} -.footer-2 { - position: absolute; - left: 0; - bottom: 0; - height: 100px; - width: 100%; -} @import "bourbon"; @import "bitters/bitters"; @import "neat"; +@import "variables"; @import "footer"; @import "header"; @import "employees"; - - .box { padding-top: 30px; } diff --git a/app/views/job_titles/show.html.erb b/app/views/job_titles/show.html.erb index 2085d21..d838bf9 100644 --- a/app/views/job_titles/show.html.erb +++ b/app/views/job_titles/show.html.erb @@ -1,5 +1,5 @@

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

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

    <%= link_to employee.name, employee %>

    +

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

    <% end %>