diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 9aac1c934..ab05474fe 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -5,6 +5,7 @@ class TagsController < ApplicationController include ProjectsHelper include IssuesHelper include UsersHelper + include BidsHelper include ActsAsTaggableOn::TagsHelper $selected_tags = Array.new @@ -18,10 +19,12 @@ class TagsController < ApplicationController @issues_tags_num = Issue.tag_counts.size @projects_tags_num = Project.tag_counts.size @users_tags_num = User.tag_counts.size + @bids_tags_num = Bid.tag_counts.size @issues_results = get_issues_by_tag($selected_tags) @projects_results = get_projects_by_tag($selected_tags) @users_results = get_users_by_tag($selected_tags) + @bids_results = get_bids_by_tag($selected_tags) @obj_id = params[:obj_id] @obj_flag = params[:object_flag] diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb index 99154e75f..71f73ff39 100644 --- a/app/helpers/bids_helper.rb +++ b/app/helpers/bids_helper.rb @@ -30,4 +30,11 @@ module BidsHelper onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;" link_to text, '#', options.merge(:onclick => onclick) end + + # this method is used to get all projects that tagged one tag + # added by william + def get_bids_by_tag(tag_name) + Bid.tagged_with(tag_name) + end + end \ No newline at end of file diff --git a/app/views/praise_tread/_praise_tread.html.erb b/app/views/praise_tread/_praise_tread.html.erb index 5c90b9720..b6dee9319 100644 --- a/app/views/praise_tread/_praise_tread.html.erb +++ b/app/views/praise_tread/_praise_tread.html.erb @@ -8,27 +8,29 @@ <% if @flag == 1 %> - + - +
<%= image_tag("/images/praise_tread/praise_true.png") %><%= image_tag "/images/praise_tread/praise_true.png" ,:title => '已顶!'%>
<%= get_praise_num(obj)%>
<%= image_tag("/images/praise_tread/tread_false.png") %><%= image_tag "/images/praise_tread/tread_false.png",:title => "已评价!" %>
+ <% elsif @flag == 0 %> + - + - +
<%= image_tag("/images/praise_tread/praise_false.png") %> <%= image_tag "/images/praise_tread/praise_false.png", :title => '已评价!'%>
<%= get_praise_num(obj)%>
<%= image_tag("/images/praise_tread/tread_true.png") %> <%= image_tag "/images/praise_tread/tread_true.png",:title => '已踩!' %>
<% end %> @@ -37,14 +39,14 @@ - -
<%= link_to image_tag("/images/praise_tread/praise_false.png"), + <%= link_to image_tag("/images/praise_tread/praise_false.png",:title => '好问题,顶!'), :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class%>
<%= get_praise_num(obj)%>
<%= link_to image_tag("/images/praise_tread/tread_false.png"),:controller=>"praise_tread", + <%= link_to image_tag("/images/praise_tread/tread_false.png",:title => '烂问题,踩!'),:controller=>"praise_tread", :action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class %>
diff --git a/app/views/tags/_show_bids.html.erb b/app/views/tags/_show_bids.html.erb new file mode 100644 index 000000000..fd46f87f1 --- /dev/null +++ b/app/views/tags/_show_bids.html.erb @@ -0,0 +1,13 @@ +
+ <% if bids_results.size > 0 %> +
+ <% bids_results.each do |bid| %> +

+ <%= l(:label_tags_bid) %>:<%= link_to "#{bid.name}",:controller => "bids",:action => "show",:id => bid.id %> +
+ <%= l(:label_tags_bid_description) %>:<%= bid.description %> +

+
+ <% end %> + <% end %> +
\ No newline at end of file diff --git a/app/views/tags/_show_issues.html.erb b/app/views/tags/_show_issues.html.erb index 9c874ff9d..e29edb305 100644 --- a/app/views/tags/_show_issues.html.erb +++ b/app/views/tags/_show_issues.html.erb @@ -1,13 +1,14 @@
-<% if issues_results.size > 0 %> -
-

Issues:

+ <% if issues_results.size > 0 %> +
+ <% issues_results.each do |issue| %> +

+ <%= l(:label_tags_issue) %><%= link_to "#{issue.subject}",:controller => "issues",:action => "show",:id => issue.id %> +
+ <%= l(:label_tags_issue_description) %>:<%= issue.description %> +

+
+ <% end %> -<% issues_results.each do |issue| %> -
  • - <%= l(:label_tags_issue) %><%= link_to "#{issue.subject}",:controller => "issues",:action => "show",:id => issue.id %> -
  • -<% end %> - -<% end %> + <% end %>
    diff --git a/app/views/tags/_show_projects.html.erb b/app/views/tags/_show_projects.html.erb index b4eb6f0a4..aa9f58741 100644 --- a/app/views/tags/_show_projects.html.erb +++ b/app/views/tags/_show_projects.html.erb @@ -1,11 +1,13 @@
    <% if projects_results.size > 0 %>
    -Projects: <% projects_results.each do |prj| %>
    -

    <%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %>

    -

    <%= l(:label_tags_project_description) %><%= prj.description %>;

    +

    + <%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %> +
    + <%= l(:label_tags_project_description) %><%= prj.description %> +

    <% end %> diff --git a/app/views/tags/_show_results.html.erb b/app/views/tags/_show_results.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/tags/_show_users.html.erb b/app/views/tags/_show_users.html.erb index c7574d0bd..7ce8328f7 100644 --- a/app/views/tags/_show_users.html.erb +++ b/app/views/tags/_show_users.html.erb @@ -1,15 +1,14 @@
    -<% if users_results.size > 0 %> -
    -

    Users:

    - -<% users_results.each do |user| %> -
  • - <%= l(:label_username) %><%= link_to ("#{user.firstname+user.lastname}"), - :controller => "users",:action => "show",:id => user.id%> -
    - <%= l(:label_tags_user_mail) %><%= mail_to(h(user.mail)) %> -
  • -<% end %> -<% end %> + <% if users_results.size > 0 %> +
    + <% users_results.each do |user| %> +

    + <%= l(:label_username) %><%= link_to ("#{user.firstname+user.lastname}"), + :controller => "users",:action => "show",:id => user.id%> +
    + <%= l(:label_tags_user_mail) %><%= mail_to(h(user.mail)) %> +

    +
    + <% end %> + <% end %>
    \ No newline at end of file diff --git a/app/views/tags/_tag_search_results.html.erb b/app/views/tags/_tag_search_results.html.erb index 68f1f2014..9e816af8a 100644 --- a/app/views/tags/_tag_search_results.html.erb +++ b/app/views/tags/_tag_search_results.html.erb @@ -2,14 +2,19 @@ <% unless show_flag.nil? %> <% case %> <% when show_flag == '1' %> + <%=l(:label_user)%> <%= render :partial => "show_users",:locals => {:users_results => users_results }%> <% when show_flag == '2'%> + <%=l(:label_project)%> <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%> <% when show_flag == '3'%> + <%=l(:label_issue)%> <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <% when show_flag == '4'%> - + <%= l(:label_requirement)%> + <%= render :partial => "show_bids",:locals => {:bids_results => bids_results }%> <% else %> + <%= l(:label_tags_all_objects)%> <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <%= render :partial => "show_users",:locals => {:users_results => users_results }%> <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%> diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index 4f49b8b71..4fabfcf09 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -1,19 +1,13 @@ <% content_for :sidebar do %>
    -
      -
    • - Selected Tags -
    • + Selected Tags
      <%= render :partial => "selected_tags",:locals => {:selected_tags => $selected_tags,:show_flag => @obj_flag}%>
      -
    • - Related Tags -
    • + Related Tags -
    <% end %> <% content_for :content do %> @@ -23,11 +17,12 @@ <%= l(:label_tags_numbers) %> <%= l(:label_issue_plural) %>(<%= @issues_tags_num %>)| <%= l(:label_project_plural) %>(<%= @projects_tags_num %>)| - <%= l(:label_user_plural) %>(<%= @users_tags_num %>) + <%= l(:label_user_plural) %>(<%= @users_tags_num %>)| + <%= l(:label_bid_plural)%>(<%= @bids_tags_num %>)
    <%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results, - :projects_results => @projects_results,:users_results => @users_results ,:show_flag => @obj_flag}%> + :projects_results => @projects_results,:users_results => @users_results ,:bids_results=>@bids_results,:show_flag => @obj_flag}%>
    <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index a86c14bc6..7c4100732 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1169,6 +1169,10 @@ zh: button_follow: 关注 label_delete_confirm: 确认删除? label_more_tags: 更多 + label_tags_bid: 需求名称 + label_tags_bid_description: 需求描述 + label_tags_issue_description: 问题描述 + label_tags_all_objects: 所有 #fq button_leave_meassge: 留言 label_leave_message_to: 给用户 %{name}留言 @@ -1251,7 +1255,7 @@ zh: label_project_no_activity: 该项目暂无动态! label_follow_no_requirement: 暂未关注任何需求! label_no_user_respond_you: 暂无任何用户对您进行反馈! - label_tags_issue: 问题: + label_tags_issue: 问题名称: label_tags_project_name: 项目名称: label_tags_project_description: 项目描述: label_tags_user_mail: 用户邮箱: diff --git a/public/images/praise_tread/praise_false.png b/public/images/praise_tread/praise_false.png index b313b8417..8c46ede35 100644 Binary files a/public/images/praise_tread/praise_false.png and b/public/images/praise_tread/praise_false.png differ diff --git a/public/images/praise_tread/praise_true.png b/public/images/praise_tread/praise_true.png index e3ca14b5a..e21dd93dc 100644 Binary files a/public/images/praise_tread/praise_true.png and b/public/images/praise_tread/praise_true.png differ diff --git a/public/images/praise_tread/tread_false.png b/public/images/praise_tread/tread_false.png index 1b3e9af29..57927082b 100644 Binary files a/public/images/praise_tread/tread_false.png and b/public/images/praise_tread/tread_false.png differ diff --git a/public/images/praise_tread/tread_true.png b/public/images/praise_tread/tread_true.png index b0a8ac7fa..f70828de1 100644 Binary files a/public/images/praise_tread/tread_true.png and b/public/images/praise_tread/tread_true.png differ