From da0250ca69e91c2fec5cba01ba1c8a4aa52bb421 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:10:50 -0400 Subject: [PATCH 01/11] Add default gitignore --- .gitignore | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4fa1c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +.DS_Store +.env +*.db + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalisation: +/.bundle/ +/lib/bundler/man/ + +.rvmrc From 83da5ced5b6a4b574dac977976aa0ea7874c6dd9 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:13:47 -0400 Subject: [PATCH 02/11] Add Gemfile with gems for data model: - Data Mapper - SQLite3 - dotenv --- Gemfile | 14 +++++++++ Gemfile.lock | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a0795b4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,14 @@ +source 'https://rubygems.org' + +gem 'data_mapper' + +group :development do + gem 'sqlite3' + gem 'dm-sqlite-adapter' + gem 'dotenv' +end + +group :production do + gem 'dm-postgres-adapter' + gem 'pg' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..e78600e --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,80 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.3.6) + bcrypt (3.1.9) + bcrypt-ruby (3.1.5) + bcrypt (>= 3.1.3) + data_mapper (1.2.0) + dm-aggregates (~> 1.2.0) + dm-constraints (~> 1.2.0) + dm-core (~> 1.2.0) + dm-migrations (~> 1.2.0) + dm-serializer (~> 1.2.0) + dm-timestamps (~> 1.2.0) + dm-transactions (~> 1.2.0) + dm-types (~> 1.2.0) + dm-validations (~> 1.2.0) + data_objects (0.10.14) + addressable (~> 2.1) + dm-aggregates (1.2.0) + dm-core (~> 1.2.0) + dm-constraints (1.2.0) + dm-core (~> 1.2.0) + dm-core (1.2.1) + addressable (~> 2.3) + dm-do-adapter (1.2.0) + data_objects (~> 0.10.6) + dm-core (~> 1.2.0) + dm-migrations (1.2.0) + dm-core (~> 1.2.0) + dm-postgres-adapter (1.2.0) + dm-do-adapter (~> 1.2.0) + do_postgres (~> 0.10.6) + dm-serializer (1.2.2) + dm-core (~> 1.2.0) + fastercsv (~> 1.5) + json (~> 1.6) + json_pure (~> 1.6) + multi_json (~> 1.0) + dm-sqlite-adapter (1.2.0) + dm-do-adapter (~> 1.2.0) + do_sqlite3 (~> 0.10.6) + dm-timestamps (1.2.0) + dm-core (~> 1.2.0) + dm-transactions (1.2.0) + dm-core (~> 1.2.0) + dm-types (1.2.2) + bcrypt-ruby (~> 3.0) + dm-core (~> 1.2.0) + fastercsv (~> 1.5) + json (~> 1.6) + multi_json (~> 1.0) + stringex (~> 1.4) + uuidtools (~> 2.1) + dm-validations (1.2.0) + dm-core (~> 1.2.0) + do_postgres (0.10.14) + data_objects (= 0.10.14) + do_sqlite3 (0.10.14) + data_objects (= 0.10.14) + dotenv (1.0.2) + fastercsv (1.5.5) + json (1.8.1) + json_pure (1.8.1) + multi_json (1.10.1) + pg (0.17.1) + sqlite3 (1.3.9) + stringex (1.5.1) + uuidtools (2.1.5) + +PLATFORMS + ruby + +DEPENDENCIES + data_mapper + dm-postgres-adapter + dm-sqlite-adapter + dotenv + pg + sqlite3 From 87c74829e98b11c1cf8c9c8d2fd5a6222ba6906e Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:15:49 -0400 Subject: [PATCH 03/11] Add config for dotenv and .env.example file w/ default DB url --- .env.example | 1 + config/dotenv.rb | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 .env.example create mode 100644 config/dotenv.rb diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..944ddad --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +DATABASE_URL=sqlite:development.db diff --git a/config/dotenv.rb b/config/dotenv.rb new file mode 100644 index 0000000..393d7b8 --- /dev/null +++ b/config/dotenv.rb @@ -0,0 +1,4 @@ +if ENV['RACK_ENV'] != 'production' + require 'dotenv' + Dotenv.load('.env') +end From 761641efd8ad3b7581274e2bf1f44232dd4429e4 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:29:19 -0400 Subject: [PATCH 04/11] Add data models and assocations to models.rb Tables: users, jobs, skills User has many jobs; user has many skills Jobs belong to user; skills belong to user --- models.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 models.rb diff --git a/models.rb b/models.rb new file mode 100644 index 0000000..f450f23 --- /dev/null +++ b/models.rb @@ -0,0 +1,42 @@ +require 'data_mapper' + +DataMapper.setup(:default, ENV['DATABASE_URL']) + +class User + include DataMapper::Resource + + property :id, Serial + property :name, String, { :required => true } + property :bio, Text, { :required => true } + property :email, String, { :required => true, + :unique => true, + :format => :email_address } + property :phone, String + property :website, String, { :format => :url } + + has n, :jobs, { :child_key => [:user_id] } + has n, :skills, { :child_key => [:user_id] } +end + +class Job + include DataMapper::Resource + + property :id, Serial + property :job_title, String, { :required => true } + property :job_description, String, { :required => true } + property :company_name, String, { :required => true } + + belongs_to :user +end + +class Skill + include DataMapper::Resource + + property :id, Serial + property :name, String, { :required => true } + + belongs_to :user +end + +DataMapper.finalize +DataMapper.auto_upgrade! From 892dc24ed05afec46ba536ea77254c480e721060 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:30:23 -0400 Subject: [PATCH 05/11] Implement rake db:seed task Use faker gem to generate fake data --- Gemfile | 2 ++ Gemfile.lock | 6 ++++++ Rakefile | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 Rakefile diff --git a/Gemfile b/Gemfile index a0795b4..3696877 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,8 @@ source 'https://rubygems.org' gem 'data_mapper' +gem 'rake' +gem 'faker' group :development do gem 'sqlite3' diff --git a/Gemfile.lock b/Gemfile.lock index e78600e..5016faf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -59,11 +59,15 @@ GEM do_sqlite3 (0.10.14) data_objects (= 0.10.14) dotenv (1.0.2) + faker (1.4.3) + i18n (~> 0.5) fastercsv (1.5.5) + i18n (0.6.11) json (1.8.1) json_pure (1.8.1) multi_json (1.10.1) pg (0.17.1) + rake (10.3.2) sqlite3 (1.3.9) stringex (1.5.1) uuidtools (2.1.5) @@ -76,5 +80,7 @@ DEPENDENCIES dm-postgres-adapter dm-sqlite-adapter dotenv + faker pg + rake sqlite3 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..7359412 --- /dev/null +++ b/Rakefile @@ -0,0 +1,29 @@ +require_relative './config/dotenv' +require_relative './models' + +require 'faker' + +task 'db:seed' do + # Create a new user + user = User.create({ :name => Faker::Name.name, + :bio => Faker::Lorem.paragraph(2), + :email => Faker::Internet.email, + :phone => Faker::PhoneNumber.phone_number, + :website => Faker::Internet.url }) + + # Create 5 jobs + jobs = Array.new(5) { Job.create({ :job_title => Faker::Name.title, + :job_description => Faker::Company.bs, + :company_name => Faker::Company.name }) + } + + # Create a random number of skills + skills = Array.new(rand(10)) { Skill.create({ :name => Faker::Hacker.ingverb }) } + + # Associate the jobs and skills with the user + jobs.each { |job| user.jobs << job } + skills.each { |skill| user.skills << skill } + + # Save the user and all associations + user.save +end From 69adb646d3d4e2fbdf27bde164edba2b3ace028e Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:43:25 -0400 Subject: [PATCH 06/11] Implment basic Sinatra app features One page, static, visible at '/' Can run server with `rackup` --- Gemfile | 3 +++ Gemfile.lock | 25 +++++++++++++++++++++++++ config.ru | 3 +++ linkedout.rb | 8 ++++++++ views/layout.erb | 14 ++++++++++++++ views/resumes/show.erb | 1 + 6 files changed, 54 insertions(+) create mode 100644 config.ru create mode 100644 linkedout.rb create mode 100644 views/layout.erb create mode 100644 views/resumes/show.erb diff --git a/Gemfile b/Gemfile index 3696877..f145522 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,8 @@ source 'https://rubygems.org' +gem 'sinatra' gem 'data_mapper' + gem 'rake' gem 'faker' @@ -8,6 +10,7 @@ group :development do gem 'sqlite3' gem 'dm-sqlite-adapter' gem 'dotenv' + gem 'rerun' end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 5016faf..ba38a6e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,8 @@ GEM bcrypt (3.1.9) bcrypt-ruby (3.1.5) bcrypt (>= 3.1.3) + celluloid (0.16.0) + timers (~> 4.0.0) data_mapper (1.2.0) dm-aggregates (~> 1.2.0) dm-constraints (~> 1.2.0) @@ -62,14 +64,35 @@ GEM faker (1.4.3) i18n (~> 0.5) fastercsv (1.5.5) + ffi (1.9.6) + hitimes (1.2.2) i18n (0.6.11) json (1.8.1) json_pure (1.8.1) + listen (2.7.11) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) multi_json (1.10.1) pg (0.17.1) + rack (1.5.2) + rack-protection (1.5.3) + rack rake (10.3.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rerun (0.10.0) + listen (~> 2.7, >= 2.7.3) + sinatra (1.4.5) + rack (~> 1.4) + rack-protection (~> 1.4) + tilt (~> 1.3, >= 1.3.4) sqlite3 (1.3.9) stringex (1.5.1) + tilt (1.4.1) + timers (4.0.1) + hitimes uuidtools (2.1.5) PLATFORMS @@ -83,4 +106,6 @@ DEPENDENCIES faker pg rake + rerun + sinatra sqlite3 diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..54afd5f --- /dev/null +++ b/config.ru @@ -0,0 +1,3 @@ +require './linkedout.rb' + +run Sinatra::Application diff --git a/linkedout.rb b/linkedout.rb new file mode 100644 index 0000000..5f1aec3 --- /dev/null +++ b/linkedout.rb @@ -0,0 +1,8 @@ +require 'sinatra' + +require_relative 'config/dotenv' +require_relative 'models' + +get "/" do + erb :'resumes/show' +end diff --git a/views/layout.erb b/views/layout.erb new file mode 100644 index 0000000..2dbca98 --- /dev/null +++ b/views/layout.erb @@ -0,0 +1,14 @@ + + + LinkedOut + + +
+

LinkedOut

+ Résumés for you. Just you. +
+ + <%= yield %> + + + diff --git a/views/resumes/show.erb b/views/resumes/show.erb new file mode 100644 index 0000000..dc66c8c --- /dev/null +++ b/views/resumes/show.erb @@ -0,0 +1 @@ +Résumé show page From b90d8e2b7425bd9851c743a3c1475b9aadfbbc73 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 17:53:51 -0400 Subject: [PATCH 07/11] =?UTF-8?q?Render=20r=C3=A9sum=C3=A9=20page=20with?= =?UTF-8?q?=20real=20user=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show user info, jobs, and skills WARNING: this just grabs the last user in the database. --- linkedout.rb | 4 ++++ views/resumes/show.erb | 31 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/linkedout.rb b/linkedout.rb index 5f1aec3..43e1887 100644 --- a/linkedout.rb +++ b/linkedout.rb @@ -4,5 +4,9 @@ require_relative 'models' get "/" do + @user = User.last + @jobs = @user.jobs + @skills = @user.skills + erb :'resumes/show' end diff --git a/views/resumes/show.erb b/views/resumes/show.erb index dc66c8c..cb2f287 100644 --- a/views/resumes/show.erb +++ b/views/resumes/show.erb @@ -1 +1,30 @@ -Résumé show page +
+ <%= @user.name %>
+ <%= @user.bio %>
+ <%= @user.email %>
+ <%= @user.phone %>
+ <%= @user.website %> +
+ +
+

Jobs

+
    + <% @jobs.each do |job| %> +
  • + <%= job.job_title %>
    + <%= job.job_description %>
    + <%= job.company_name %> +
  • + <% end %> +
+
+ +
+

Skills

+
    + <% @skills.each do |skill| %> +
  • <%= skill.name %>
  • + <% end %> +
+
+ From 5fef34f7ce500d5f9f41f5a10cc28a487709ffc1 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 18:03:40 -0400 Subject: [PATCH 08/11] =?UTF-8?q?Improve=20HTML=20structure=20of=20r=C3=A9?= =?UTF-8?q?sum=C3=A9=20show=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/resumes/show.erb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/views/resumes/show.erb b/views/resumes/show.erb index cb2f287..87aba42 100644 --- a/views/resumes/show.erb +++ b/views/resumes/show.erb @@ -1,9 +1,14 @@ +

My Résumé

+
- <%= @user.name %>
- <%= @user.bio %>
- <%= @user.email %>
- <%= @user.phone %>
- <%= @user.website %> +

<%= @user.name %>

+
+ <%= @user.email %> + | <%= @user.phone %> + | <%= @user.website %> +
+ +

<%= @user.bio %>

@@ -11,9 +16,8 @@
    <% @jobs.each do |job| %>
  • - <%= job.job_title %>
    - <%= job.job_description %>
    - <%= job.company_name %> +

    <%= job.job_title %> at <%= job.company_name %>

    +

    <%= job.job_description %>

  • <% end %>
From 12bb3053fe076a7fb06bee29ea7f4a4a6134e9b3 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Mon, 27 Oct 2014 18:11:11 -0400 Subject: [PATCH 09/11] Add CSS library and basic styling - Use normalize.css - Page layout improvements in main.css --- public/main.css | 9 + public/normalize.css | 427 +++++++++++++++++++++++++++++++++++++++++ views/layout.erb | 7 + views/resumes/show.erb | 61 +++--- 4 files changed, 474 insertions(+), 30 deletions(-) create mode 100644 public/main.css create mode 100644 public/normalize.css diff --git a/public/main.css b/public/main.css new file mode 100644 index 0000000..7ba924b --- /dev/null +++ b/public/main.css @@ -0,0 +1,9 @@ +header { + min-width: 100%; + text-align: center; +} + +.resume { + margin: 0 auto; + width: 720px; +} diff --git a/public/normalize.css b/public/normalize.css new file mode 100644 index 0000000..458eea1 --- /dev/null +++ b/public/normalize.css @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/views/layout.erb b/views/layout.erb index 2dbca98..f677a8f 100644 --- a/views/layout.erb +++ b/views/layout.erb @@ -1,6 +1,13 @@ LinkedOut + + + + + +
diff --git a/views/resumes/show.erb b/views/resumes/show.erb index 87aba42..c1b28d4 100644 --- a/views/resumes/show.erb +++ b/views/resumes/show.erb @@ -1,34 +1,35 @@ -

My Résumé

+
+

My Résumé

-
-

<%= @user.name %>

-
- <%= @user.email %> - | <%= @user.phone %> - | <%= @user.website %> -
+
+

<%= @user.name %>

+
+ <%= @user.email %> + | <%= @user.phone %> + | <%= @user.website %> +
-

<%= @user.bio %>

-
+

<%= @user.bio %>

+
-
-

Jobs

-
    - <% @jobs.each do |job| %> -
  • -

    <%= job.job_title %> at <%= job.company_name %>

    -

    <%= job.job_description %>

    -
  • - <% end %> -
-
- -
-

Skills

-
    - <% @skills.each do |skill| %> -
  • <%= skill.name %>
  • - <% end %> -
-
+
+

Jobs

+
    + <% @jobs.each do |job| %> +
  • +

    <%= job.job_title %> at <%= job.company_name %>

    +

    <%= job.job_description %>

    +
  • + <% end %> +
+
+
+

Skills

+
    + <% @skills.each do |skill| %> +
  • <%= skill.name %>
  • + <% end %> +
+
+
From fbbe4e351a765d52efa66735faf427d37dfc69c4 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Wed, 29 Oct 2014 12:02:46 -0400 Subject: [PATCH 10/11] Add helper method to retrieve a default user Moving the decision of "who should the default user be?" into its own method encapsulates that logic and makes it easier to reason about and change in the future. --- linkedout.rb | 11 ++++++++--- views/resumes/show.erb | 12 +++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/linkedout.rb b/linkedout.rb index 43e1887..101008e 100644 --- a/linkedout.rb +++ b/linkedout.rb @@ -3,10 +3,15 @@ require_relative 'config/dotenv' require_relative 'models' +helpers do + def default_user + @default_user ||= User.last + end +end + get "/" do - @user = User.last - @jobs = @user.jobs - @skills = @user.skills + @jobs = default_user.jobs + @skills = default_user.skills erb :'resumes/show' end diff --git a/views/resumes/show.erb b/views/resumes/show.erb index c1b28d4..f43535f 100644 --- a/views/resumes/show.erb +++ b/views/resumes/show.erb @@ -2,14 +2,16 @@

My Résumé

-

<%= @user.name %>

+

<%= default_user.name %>

- <%= @user.email %> - | <%= @user.phone %> - | <%= @user.website %> + <%= default_user.email %> + | <%= default_user.phone %> + | <%= default_user.website %>
-

<%= @user.bio %>

+

<%= default_user.bio %>

+ +
From b986c061110eb3cc7ba9225d1da0f55793807979 Mon Sep 17 00:00:00 2001 From: Tanner Welsh Date: Wed, 29 Oct 2014 23:18:08 -0400 Subject: [PATCH 11/11] Add list of starter files to README --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 42f0704..9d7f7a0 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,30 @@ Once you have SQLite3 working, you can set up your development environment with ### Files In This Repository +```sh +├── .env.example # a sample .env file for setting environment variables +├── .gitignore # list of files to be ignored by git +├── CODE_OF_CONDUCT.md # standards of relating between contributors +├── CONTRIBUTING.md # how to contribute +├── Gemfile # list of gems that this project uses +├── Gemfile.lock # a "locked" version of the Gemfile, which includes version numbers for all the gems +├── LICENSE.md # license for project material +├── README.md # you are here. ;D +├── Rakefile # a place to store one-off commands (like seeding the database) +├── config # put configuration scripts in this folder +│   └── dotenv.rb # like this one! for the dotenv gem +├── config.ru # this tells our web server how to run +├── linkedout.rb # the most important file! this is the heart of our Sinatra web app, where we define how to respond to requests from across the web +├── models.rb # where we define the data models for the app, using an ORM like DataMapper +├── public # a folder to hold "static assets" like CSS files, images, and JavaScript files +│   ├── main.css # our custom CSS +│   └── normalize.css # a commonly used CSS library to aid in cross-browser compatibility +└── views # a folder to hold the HTML templates for our pages + ├── layout.erb # this is the main template for our site + └── resumes # a sub-folder, to hold specific templates related to résumés + └── show.erb # the template for the résumé show page +``` + ## Releases We've inherited a project that has already been worked on. It is up to release 0.8.0, which contains the following features: