Skip to content
Browse files

Styling of stories

  • Loading branch information...
1 parent ea7f2c1 commit 0fe6e4524dda786a7e73686a6566cfb7d47db497 @rjshade committed Apr 6, 2012
View
BIN app/assets/images/posts/default_photo_1024x768.png
Deleted file not rendered
View
37 app/assets/stylesheets/stories.css.scss
@@ -43,6 +43,43 @@
}
}
+.new-post-teaser {
+ height: 180px;
+ overflow: hidden;
+ .date {
+ width: 120px;
+ min-height: 180px;
+ font-size: 1.5em;
+ font-weight: 100;
+ color: #777;
+ border-right: 1px solid #efefef;
+ float:left;
+ }
+ .image {
+ width: 250px;
+ padding-left: 20px;
+ text-align: center;
+ img {
+ margin-left:auto;
+ margin-right:auto;
+ max-height: 120px;
+ max-width: 200px;
+ @include image-style;
+ }
+ float:left;
+ }
+ .body {
+ .location {
+ font-weight: 100;
+ font-size: 1.5em;
+ color: #555;
+ padding-bottom: 5px;
+ }
+ width: 500px;
+ float: right;
+ }
+}
+
#popular-stories {
margin: 0 auto;
.item {
View
1 app/assets/stylesheets/wandershot.css.scss
@@ -52,3 +52,4 @@ ul {
background: #fff;
}
}
+
View
12 app/models/post.rb
@@ -9,8 +9,7 @@ class Post
:original => ['1920x1680>', :jpg],
:small => ['200x200>', :jpg],
:medium => ['400x400>', :jpg],
- :large => ['800x800>', :jpg] },
- :default_url => '/assets/posts/default_photo_1024x768.png'
+ :large => ['800x800>', :jpg] }
}.merge(PAPERCLIP_STORAGE_OPTIONS)
field :date, :type => DateTime
@@ -32,6 +31,15 @@ class Post
scope :by_date, ascending(:date)
+ def get_date
+ self.date if self.date
+ created_at
+ end
+
+ def get_location
+ self.address if self.address
+ end
+
def self.with_images
all.find_all{|post| post.image?}
end
View
23 app/views/stories/show.html.haml
@@ -21,19 +21,30 @@
- if output.size > 0
= content_tag 'div', nil, id: "gmaps-story-view", style: "width:100%;height:300px;", data: { locations: "#{ output.to_json }" }
- %hr
-
.row
.span12
+ .page-header
+ %h3 Posts in this story
- if @posts.size == 0
.row
- 3.times do |i|
= render :partial => 'posts/story_teaser', :locals => { :post => nil, :placeholder => true }
- else
- - @posts.to_a.in_groups_of(3) do |posts|
- .row
- - posts.each do |p|
- = render :partial => 'posts/story_teaser', :locals => { :post => p, :placeholder => false }
+ - @posts.each do |post|
+ .new-post-teaser
+ %span.date= post.get_date.strftime("%d %b %Y")
+ %span.image= (image_tag post.image(:small)) if post.image?
+ .body
+ - if loc = post.get_location
+ .location= loc
+ .text= truncate_html(md post.text)
+ .clearfix
+
+
+ -#- @posts.to_a.in_groups_of(3) do |posts|
+ -#.row
+ -#- posts.each do |p|
+ -#= render :partial => 'posts/story_teaser', :locals => { :post => p, :placeholder => false }
=# Comment block
.row

0 comments on commit 0fe6e45

Please sign in to comment.
Something went wrong with that request. Please try again.