diff --git a/Gemfile b/Gemfile index d01c681..12f8803 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' gem 'sinatra' +gem 'sinatra-partial' gem 'data_mapper' gem 'rake' diff --git a/Gemfile.lock b/Gemfile.lock index dfb770c..1cf4bd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,6 +97,8 @@ GEM rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) + sinatra-partial (0.4.0) + sinatra sqlite3 (1.3.9) stringex (1.5.1) tilt (1.4.1) @@ -119,4 +121,5 @@ DEPENDENCIES rake rerun sinatra + sinatra-partial sqlite3 diff --git a/linkedout.rb b/linkedout.rb index a791d0c..21fed6b 100644 --- a/linkedout.rb +++ b/linkedout.rb @@ -1,9 +1,12 @@ require 'sinatra' +require 'sinatra/partial' require 'better_errors' require_relative 'config/dotenv' require_relative 'models' +set :partial_template_engine, :erb + configure :development do use BetterErrors::Middleware BetterErrors.application_root = File.expand_path('..', __FILE__) diff --git a/public/main.css b/public/main.css index 7ba924b..f57fce3 100644 --- a/public/main.css +++ b/public/main.css @@ -1,9 +1,125 @@ +/* + * HEADER + */ header { min-width: 100%; text-align: center; + background-color: #555; + color: #fff; + padding: 0.5em; } -.resume { +header h1 { + margin: 0; + font-size: 1.5em; +} + + +/* + * PAGE + */ +.page { margin: 0 auto; width: 720px; } + +/* Separate page nav area from the main content with a border */ +.page nav { + padding-bottom: 0.25em; + border-bottom: 1px solid; + margin-bottom: 0.5em; +} + +.page nav a { + float: right; +} + +/* Highlight section for featured content */ +.highlight { + width: 100%; + margin-bottom: 3em; +} + +.highlight p { font-size: 1.5em; } + + +/* + * GRID + */ +.row { + display: block; + clear: both; +} + +.row:after { + display: block; + content: ""; + line-height: 0; + clear: both; +} + +/* 1/3 column (720 * 1/3) */ +.one_third { + float: left; + width: 240px; +} + +/* 2/3 column (720 * 2/3 - margin) */ +.two_thirds { + float: left; + width: 460px; + margin-right: 20px; +} + + +/* + * FORMS + */ +textarea { + width: 360px; + height: 3em; +} + +form.vertical label { + display: inline-block; + min-width: 120px; + vertical-align: top; +} + +form.vertical input { margin-bottom: 0.25em; } + +form.vertical input[type="submit"] { + margin-left: 124px; + padding: 0.25em; +} + +form.mini input[type="text"] { max-width: 160px; } +form.mini input[type="submit"] { float: right; } + + +/* + * UTILITY CLASSES + */ +.no_bullets { + list-style-type: none; +} + +.no_padding { + padding: 0; +} + + +/* + * SECTION STYLING + */ + +/* Jobs section */ +.jobs li { margin-bottom: 2.5em; } +.jobs li h4 { margin-bottom: 0; } + +/* Skills section */ +.skills li { + padding: 0.25em; + margin-bottom: 1em; + background-color: #ccc; +} diff --git a/views/partials/job.erb b/views/partials/job.erb new file mode 100644 index 0000000..0db8394 --- /dev/null +++ b/views/partials/job.erb @@ -0,0 +1,4 @@ +
  • +

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

    +

    <%= job.job_description %>

    +
  • diff --git a/views/partials/job_form.erb b/views/partials/job_form.erb new file mode 100644 index 0000000..24efaf0 --- /dev/null +++ b/views/partials/job_form.erb @@ -0,0 +1,23 @@ +<% + # When rendering a partial, the collection item takes the name + # of the file for the item, so the job object is assigned to + # the local variable `job_form` + job = job_form +%> +
  • +
    + + + + + at + +
    + +
    + +
    + + +
    +
  • diff --git a/views/partials/profile.erb b/views/partials/profile.erb new file mode 100644 index 0000000..0e7f3c8 --- /dev/null +++ b/views/partials/profile.erb @@ -0,0 +1,10 @@ +
    +

    <%= user.name %>

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

    <%= user.bio %>

    +
    diff --git a/views/partials/profile_form.erb b/views/partials/profile_form.erb new file mode 100644 index 0000000..f1e6128 --- /dev/null +++ b/views/partials/profile_form.erb @@ -0,0 +1,27 @@ +
    +
    + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + +
    +
    diff --git a/views/partials/skill.erb b/views/partials/skill.erb new file mode 100644 index 0000000..986a0f8 --- /dev/null +++ b/views/partials/skill.erb @@ -0,0 +1 @@ +
  • <%= skill.name %>
  • diff --git a/views/partials/skill_form.erb b/views/partials/skill_form.erb new file mode 100644 index 0000000..86d0c73 --- /dev/null +++ b/views/partials/skill_form.erb @@ -0,0 +1,12 @@ +<% skill = skill_form %> +
  • +
    + + + + + + + +
    +
  • diff --git a/views/resumes/edit.erb b/views/resumes/edit.erb index be2f667..00d518b 100644 --- a/views/resumes/edit.erb +++ b/views/resumes/edit.erb @@ -1,76 +1,24 @@ -
    -

    Edit My Résumé

    - -
    -
    - - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - -
    -
    - -
    -

    Jobs

    - -
    - -
    -

    Skills

    - -
    +
    + + + <%= partial :'partials/profile_form', :locals => { :user => default_user } %> + +
    +
    +

    Jobs

    +
      + <%= partial :'partials/job_form', collection: @jobs %> +
    +
    + +
    +

    Skills

    +
      + <%= partial :'partials/skill_form', collection: @skills %> +
    +
    +
    diff --git a/views/resumes/show.erb b/views/resumes/show.erb index 6cb3a62..d0e9ff8 100644 --- a/views/resumes/show.erb +++ b/views/resumes/show.erb @@ -1,36 +1,24 @@ -
    -

    My Résumé

    - Edit +
    + -
    -

    <%= default_user.name %>

    -
    - <%= default_user.email %> - | <%= default_user.phone %> - | <%= default_user.website %> -
    + <%= partial :'partials/profile', :locals => { :user => default_user } %> -

    <%= default_user.bio %>

    -
    +
    +
    +

    Jobs

    +
      + <%= partial :'partials/job', collection: @jobs %> +
    +
    -
    -

    Jobs

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

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

      -

      <%= job.job_description %>

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

    Skills

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

    Skills

    +
      + <%= partial :'partials/skill', collection: @skills %> +
    +
    +