Skip to content

Commit

Permalink
Add back link from show page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Byron committed Jan 7, 2012
1 parent 61e74c2 commit d026bd4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.css.sass
Expand Up @@ -5,6 +5,10 @@
$blueprint-font-family: "helvetica, arial, freesans, clean, sans-serif"
$display-font: "Alte Haas Grotesk"

$link-active-color: #3A3D50
$link-color: #004C99
$link-visited-color: #004C99

$blueprint-grid-columns: 20

@import compass/reset
Expand Down
16 changes: 15 additions & 1 deletion app/assets/stylesheets/partials/_articles.sass
Expand Up @@ -29,4 +29,18 @@ article
margin-top: 50px
div.control-bar
+column(20)
margin-bottom: 0
margin-bottom: 0

hr.separator
border: none
height: 1px
background-color: #ccc
color: #ccc
margin: 1em 0

a#back-link
border-top: 1px solid #ccc
padding-top: 1em
margin-top: 1em
display: block
font-family: $display-font
9 changes: 9 additions & 0 deletions app/decorators/article_decorator.rb
Expand Up @@ -9,4 +9,13 @@ def author_rss
def body
h.md(article.body)
end

def bottom(articles)
if articles
h.tag(:hr, :class => "separator") if article != articles.last
else
h.link_to "« There is more where that came from".html_safe,
h.articles_path, :id => "back-link"
end
end
end
8 changes: 6 additions & 2 deletions app/views/articles/_article.html.haml
@@ -1,6 +1,9 @@
= content_tag_for :article, article do
.article_title
= link_to article.title, article_path(article)
- if @articles
= link_to article.title, article_path(article)
- else
= article.title

.article_content= article.body

Expand All @@ -12,4 +15,5 @@
= link_to 'Destroy', article, :confirm => 'Are you sure?',
:method => :delete, :class => "clean-gray warn"

= tag :hr, :class => "separator" if @articles && article != @articles.last
= article.bottom(@articles)

2 changes: 2 additions & 0 deletions app/views/articles/index.html.haml
@@ -1,3 +1,5 @@
- content_for(:title) { "Updates" }

- content_for :header_bottom do
= auto_discovery_link_tag

Expand Down
2 changes: 2 additions & 0 deletions app/views/articles/show.html.haml
@@ -1 +1,3 @@
- content_for(:title) { @article.title }

= render :partial => "article", :locals => { :article => @article }

0 comments on commit d026bd4

Please sign in to comment.