diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index ac2a5236b..c9d58c0a6 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -14,6 +14,7 @@ class TagsController < ApplicationController helper :projects include TagsHelper helper :tags + include OpenSourceProjectsHelper before_filter :require_admin,:only => [:delete,:show_all] @@ -53,7 +54,7 @@ class TagsController < ApplicationController end @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, - @forum_tags_num, @attachments_tags_num = get_tags_size + @forum_tags_num, @attachments_tags_num, @open_source_projects_num = get_tags_size # 获取搜索结果 @obj,@obj_pages,@results_count,@users_results, @@ -61,7 +62,8 @@ class TagsController < ApplicationController @issues_results, @bids_results, @forums_results, - @attachments_results = refresh_results(@obj_id,@obj_flag,@selected_tags) + @attachments_results, + @open_source_projects_results = refresh_results(@obj_id,@obj_flag,@selected_tags) # 这里是做tag推荐用的, 用来生产推荐的tags unless @obj.nil? @@ -172,6 +174,7 @@ private @bids_results = nil @forums_results = nil attachments_results = nil + @open_source_projects_results = nil @obj_pages = nil @obj = nil @@ -195,10 +198,13 @@ private when '6' @obj = Attachment.find_by_id(obj_id) @obj_pages, attachments_results, @results_count = for_pagination(get_attachments_by_tag(selected_tags)) + when '7' + @obj = OpenSourceProject.find_by_id(obj_id) + @obj_pages, @open_source_projects_results, @results_count = for_pagination(get_open_source_projects_by_tag(selected_tags)) else @obj = nil end - return @obj,@obj_pages,@results_count,@users_results,@projects_results,@issues_results,@bids_results,@forums_results, attachments_results + return @obj,@obj_pages,@results_count,@users_results,@projects_results,@issues_results,@bids_results,@forums_results, attachments_results, @open_source_projects_results end def for_pagination(results) @@ -218,7 +224,8 @@ private @bids_tags_num = Bid.tag_counts.size forum_tags_num = Forum.tag_counts.size attachment_tags_num = Attachment.tag_counts.size - return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num + @open_source_projects_num = OpenSourceProject.tag_counts.size + return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @open_source_projects_num end # 通过数字 来转换出对象的类型 @@ -239,6 +246,8 @@ private return 'Forum' when '6' return 'Attachment' + when '7' + return 'OpenSourceProject' else render_error :message => e.message return diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f8acafc1f..6777be9be 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -445,6 +445,10 @@ module ApplicationHelper def authoring(created, author, options={}) l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe end + + def added_time(created) + l(:label_added_time, :age => time_tag(created)).html_safe + end #huang def betweentime(enddate) diff --git a/app/helpers/open_source_projects_helper.rb b/app/helpers/open_source_projects_helper.rb index 69ce66c61..f758580d9 100644 --- a/app/helpers/open_source_projects_helper.rb +++ b/app/helpers/open_source_projects_helper.rb @@ -3,16 +3,16 @@ module OpenSourceProjectsHelper s=''.html_safe unless app_dir.nil? s_temp = content_tag('a', app_dir) - temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :language => language, :created_at => created_at, :name => name} + temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :language => language, :created_at => created_at, :name => name} temp = content_tag('span', temp, :class => 'del') s_temp << temp s_temp = content_tag('span', s_temp, :class => 'tag_show') s << content_tag('div', s_temp, :id => 'tag') - + end unless language.nil? s_temp = content_tag('a', language) - temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :app_dir => app_dir, :created_at => created_at, :name => name} + temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :app_dir => app_dir, :created_at => created_at, :name => name} temp = content_tag('span', temp, :class => 'del') s_temp << temp s_temp = content_tag('span', s_temp, :class => 'tag_show') @@ -20,7 +20,7 @@ module OpenSourceProjectsHelper end unless created_at.nil? s_temp = content_tag('a', created_at) - temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :app_dir => app_dir, :language => language, :name => name} + temp = link_to 'x', {:controller => "open_source_projects", :action => "remove_condition", :app_dir => app_dir, :language => language, :name => name} temp = content_tag('span', temp, :class => 'del') s_temp << temp s_temp = content_tag('span', s_temp, :class => 'tag_show') @@ -30,4 +30,8 @@ module OpenSourceProjectsHelper s = content_tag('div', s, :id => 'tags') s = content_tag('div', s, :class => 'user_tags') end + + def get_open_source_projects_by_tag(tag_name) + OpenSourceProject.tagged_with(tag_name).order('created_at desc') + end end diff --git a/app/views/relative_memos/show.html.erb b/app/views/relative_memos/show.html.erb index 69ea0de41..0b51ec1f4 100644 --- a/app/views/relative_memos/show.html.erb +++ b/app/views/relative_memos/show.html.erb @@ -1,6 +1,11 @@
<%=link_to @memo.author.name, user_path(@memo.author) if @memo.author%>
+
<% if @memo.attachments.any?%> <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %> <% end %>
- <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) if reply.author %> + <% if reply.author%> + <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> + <% else %> + <%= image_tag('../images/avatars/User/0', :class => "avatar") %> + <% end %> |
<%=h reply.content.html_safe %>
@@ -121,7 +138,12 @@
|
<%= authoring reply.created_at, reply.author.name if reply.author %> | ++ <% if reply.author %> + <%= authoring reply.created_at, reply.author.name %> + <% else %> + <%= added_time reply.created_at %> + <% end %> |
+ <%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "open_source_projects",:action => "show",:id => prj.id %>
+
+ <%= l(:label_tags_project_description) %><%= prj.short_description %>
+