更换顶踩图标,添加对需求的tag搜索,重新美化了tag的搜索页面

This commit is contained in:
william 2013-08-17 11:16:42 +08:00
parent 711a32e929
commit 6521ab2ce9
15 changed files with 75 additions and 44 deletions

View File

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

View File

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

View File

@ -8,27 +8,29 @@
<% if @flag == 1 %> <!-- 顶过 -->
<table style="line-height: 1px">
<tr>
<td ><%= image_tag("/images/praise_tread/praise_true.png") %></td>
<td ><%= image_tag "/images/praise_tread/praise_true.png" ,:title => '已顶!'%></td>
</tr>
<tr>
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
</tr>
<tr>
<td><%= image_tag("/images/praise_tread/tread_false.png") %></td>
<td><%= image_tag "/images/praise_tread/tread_false.png",:title => "已评价!" %></td>
</tr>
</table>
<% elsif @flag == 0 %> <!-- 踩过 0-->
<table style="line-height: 1px">
<tr>
<td > <%= image_tag("/images/praise_tread/praise_false.png") %></td>
<td > <%= image_tag "/images/praise_tread/praise_false.png", :title => '已评价!'%></td>
</tr>
<tr>
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
</tr>
<tr>
<td><%= image_tag("/images/praise_tread/tread_true.png") %> </td>
<td><%= image_tag "/images/praise_tread/tread_true.png",:title => '已踩!' %> </td>
</tr>
</table>
<% end %>
@ -37,14 +39,14 @@
<table style="line-height: 1px">
<tr>
<td > <%= link_to image_tag("/images/praise_tread/praise_false.png"),
<td > <%= 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%> </td>
</tr>
<tr>
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
</tr>
<tr>
<td> <%= link_to image_tag("/images/praise_tread/tread_false.png"),:controller=>"praise_tread",
<td> <%= 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 %></td>
</tr>
</table>

View File

@ -0,0 +1,13 @@
<div id="issues">
<% if bids_results.size > 0 %>
<hr />
<% bids_results.each do |bid| %>
<p class="font_description2">
<strong><%= l(:label_tags_bid) %>:<%= link_to "#{bid.name}",:controller => "bids",:action => "show",:id => bid.id %></strong>
<br />
<strong><%= l(:label_tags_bid_description) %>:</strong><%= bid.description %>
</p>
<div class="line_under"></div>
<% end %>
<% end %>
</div>

View File

@ -1,13 +1,14 @@
<div id="issues">
<% if issues_results.size > 0 %>
<hr />
<h3>Issues:</h3>
<% if issues_results.size > 0 %>
<hr />
<% issues_results.each do |issue| %>
<p class="font_description2">
<strong><%= l(:label_tags_issue) %><%= link_to "#{issue.subject}",:controller => "issues",:action => "show",:id => issue.id %></strong>
<br />
<strong><%= l(:label_tags_issue_description) %></strong><%= issue.description %>
</p>
<div class="line_under"></div>
<% end %>
<% issues_results.each do |issue| %>
<li>
<%= l(:label_tags_issue) %><%= link_to "#{issue.subject}",:controller => "issues",:action => "show",:id => issue.id %>
</li>
<% end %>
<% end %>
<% end %>
</div>

View File

@ -1,11 +1,13 @@
<div id="projects">
<% if projects_results.size > 0 %>
<hr />
<strong>Projects:</strong>
<% projects_results.each do |prj| %>
<div>
<h3><strong><%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %></strong></h3>
<p class="font_description2"><strong><%= l(:label_tags_project_description) %></strong><%= prj.description %>;</p>
<p class="font_description2">
<strong><%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %></strong>
<br />
<strong><%= l(:label_tags_project_description) %></strong><%= prj.description %>
</p>
</div>
<div class="line_under"></div>
<% end %>

View File

@ -1,15 +1,14 @@
<div id="users">
<% if users_results.size > 0 %>
<hr />
<h3>Users:</h3>
<% users_results.each do |user| %>
<li>
<%= l(:label_username) %><%= link_to ("#{user.firstname+user.lastname}"),
:controller => "users",:action => "show",:id => user.id%>
<br />
<%= l(:label_tags_user_mail) %><%= mail_to(h(user.mail)) %>
</li>
<% end %>
<% end %>
<% if users_results.size > 0 %>
<hr />
<% users_results.each do |user| %>
<p class="font_description2">
<strong><%= l(:label_username) %><%= link_to ("#{user.firstname+user.lastname}"),
:controller => "users",:action => "show",:id => user.id%></strong>
<br />
<strong><%= l(:label_tags_user_mail) %></strong><%= mail_to(h(user.mail)) %>
</p>
<div class="line_under"></div>
<% end %>
<% end %>
</div>

View File

@ -2,14 +2,19 @@
<% unless show_flag.nil? %>
<% case %>
<% when show_flag == '1' %>
<strong><%=l(:label_user)%><strong>
<%= render :partial => "show_users",:locals => {:users_results => users_results }%>
<% when show_flag == '2'%>
<strong><%=l(:label_project)%></strong>
<%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%>
<% when show_flag == '3'%>
<strong><%=l(:label_issue)%></strong>
<%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%>
<% when show_flag == '4'%>
<strong><%= l(:label_requirement)%></strong>
<%= render :partial => "show_bids",:locals => {:bids_results => bids_results }%>
<% else %>
<strong><%= l(:label_tags_all_objects)%></strong>
<%= 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 }%>

View File

@ -1,19 +1,13 @@
<% content_for :sidebar do %>
<div>
<ul>
<li>
<strong>Selected Tags</strong>
</li>
<strong>Selected Tags</strong>
<div id="selected_tags">
<%= render :partial => "selected_tags",:locals => {:selected_tags => $selected_tags,:show_flag => @obj_flag}%>
</div>
<li>
<strong>Related Tags</strong>
</li>
<strong>Related Tags</strong>
<div id="related_tags">
<%= render :partial => "related_tags",:locals => {:related_tags => $related_tags,:show_flag => @obj_flag }%>
</div>
</ul>
</div>
<% 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 %>)
</div>
<div id="show_results">
<%= 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}%>
</div>
</div>
<% end %>

View File

@ -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: 用户邮箱:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB