修改帖子页面

This commit is contained in:
fanqiang 2014-05-27 16:25:43 +08:00
parent fdf8b5640a
commit 4c3e2376f0
4 changed files with 17 additions and 14 deletions

View File

@ -71,6 +71,11 @@ class RelativeMemo < ActiveRecord::Base
errors.add :base, l(:label_memo_locked) if root.locked? && self != root errors.add :base, l(:label_memo_locked) if root.locked? && self != root
end end
def short_content(length = 25)
str = "^(.{,#{length}})[^\n\r]*.*$"
content.gsub(Regexp.new(str), '\1...').strip if content
end
# def update_memos_forum # def update_memos_forum
# if forum_id_changed? # if forum_id_changed?
# Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id ]) # Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id ])

View File

@ -51,20 +51,18 @@
</table></td> </table></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" ><span class="font_description"> </span></td> <td><span class="font_description"><%= topic.short_content(70) %> </span></td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> <td align="left"><span class="font_lighter"><%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
<br /> <br />
</span></td> </span></td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" >帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to 'OSChina', topic.url %> <td align="left">帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to 'OSChina', topic.url %>
</span></td> </span></td>
<td align="left"><%= no_use_link(topic, User.current) %> </td> <td colspan="3" align="center"><%= no_use_link(topic, User.current) %> </td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>

View File

@ -51,17 +51,17 @@
</table></td> </table></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" ><span class="font_description"> </span></td> <td><span class="font_description"> </span></td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> <td align="left"><span class="font_lighter"><%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
<br /> <br />
</span></td> </span></td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" >帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to 'OSChina', topic.url %> <td align="left">帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to 'OSChina', topic.url %>
</span></td> </span></td>
<td align="left"><%= no_use_link(topic, User.current) %> </td> <td colspan="3" align="center"><%= no_use_link(topic, User.current) %> </td>
</tr> </tr>

View File

@ -467,17 +467,17 @@
</table></td> </table></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" ><span class="font_description"> </span></td> <td><span class="font_description"> </span></td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" ><span class="font_lighter"><%=user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> <td align="left"><span class="font_lighter"><%=user_url_and_time topic.username, topic.userhomeurl, topic.created_at %>
<br /> <br />
</span></td> </span></td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" >帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to 'OSChina', topic.url %> <td align="left">帖子来源:<span class="font_lighter" style="color: #068d9c"><%=link_to 'OSChina', topic.url %>
</span></td> </span></td>
<td align="left"><%= no_use_link(topic, User.current) %> </td> <td colspan="3" align="center"><%= no_use_link(topic, User.current) %> </td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>