Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
109 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class CategoriesController < ApplicationController | ||
def index | ||
@categories = Category.find :all, :order => "position" | ||
end | ||
|
||
def show | ||
@category = current_category | ||
end | ||
|
||
protected | ||
def current_category | ||
@current_category ||= Category.find_by_value(params[:id]) | ||
return @current_category | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module CategoriesHelper | ||
def category_nav_item(category) | ||
|
||
li_options = {} | ||
|
||
# see if we are displaying the currently selected category | ||
if category == @category | ||
li_options[:class] = "selected" | ||
end | ||
|
||
link = link_to "<span>#{category.name}</span><span class='cnr'> </span>", category_url(category), :title => category.name | ||
|
||
return content_tag(:li, link, li_options) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
module JobsHelper | ||
# list last viewed jobs (from session) | ||
def last_viewed_jobs | ||
unless @last_viewed_jobs | ||
@last_viewed_jobs = [] | ||
end | ||
|
||
return @last_viewed_jobs | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
class Category < ActiveRecord::Base | ||
has_many :jobs | ||
|
||
def self.list | ||
find :all, :order => "position" | ||
end | ||
|
||
def to_param | ||
self.value | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#categories | ||
%ul | ||
- Category.list.each do |category| | ||
= category_nav_item(category) | ||
= clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#sidebar | ||
-# display home link (if not already there) | ||
- unless current_page?(root_url) | ||
= link_to "Home", root_url | ||
= br | ||
|
||
-# display list of last viewed jobs | ||
- unless last_viewed_jobs.empty? | ||
%h4 Seen Recently | ||
%ul | ||
- last_viewed_jobs.each do |job| | ||
%li= link_to "» #{job.title}", job_url(job) | ||
|
||
|
||
-# show stats | ||
- if current_page?(root_url) | ||
= br | ||
#stats | ||
%strong== #{Job.count} total jobs | ||
= br | ||
- Category.list.each do |category| | ||
%strong= category.jobs.size | ||
for | ||
= link_to category.name, category_url(category) | ||
= br |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
// Place your application-specific JavaScript functions and classes here | ||
// This file is automatically included by javascript_include_tag :defaults | ||
$j(document).ready(function() { | ||
$j(".example").each(function(index) { | ||
$j(this).example(this.title); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'test_helper' | ||
|
||
class CategoriesControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
def test_truth | ||
assert true | ||
end | ||
end |