添加了论坛加tag功能

This commit is contained in:
fanqiang 2013-11-24 20:45:04 +08:00
parent d882dde164
commit 4f00b12016
7 changed files with 78 additions and 69 deletions

View File

@ -645,6 +645,8 @@ class UsersController < ApplicationController
@obj = Issue.find_by_id(@obj_id) @obj = Issue.find_by_id(@obj_id)
when '4' then when '4' then
@obj = Bid.find_by_id(@obj_id) @obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
else else
@obj = nil @obj = nil
end end

View File

@ -14,4 +14,7 @@ class Forum < ActiveRecord::Base
validates_length_of :description, maximum: 255 validates_length_of :description, maximum: 255
validates :name, :uniqueness => true validates :name, :uniqueness => true
acts_as_taggable
scope :by_join_date, order("created_at DESC")
end end

View File

@ -25,7 +25,14 @@
<td colspan="2" ><span class="font_description"><%= forum.description%></span></td> <td colspan="2" ><span class="font_description"><%= forum.description%></span></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" ><span class="font_description">标签~~~~~~~~~~</span></td> <td colspan="2" ><span class="font_description">
<div class="tags">
<div id="tags">
<%= image_tag( "/images/sidebar/tags.png") %>
<%= render :partial => 'tags/tag_name', :locals => {:obj => forum,:object_flag => "5",:non_list_all => true }%>
</div>
</div></span>
</td>
</tr> </tr>
<tr> <tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring forum.created_at, forum.creator %> <td align="left" colspan="2" ><span class="font_lighter"><%= authoring forum.created_at, forum.creator %>

View File

@ -2,16 +2,14 @@
<div class="top-content"> <div class="top-content">
<table width="940px"> <table width="940px">
<tr> <tr>
<td class="info_font" style="width: 220px; color: #15bccf"">讨论区 </td> <td class="info_font" style="width: 220px; color: #15bccf">讨论区 </td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td> <td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2"> <td rowspan="2">
<% if User.current.logged? %> <% if User.current.logged? %>
<%= link_to("新建讨论区", new_forum_path, :class => 'icon icon-add') %> <%= link_to("新建讨论区", new_forum_path, :class => 'icon icon-add') %>
<% end %> <% end %>
</td> </td>
<td rowspan="2" > <td rowspan="2" ><!-- 搜索 --></td>
<!-- 搜索 -->
</td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/forums", forums_path %> </a></td> <td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/forums", forums_path %> </a></td>
@ -22,7 +20,6 @@
<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> <%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %>
<!-- <h1>Listing forums</h1> <!-- <h1>Listing forums</h1>
<table> <table>

View File

@ -138,7 +138,7 @@
<div class="user_tags"> <div class="user_tags">
<div id="tags"> <div id="tags">
<!-- 此处为tag --> <!-- 此处为tag -->
标签 <%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%>
</div></div> </div></div>
</div> </div>

View File

@ -1,5 +1,5 @@
<div id="tags"> <div id="tags">
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 --> <!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表的是bid类型 5代表的是forum类型 -->
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 --> <!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
<% if object_flag == '3' %> <% if object_flag == '3' %>
<span><%= image_tag("/images/sidebTar/tags.png") %></span> <span><%= image_tag("/images/sidebTar/tags.png") %></span>
@ -22,7 +22,7 @@
<%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%> <%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%>
<% end %> <% end %>
</div> </div>
</div>
<% else %> <% else %>
@ -47,5 +47,5 @@
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%> <%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
<% end %> <% end %>
</div> </div>
</div>
<% end %> <% end %>
</div>