From 6521ab2ce9dca9df693a337d33ed98a9cfeec657 Mon Sep 17 00:00:00 2001 From: william Date: Sat, 17 Aug 2013 11:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E9=A1=B6=E8=B8=A9=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AF=B9=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E7=9A=84tag=E6=90=9C=E7=B4=A2=EF=BC=8C=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E7=BE=8E=E5=8C=96=E4=BA=86tag=E7=9A=84=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/tags_controller.rb | 3 +++ app/helpers/bids_helper.rb | 7 +++++ app/views/praise_tread/_praise_tread.html.erb | 14 +++++----- app/views/tags/_show_bids.html.erb | 13 +++++++++ app/views/tags/_show_issues.html.erb | 21 ++++++++------- app/views/tags/_show_projects.html.erb | 8 +++--- app/views/tags/_show_results.html.erb | 0 app/views/tags/_show_users.html.erb | 25 +++++++++--------- app/views/tags/_tag_search_results.html.erb | 7 ++++- app/views/tags/index.html.erb | 15 ++++------- config/locales/zh.yml | 6 ++++- public/images/praise_tread/praise_false.png | Bin 3738 -> 2878 bytes public/images/praise_tread/praise_true.png | Bin 3739 -> 2875 bytes public/images/praise_tread/tread_false.png | Bin 3742 -> 2889 bytes public/images/praise_tread/tread_true.png | Bin 3741 -> 2884 bytes 15 files changed, 75 insertions(+), 44 deletions(-) create mode 100644 app/views/tags/_show_bids.html.erb delete mode 100644 app/views/tags/_show_results.html.erb 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 b313b8417ec71e6266aad9afbe8d7a6187a46e6d..8c46ede35090277bd0dad51d3aa8cb0ad3a6bf8d 100644 GIT binary patch delta 150 zcmV;H0BQf49ljQj83+ad000QlZ>X^$oC<#cYe_^wRCwCF&&v(KAPfUg;vKsGBJ9wS z+)IT7{SoRU7f?w2gl%;%&fEgn}s0cl8Hd1!w`%#3?-?IWD1n_qXPf{|NjF304yD(5KMR_00000NkvXXu0jG} EfNl-pJuT$^M3Yet44Sm*;ts_vTe;>iIUCZD(iaZHt=)x-_4jo)+;!f2Dn7JkwdN)>G?oV8;)L zwr^F&d85&oIs6vQeWNf;WBC#5Cbn8+n&^W zf6yQHC}|F-eeYzev}OJY=^c$mb8~Y;p-@1D!{Pq^{s;sjARr(xFfb@62#G`n2M33Q zgoK8MhJ}TNhlfW*L_|hLqEM))sHo`Z=$M$8*x1;(xVZTE_=JRn#Kgp;q@?8JBswy&>TwPra?xs?yH8nLf z8m+drwyv&@PN&z`*E1N5hK7d5#>S?mCMJ{F+}zv(wY0RhwzjpkwYRr-baZrfcCuJ3 zHk;km)z#hI&Ear*dU|?$d;9wO`uqC_1_roX?%?3y(9qEE@bJjU$mrqD%(K z`yN5^z1w~77>pn8 z>!{!VdDozGnsoXaQGg7Nd*gxjA$|EpIoId$Yo;&1-jCmUulsWY>NAI*#s${z=6a`* S^no{+4)c2P%9H&Zk@GJb`>%EY diff --git a/public/images/praise_tread/praise_true.png b/public/images/praise_tread/praise_true.png index e3ca14b5ab79c60db40d3aea3621d8dc912b6ce1..e21dd93dcf0ff356c8da5ec3678123b7cc710fff 100644 GIT binary patch delta 169 zcmbO&yIV}LGr-TCmrII^fq{Y7)59eQNJ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