Merge pull request #119 from xdite/refactor_topic_view
Refactor topic view
This commit is contained in:
commit
7375566213
|
@ -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
|
|
@ -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 %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue