Merge pull request #119 from xdite/refactor_topic_view

Refactor topic view
This commit is contained in:
Robin Ward 2013-02-11 10:30:30 -08:00
commit 7375566213
2 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,10 @@
module TopicsHelper
def render_topic_title(topic)
link_to(topic.title,topic.relative_url)
end
def render_topic_next_page_link(topic, next_page)
link_to("next page", topic.relative_url + "?page=" + next_page )
end
end

View File

@ -1,5 +1,6 @@
<h2> <h2>
<a href="<%= @topic_view.topic.relative_url %>"><%= @topic_view.topic.title %></a> <%= render_topic_title(@topic_view.topic) %>
</h2> </h2>
<% (@post ? [@post] : @topic_view.posts).each do |post| %> <% (@post ? [@post] : @topic_view.posts).each do |post| %>
<div class='creator'> <div class='creator'>
@ -12,7 +13,7 @@
<% if @next_page%> <% if @next_page%>
<p> <p>
<b><a href="<%= @topic_view.topic.relative_url %>?page=<%= @next_page%>">next page</a></b> <b><%= render_topic_next_page_link(@topic_view.topic, @next_page) %></b>
</p> </p>
<% end %> <% end %>