Merge branch 'forum' of 10.0.47.245:/home/trustie2 into forum

This commit is contained in:
yanxd 2013-11-25 15:06:18 +08:00
commit 24a12115b0
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)
when '4' then
@obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
else
@obj = nil
end

View File

@ -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

View File

@ -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 %>

View File

@ -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">
<td rowspan="2">
<% if User.current.logged? %>
<%= link_to("新建讨论区", new_forum_path, :class => 'icon icon-add') %>
<% end %>
</td>
<td rowspan="2" >
<!-- 搜索 -->
<% end %>
</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>

View File

@ -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>

View File

@ -20,7 +20,7 @@
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%=render :partial => 'layouts/base_header'%>
<%=render :partial => 'layouts/base_header'%>
<div id="main">
<!-- added by bai -->

View File

@ -1,51 +1,51 @@
<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>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<% if User.current.logged? %>
<% if object_flag == '3' %>
<span><%= image_tag("/images/sidebTar/tags.png") %></span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<% if User.current.logged? %>
<span> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %></span>
<% end %>
<% end %>
<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">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form-issue").hide();' do |f| %>
<%= f.text_field :name ,:id => "name-issue",:size=>"30",:require=>true,:maxlength => 25,:minlength=>1 %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small"%>
<%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%>
<% end %>
</div>
</div>
<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">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form-issue").hide();' do |f| %>
<%= f.text_field :name ,:id => "name-issue",:size=>"30",:require=>true,:maxlength => 25,:minlength=>1 %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small"%>
<%= link_to_function l(:button_cancel), '$("#put-tag-form-issue").hide();'%>
<% end %>
</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>
<span><%= image_tag("/images/sidebar/tags.png") %></span>
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<% 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">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form").hide();' do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
<% end %>
</div>
<% 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">
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form").hide();' do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<%= link_to_function l(:button_cancel), '$("#put-tag-form").hide();'%>
<% end %>
</div>
</div>
<% end %>