From 4f00b12016333ce639dc190805d34b7cf6a62448 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Sun, 24 Nov 2013 20:45:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=AE=BA=E5=9D=9B?= =?UTF-8?q?=E5=8A=A0tag=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 + app/models/forum.rb | 3 + app/views/forums/_forum_list.html.erb | 9 ++- app/views/forums/index.html.erb | 45 ++++++------- app/views/layouts/base_forums.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 2 +- app/views/tags/_tag.html.erb | 84 ++++++++++++------------ 7 files changed, 78 insertions(+), 69 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 865987767..3d38ddbf8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/models/forum.rb b/app/models/forum.rb index 8a15171dc..993c00b23 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -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 diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index e5bd3b140..eb55e0711 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -25,7 +25,14 @@ <%= forum.description%> - 标签~~~~~~~~~~ + +
+
+ <%= image_tag( "/images/sidebar/tags.png") %> + <%= render :partial => 'tags/tag_name', :locals => {:obj => forum,:object_flag => "5",:non_list_all => true }%> +
+
+ <%= authoring forum.created_at, forum.creator %> diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 687a9b176..80c379ed0 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -2,48 +2,45 @@
- + - - + - +
讨论区 讨论区 <%= l(:label_user_location) %> : + <% if User.current.logged? %> <%= link_to("新建讨论区", new_forum_path, :class => 'icon icon-add') %> - <% end %> - - + <% end %>
<%= link_to "forge.trustie.net/forums", forums_path %> <%=link_to l(:field_homepage), home_path %> > <%=link_to "讨论区", forums_path %><%= link_to l(:field_homepage), home_path %> > <%= link_to "讨论区", forums_path %>
<%= render :partial => 'forums/forum_list', :locals => {:forums => @forums} %> - - 标签 + <%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 89c53e045..1ace56c1a 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -20,7 +20,7 @@
- <%=render :partial => 'layouts/base_header'%> + <%=render :partial => 'layouts/base_header'%>
diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index c3d0cb4b5..9597afc0b 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -1,51 +1,51 @@
- + - <% if object_flag == '3' %> - <%= image_tag("/images/sidebTar/tags.png") %> - <%= l(:label_tag) %>: - <% if User.current.logged? %> + <% if object_flag == '3' %> + <%= image_tag("/images/sidebTar/tags.png") %> + <%= l(:label_tag) %>: + <% if User.current.logged? %> <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %> - <% end %> + <% end %> -
- <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> -
- -
+
+ <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
+ -<% else %> -<%= image_tag("/images/sidebar/tags.png") %> -<%= l(:label_tag) %>: + <% else %> -<% if User.current.logged? %> -<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %> + <%= image_tag("/images/sidebar/tags.png") %> + <%= l(:label_tag) %>: + + <% if User.current.logged? %> + <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %> + <% end %> + +
+ <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
+ <% end %> - -
- <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
- -
-<% end %>