Permalink
Browse files

corrected layout and added more styles partials

  • Loading branch information...
1 parent 1a64cee commit 6bcb341f88129be28cbf6d2680e0adac4c715168 @arunsark committed May 20, 2011
View
@@ -11,7 +11,7 @@ gem 'cancan'
gem 'compass', '0.11.1'
gem 'haml'
gem 'sass'
-
+gem 'will_paginate'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
View
@@ -189,3 +189,4 @@ DEPENDENCIES
rails (= 3.0.7)
rspec-rails
sass
+ will_paginate
@@ -6,7 +6,8 @@ class PostsController < ApplicationController
# GET /posts
# GET /posts.xml
def index
- @posts = Post.all
+ # @posts = Post.paginate :page => params[:page]
+ @posts = Post.paginate :page => params[:page], :per_page => 2
respond_to do |format|
format.html # index.html.erb
@@ -1,2 +1,16 @@
module ApplicationHelper
+ def side_bar_contents
+
+ if can? :create, Post
+ content = link_to 'New Post', new_post_path
+ end
+ content_tag :div, :class => "sidebar" do
+ raw (
+ content +
+ content_tag(:p,"Archives: ") +
+ content_tag(:p,"May 2011") +
+ content_tag(:p,"May 2011")
+ )
+ end
+ end
end
@@ -1,2 +1,8 @@
module CommentsHelper
+
+ def comment_update_destroy_links(comment)
+ if comment.author && can?(:update,comment) && can?(:delete,comment)
+ render :partial => 'comments/update_destroy' , :locals => {:comment => comment}
+ end
+ end
end
@@ -3,4 +3,16 @@ module PostsHelper
def PostsHelper.generate_slug(title)
title.downcase.gsub(/[^[:alnum:]]/,'-').gsub(/-{2,}/,'-')
end
+
+ def post_update_destroy_links(post)
+ options = []
+ if can? :update, post
+ options << :update
+ end
+ if can? :destroy, post
+ options << :destroy
+ end
+ render :partial => "posts/update_destroy" , :locals => {:options => options, :post => post}
+ end
+
end
View
@@ -20,6 +20,9 @@ class Post
has_and_belongs_to_many :users
+ cattr_reader :per_page
+ @@per_page = 1
+
#accepts_nested_attributes_for :comment
def get_tags
View
@@ -8,24 +8,44 @@
.blog
+container
- background-color: #8AC5E9
- font-family: 'Helvetica Neue','Trebuchet MS', Trebuchet, 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif
+ background: #8AC5E9
+ font-family: 'Helvetica','Trebuchet MS', Trebuchet, 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif
a
text-decoration: none
- #header, #footer
+ #header
+column(24,true)
h3
font-family: 'Syncopate'
- font-size: 2em
- color: D4061E
+ font-size: 3em
+ color: D4061E
+ margin: 1em 0em 0em 0em
+ #footer
+ +column(20)
+ #footer_content
+ +column(4,true)
+ font-size: 0.6em
+ float: right
#content
color: #F5F5F0
a
+link-colors(#9FCCF0,#C74451,#C74451,#9FFCF0,#C74451)
+hover-link
#left
- +content_box(12)
+ +content_box(18)
+ section
+ h2
+ font-size: 2em
+ color: #E8B7BC
+ border-bottom: 1px #AAA solid
+ margin: 0em 0em 0.2em 0em
+ #subHead
+ font-size: 0.8em
+ color: #AAA
+ #post
+ font-size: 1.2em
+ margin: 1em 0em 1em 0em
+
#right
- +content_box(4)
+ +content_box(3,true)
@@ -18,4 +18,5 @@ $blueprint-grid-width: ($blueprint-container-size + $blueprint-grid-margin) / $b
@import "blueprint/grid"
@import "blueprint/colors"
@import "compass/typography/links"
-@import "compass/typography/links/link-colors"
+@import "compass/typography/links/link-colors"
+@import "compass/css3/opacity"
@@ -4,8 +4,5 @@
= comment.published_on
%p
= comment.content
-- if comment.author && can?(:update,comment)
- %p
- = link_to "Edit Comment", edit_post_comment_path(@post,comment)
-- if comment.author && can?(:destroy,comment)
- = link_to "Delete Comment", [@post,comment],:confirm => "Are you sure?" , :method => :delete
+%p
+ = comment_update_destroy_links comment
@@ -0,0 +1,3 @@
+= link_to "Edit Comment", edit_post_comment_path(@post,comment)
+|
+\#{link_to "Delete Comment", [@post,comment],:confirm => "Are you sure?" , :method => :delete}
@@ -21,6 +21,7 @@
#left
=yield
#right
- side bar goes here
+ =side_bar_contents
#footer
- Powered by Ostrya Labs
+ #footer_content
+ Powered by Ostrya Labs
@@ -0,0 +1,3 @@
+= link_to 'Edit', edit_post_path(post) ? options.include?(:update)
+\ "|" ? options.size > 1
+\ link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete ? options.include?(:delete)
@@ -1,20 +1,7 @@
-%h1 Listing posts
-%table
- %tr
- %th Title
- %th Content
- %th
- %th
- %th
+%section
- @posts.each do |post|
- %tr
- %td= post.title
- %td= post.content
- %td= link_to 'Show', post
- - if can? :update, post
- %td= link_to 'Edit', edit_post_path(post)
- - if can? :destroy, post
- %td= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete
-%br/
-- if can? :create, Post
- = link_to 'New Post', new_post_path
+ %h2= post.title
+ #subHead= "Author: #{post.authors} Published: #{post.published_on}"
+ #post= post.content
+
+ = will_paginate @posts
@@ -70,35 +70,60 @@ footer, header, hgroup, menu, nav, section {
margin: 0 auto;
overflow: hidden;
*zoom: 1;
- background-color: #8ac5e9;
- font-family: "Helvetica Neue", "Trebuchet MS", Trebuchet, "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
+ background: #8ac5e9;
+ font-family: "Helvetica", "Trebuchet MS", Trebuchet, "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
}
/* line 13, ../../app/stylesheets/blog.sass */
.blog a {
text-decoration: none;
}
/* line 15, ../../app/stylesheets/blog.sass */
-.blog #header, .blog #footer {
+.blog #header {
display: inline;
float: left;
margin-right: 0;
width: 950px;
}
/* line 147, ../../../../../../../home/arun/.rvm/gems/ruby-1.9.2-p136@foo/gems/compass-0.11.1/frameworks/blueprint/stylesheets/blueprint/_grid.scss */
-* html .blog #header, * html .blog #footer {
+* html .blog #header {
overflow-x: hidden;
}
/* line 17, ../../app/stylesheets/blog.sass */
-.blog #header h3, .blog #footer h3 {
+.blog #header h3 {
font-family: "Syncopate";
- font-size: 2em;
+ font-size: 3em;
color: D4061E;
+ margin: 1em 0em 0em 0em;
+}
+/* line 22, ../../app/stylesheets/blog.sass */
+.blog #footer {
+ display: inline;
+ float: left;
+ margin-right: 10px;
+ width: 790px;
+}
+/* line 147, ../../../../../../../home/arun/.rvm/gems/ruby-1.9.2-p136@foo/gems/compass-0.11.1/frameworks/blueprint/stylesheets/blueprint/_grid.scss */
+* html .blog #footer {
+ overflow-x: hidden;
+}
+/* line 24, ../../app/stylesheets/blog.sass */
+.blog #footer #footer_content {
+ display: inline;
+ float: left;
+ margin-right: 0;
+ width: 150px;
+ font-size: 0.6em;
+ float: right;
}
-/* line 21, ../../app/stylesheets/blog.sass */
+/* line 147, ../../../../../../../home/arun/.rvm/gems/ruby-1.9.2-p136@foo/gems/compass-0.11.1/frameworks/blueprint/stylesheets/blueprint/_grid.scss */
+* html .blog #footer #footer_content {
+ overflow-x: hidden;
+}
+/* line 28, ../../app/stylesheets/blog.sass */
.blog #content {
color: #f5f5f0;
}
-/* line 23, ../../app/stylesheets/blog.sass */
+/* line 30, ../../app/stylesheets/blog.sass */
.blog #content a {
color: #9fccf0;
text-decoration: none;
@@ -123,12 +148,12 @@ footer, header, hgroup, menu, nav, section {
.blog #content a:hover {
text-decoration: underline;
}
-/* line 26, ../../app/stylesheets/blog.sass */
+/* line 33, ../../app/stylesheets/blog.sass */
.blog #content #left {
display: inline;
float: left;
margin-right: 10px;
- width: 470px;
+ width: 710px;
background: url('/images/middle_bknd.png?1305803682');
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
@@ -142,12 +167,29 @@ footer, header, hgroup, menu, nav, section {
* html .blog #content #left {
overflow-x: hidden;
}
-/* line 28, ../../app/stylesheets/blog.sass */
+/* line 36, ../../app/stylesheets/blog.sass */
+.blog #content #left section h2 {
+ font-size: 2em;
+ color: #e8b7bc;
+ border-bottom: 1px #aaaaaa solid;
+ margin: 0em 0em 0.2em 0em;
+}
+/* line 41, ../../app/stylesheets/blog.sass */
+.blog #content #left section #subHead {
+ font-size: 0.8em;
+ color: #aaaaaa;
+}
+/* line 44, ../../app/stylesheets/blog.sass */
+.blog #content #left section #post {
+ font-size: 1.2em;
+ margin: 1em 0em 1em 0em;
+}
+/* line 48, ../../app/stylesheets/blog.sass */
.blog #content #right {
display: inline;
float: left;
- margin-right: 10px;
- width: 150px;
+ margin-right: 0;
+ width: 110px;
background: url('/images/middle_bknd.png?1305803682');
-moz-border-radius: 25px;
-webkit-border-radius: 25px;

0 comments on commit 6bcb341

Please sign in to comment.