Permalink
Browse files

Added MarkDown and Pagingation

  • Loading branch information...
1 parent 9cbcd61 commit 614877db0764b8d8455864c02d6f6b2bd901a01a @mmorin committed Feb 13, 2013
View
@@ -14,5 +14,5 @@
/log/*.log
/tmp
-.idea
+/.idea/*
@@ -17,6 +17,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="PROVIDED" name="RedCloth (v4.2.9, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v3.2.11, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v3.2.11, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v3.2.11, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
@@ -61,6 +62,7 @@
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v0.3.35, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="uglifier (v1.3.0, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="warden (v1.2.1, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="will_paginate (v3.0.4, RVM: ruby-2.0.0-rc2) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
View
@@ -7,6 +7,8 @@ gem 'rails', '3.2.11'
gem 'sqlite3'
gem 'devise'
+gem 'will_paginate'
+gem 'RedCloth'
# Gems used only for assets and not required
# in production environments by default.
View
@@ -1,6 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
+ RedCloth (4.2.9)
actionmailer (3.2.11)
actionpack (= 3.2.11)
mail (~> 2.4.4)
@@ -108,15 +109,18 @@ GEM
multi_json (~> 1.0, >= 1.0.2)
warden (1.2.1)
rack (>= 1.0)
+ will_paginate (3.0.4)
PLATFORMS
ruby
DEPENDENCIES
+ RedCloth
coffee-rails (~> 3.2.1)
devise
jquery-rails
rails (= 3.2.11)
sass-rails (~> 3.2.3)
sqlite3
uglifier (>= 1.0.3)
+ will_paginate
@@ -4,7 +4,9 @@ class PostsController < ApplicationController
# GET /posts
# GET /posts.json
def index
- @posts = Post.all
+ @posts = Post
+ .paginate(:page => params[:page], :per_page => 5)
+ .order('created_at DESC')
respond_to do |format|
format.html # index.html.erb
@@ -2,7 +2,7 @@
<h1 class="postTitle"><%= link_to post.title, post %></h1>
<p class="date"><small><%= post.created_at.to_date.readable_inspect %> by No One</small></p>
<div class="post">
- <%= simple_format post.body %>
+ <%= raw textilize(post.body) %>
</div>
<%- if user_signed_in? && current_user.is_blogger %>
<small>
@@ -1 +1,3 @@
-<%= render :partial => 'post', :collection => @posts %>
+<%= render :partial => 'post', :collection => @posts %>
+<hr />
+<%= will_paginate @posts %>
View
@@ -1,6 +1,7 @@
Blogtutorial::Application.routes.draw do
devise_for :users
+ match 'posts/page/:page' => 'posts#index'
resources :posts
root :to => 'posts#index'

0 comments on commit 614877d

Please sign in to comment.