添加了论坛加tag功能
This commit is contained in:
parent
d882dde164
commit
4f00b12016
|
@ -645,6 +645,8 @@ class UsersController < ApplicationController
|
|||
@obj = Issue.find_by_id(@obj_id)
|
||||
when '4' then
|
||||
@obj = Bid.find_by_id(@obj_id)
|
||||
when '5' then
|
||||
@obj = Forum.find_by_id(@obj_id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -14,4 +14,7 @@ class Forum < ActiveRecord::Base
|
|||
validates_length_of :description, maximum: 255
|
||||
validates :name, :uniqueness => true
|
||||
|
||||
acts_as_taggable
|
||||
scope :by_join_date, order("created_at DESC")
|
||||
|
||||
end
|
||||
|
|
|
@ -25,7 +25,14 @@
|
|||
<td colspan="2" ><span class="font_description"><%= forum.description%></span></td>
|
||||
</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>
|
||||
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring forum.created_at, forum.creator %>
|
||||
|
|
|
@ -2,48 +2,45 @@
|
|||
<div class="top-content">
|
||||
<table width="940px">
|
||||
<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 rowspan="2">
|
||||
<% if User.current.logged? %>
|
||||
<%= link_to("新建讨论区", new_forum_path, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td rowspan="2" >
|
||||
<!-- 搜索 -->
|
||||
</td>
|
||||
<td rowspan="2" ><!-- 搜索 --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to "forge.trustie.net/forums", forums_path %> </a></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to "讨论区", forums_path %></td>
|
||||
<td ><%= link_to l(:field_homepage), home_path %> > <%= link_to "讨论区", forums_path %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %>
|
||||
|
||||
|
||||
<!-- <h1>Listing forums</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>description</th>
|
||||
<th>creator</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>description</th>
|
||||
<th>creator</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @forums.each do |forum| %>
|
||||
<tr>
|
||||
<td><%= forum.name %></td>
|
||||
<td><%= forum.description %></td>
|
||||
<td><%= forum.creator.show_name %></td>
|
||||
<td><%= link_to 'Show', forum %></td>
|
||||
<td><%= link_to 'Edit', edit_forum_path(forum) %></td>
|
||||
<td><%= link_to 'Destroy', forum, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= forum.name %></td>
|
||||
<td><%= forum.description %></td>
|
||||
<td><%= forum.creator.show_name %></td>
|
||||
<td><%= link_to 'Show', forum %></td>
|
||||
<td><%= link_to 'Edit', edit_forum_path(forum) %></td>
|
||||
<td><%= link_to 'Destroy', forum, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
<div class="user_tags">
|
||||
<div id="tags">
|
||||
<!-- 此处为tag -->
|
||||
标签
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%>
|
||||
</div></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="tags">
|
||||
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 -->
|
||||
<!-- 1代表是user类型 2代表是project类型 3代表是issue类型 4代表的是bid类型 5代表的是forum类型 -->
|
||||
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
|
||||
<% if object_flag == '3' %>
|
||||
<span><%= image_tag("/images/sidebTar/tags.png") %></span>
|
||||
|
@ -8,10 +8,10 @@
|
|||
<span> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %></span>
|
||||
<% end %>
|
||||
|
||||
<div id="tags_show_issue">
|
||||
<div id="tags_show_issue">
|
||||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<div id="put-tag-form-issue" style="display: none">
|
||||
</div>
|
||||
<div id="put-tag-form-issue" style="display: none">
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => '$("#put-tag-form-issue").hide();' do |f| %>
|
||||
|
@ -21,22 +21,22 @@
|
|||
<%= f.submit l(:button_project_tags_add),:class => "small"%>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
|
||||
<span><%= image_tag("/images/sidebar/tags.png") %></span>
|
||||
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
|
||||
<% else %>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %></span>
|
||||
<% end %>
|
||||
<span><%= image_tag("/images/sidebar/tags.png") %></span>
|
||||
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
|
||||
|
||||
<div id="tags_show">
|
||||
<% if User.current.logged? %>
|
||||
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %></span>
|
||||
<% end %>
|
||||
|
||||
<div id="tags_show">
|
||||
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||
</div>
|
||||
<div id="put-tag-form" style="display: none">
|
||||
</div>
|
||||
<div id="put-tag-form" style="display: none">
|
||||
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
|
||||
:update => "tags_show",
|
||||
:complete => '$("#put-tag-form").hide();' do |f| %>
|
||||
|
@ -46,6 +46,6 @@
|
|||
<%= f.submit l(:button_project_tags_add),:class => "small" %>
|
||||
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue