Permalink
Browse files

adding routes and controller actions for projects

  • Loading branch information...
1 parent 6df1d01 commit 0308ae294c4f6a2c05cab1a8b92264378cc07dc0 @rishighan committed Apr 17, 2012
Showing with 15 additions and 2 deletions.
  1. +13 −2 app/controllers/pages_controller.rb
  2. +2 −0 config/routes.rb
@@ -11,27 +11,29 @@ def index
render :layout => 'application'
end
+ # GET /blog
def blog
@posts = Post.exclude_category(["Projects", "Home Carousel", "Thesis"])
@posts = @posts.paginate(:page=>params[:page],:per_page=>5)
@categories = Category.all
end
+ # GET /blog/archive
def archive
@posts = Post.all
@post_months = @posts.group_by {|post| post.created_at.beginning_of_month}
render :layout => "application"
end
- # GET /articles/search
+ # GET
def search
@post = Post.search params[:q], :load =>true
render :action => blog
end
-
+ # GET /blog/post/some-blog-post
def post
@post =Post.find(params[:id])
@categories = Category.all
@@ -41,6 +43,7 @@ def post
end
end
+ # GET /thesis
def thesis
@posts = Post.include_category(["Thesis"])
@posts = @posts.paginate(:page=>params[:page],:per_page=>6)
@@ -49,13 +52,21 @@ def thesis
end
+ # GET /projects
def projects
@posts = Post.include_category(["Projects"])
@posts = @posts.paginate(:page=>params[:page],:per_page=>1)
@categories = Category.all
render :blog
end
+
+ # /project/some-project
+ def project
+ @post = Post.find(params[:id])
+ @categories = Category.all
+ render :post
+ end
end
View
@@ -14,6 +14,8 @@
# projects
get '/projects' => 'pages#projects'
+ # individual project
+ get '/project/:id' => 'pages#project', :as => :project
#archive
get 'blog/archive' => 'pages#archive'

0 comments on commit 0308ae2

Please sign in to comment.