mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 02:23:44 +08:00
Merge pull request #119 from xdite/refactor_topic_view
Refactor topic view
This commit is contained in:
commit
7375566213
10
app/helpers/topics_helper.rb
Normal file
10
app/helpers/topics_helper.rb
Normal 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
|
|
@ -1,5 +1,6 @@
|
|||
<h2>
|
||||
<a href="<%= @topic_view.topic.relative_url %>"><%= @topic_view.topic.title %></a>
|
||||
<%= render_topic_title(@topic_view.topic) %>
|
||||
|
||||
</h2>
|
||||
<% (@post ? [@post] : @topic_view.posts).each do |post| %>
|
||||
<div class='creator'>
|
||||
|
@ -12,7 +13,7 @@
|
|||
|
||||
<% if @next_page%>
|
||||
<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>
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user