完善tag的搜索功能。赞的显示优化。

This commit is contained in:
william 2013-08-10 22:54:16 +08:00
parent 614f3d3f9f
commit 622008366d
11 changed files with 158 additions and 96 deletions

View File

@ -10,6 +10,7 @@ class TagsController < ApplicationController
$selected_tags = Array.new
$related_tags = Array.new
def index
$selected_tags = []
@ -25,7 +26,9 @@ class TagsController < ApplicationController
@users_results = get_users_by_tag($selected_tags)
@obj_id = params[:obj_id]
case params[:object_flag]
@show_flag = params[:object_flag]
case @show_flag
when '1' then
@obj = User.find_by_id(@obj_id)
when '2' then

View File

@ -47,7 +47,7 @@
<% if @tags.size > 0 %>
<% @tags.each do |tag| %>
<div id="tag" class="click unclick">
<%= link_to tag,:controller => "tags",:action => "index",:q=>tag ,:object_flag => object_flag,:obj_id => obj.id %>
<%= link_to tag,:controller => "tags",:action => "index",:q=>tag ,:object_flag => object_flag,:obj_id => obj.id %>
</div>
<% end %>
<% end %>

View File

@ -10,7 +10,7 @@
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
@ -19,40 +19,38 @@
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<%=render :partial => 'layouts/base_header'%>
<div id="wrapper3">
<%= render :partial => 'layouts/base_header'%>
<div id="main">
<!--user page, add by huang-->
<!--user page, add by huang-->
<div id="sidebar">
<div class="main_context">
<div class="spaceleft">
<div class="inf_user_image">
<div class="spaceleft">
<div class="inf_user_image">
<table>
<tr>
<td align="left" valign="middle" ><%= link_to image_tag(url_to_avatar(@user), :class => 'avatar'), :class => "avatar" %></td>
<td>
<table>
<tr>
<td class="info_font" align="center"><%= h @user.name%> <img src="/images/sidebar/male.png" width="11" height="11"/> </td>
<td class="info_font" align="center"><%= h @user.name%> <img src="/images/sidebar/male.png" width="11" height="11"/></td>
</tr>
<tr>
<td align="center">
<% unless User.current == @user %>
<%= watcher_link(@user, User.current) %>
<% else %>
<%= link_to(l(:label_user_edit), edit_user_path(@user)) if User.current %><% end %></td>
<td align="center"> <% unless User.current == @user %>
<%= watcher_link(@user, User.current) %>
<% else %>
<%= link_to(l(:label_user_edit), edit_user_path(@user)) if User.current %><% end %></td>
</tr>
</table></td>
</tr>
</table>
<div id="praise_tread">
</div>
<div>
<%= l(:label_user_watcher) %> (<strong class="font_small_watch"><%= User.watched_by(@user.id).count %></strong>) &nbsp;
<%= render :partial => "watchers/fans_num",:locals => {:fans_num => get_fans_num(@user) }%>
</div>
<span id="praise_tread" style="float:right;"> <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @user,:show_flag => false,:user_id =>User.current.id}%> </span>
</div>
</div>
<div class="user_underline"></div>
<!--info-->
@ -60,7 +58,7 @@
<table style="font-family:微软雅黑">
<tr>
<td style="padding-left: 8px"><%= l(:label_user_joinin) %></td><td class="font_lighter_sidebar"><%= format_date(@user.created_on) %></td>
</tr>
</tr>
<tr>
<td style="padding-left: 8px"><%= l(:label_user_login) %></td><td class="font_lighter_sidebar"><%= format_date(@user.last_login_on) %></td>
</tr>
@ -68,23 +66,21 @@
<td style="padding-left: 8px"><%= l(:label_user_mail) %></td><td class="font_lighter_sidebar"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
</tr>
</table>
</div>
<div class="user_underline"></div>
<!--watch-->
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_user_watcher) %></strong>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_watcher_profile(@user) %>
</td>
</tr>
<td style="padding-top: 5px"> <%= show_watcher_profile(@user) %> </td>
</tr>
</table>
</div>
</div>
@ -93,45 +89,43 @@
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_user_fans) %></strong>
</div>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_fans_picture(@user) %>
</td>
</tr>
<td style="padding-top: 5px"> <%= show_fans_picture(@user) %> </td>
</tr>
</table>
</div>
</div>
<div class="user_underline"></div>
<div class="user_underline"></div>
</div>
</div>
</div>
<div id="content" style="padding-top: 0px;">
<div class="tabs_new">
<% if @user == User.current %>
<%= render_menu :user_menu_self %>
<%else%>
<%= render_menu :user_menu %>
<%end%>
</div>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
<div id="content" style="padding-top: 0px;">
<div class="tabs_new">
<% if @user == User.current %>
<%= render_menu :user_menu_self %>
<%else%>
<%= render_menu :user_menu %>
<%end%>
</div>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
<%= render_flash_messages %>
</div>
<%=render :partial => 'layouts/base_footer'%>
</div>
<%= render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -0,0 +1,16 @@
<div class="tags_left">
<ul>
<li>
Selected Tags
</li>
<div id="selected_tags">
<%= render :partial => "selected_tags",:locals => {:selected_tags => $selected_tags }%>
</div>
<li>
Related Tags
</li>
<div id="related_tags">
<%= render :partial => "related_tags",:locals => {:related_tags => $related_tags }%>
</div>
</ul>
</div>

View File

@ -0,0 +1,15 @@
<div class="tags_right">
<h2>Search Results</h2>
<div id="filter-menu" align="right">
<%= link_to "User",:action => "index"%>(<%= @issues_tags_num %>)|
<%= link_to "Project",:action => "index"%>(<%= @projects_tags_num %>) |
<%= link_to "Issue",:action => "index"%>(<%= @users_tags_num %>) |
<%= link_to "Bid",:action => "index"%> |
<%= link_to "All",:action => "index"%>
</div>
<div id="show_results">
<!-- 显示规则 0 全部显示 1显示users 2显示projects 3显示issues 4显示需求-->
<%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
:projects_results => @projects_results,:users_results => @users_results,:show_flag => @show_flag } %>
</div>
</div>

View File

@ -1,17 +1,17 @@
<div id="praise">
<span id="praise">
<% if is_praise_or_tread(obj,user_id).size > 0 %>
<%= image_tag("/images/praise.png") %>
<%= link_to "#{l(:label_cancel_praise)}",:controller=>"praise_tread",:action=>"praise_minus",:remote=>true,:obj => obj %>
(<%= get_praise_num(obj)%>)
(<strong class="font_small_watch"><%= get_praise_num(obj)%></strong>)
<% else %>
<%= image_tag("/images/tread.png") %>
<%= link_to "#{l(:label_praise)}",:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj => obj %>
(<%= get_praise_num(obj)%>)
(<strong class="font_small_watch"><%= get_praise_num(obj)%></strong>)
<% end %>
</div>
</span>
<% if show_flag %>
<div id="tread">
<span id="tread">
<%= link_to image_tag("/images/tread.png"),:controller=>"praise_tread",
:action=>"tread_minus",:remote=>true,:obj => obj %>踩
</div>
</span>
<% end %>

View File

@ -0,0 +1,13 @@
<div id="issues">
<% if issues_results.size > 0 %>
<hr />
<h3>Issues:</h3>
<% issues_results.each do |issue| %>
<li>
问题:<%= link_to "#{issue.subject}",:controller => "issues",:action => "show",:id => issue.id %>
</li>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,16 @@
<div id="projects">
<% if projects_results.size > 0 %>
<hr />
<h3>Projects:</h3>
<% projects_results.each do |project| %>
<li>
项目名称:<%= link_to project.name,:controller => "projects",:action => "show",:id => project.id %>
<br />
项目描述:<%= project.description %>;
</li>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,15 @@
<div id="users">
<% if users_results.size > 0 %>
<hr />
<h3>Users:</h3>
<% users_results.each do |user| %>
<li>
用户名:<%= link_to ("#{user.firstname+user.lastname}"),
:controller => "users",:action => "show",:id => user.id %>
<br />
用户邮箱:<%= mail_to(h(user.mail)) %>
</li>
<% end %>
<% end %>
</div>

View File

@ -1,36 +1,20 @@
<ul>
<% if issues_results.size > 0 %>
<hr />
<h3>Issues:</h3>
<% issues_results.each do |issue| %>
<li>
问题:<%= link_to "#{issue.subject}",:controller => "issues",:action => "show",:id => issue.id %>
</li>
<% end %>
<% end %>
<% if users_results.size > 0 %>
<hr />
<h3>Users:</h3>
<% users_results.each do |user| %>
<li>
用户名:<%= link_to ("#{user.firstname+user.lastname}"),
:controller => "users",:action => "show",:id => user.id %>
<br />
用户邮箱:<%= mail_to(h(user.mail)) %>
</li>
<% end %>
<% end %>
<% if projects_results.size > 0 %>
<hr />
<h3>Projects:</h3>
<% projects_results.each do |project| %>
<li>
项目名称:<%= link_to project.name,:controller => "projects",:action => "show",:id => project.id %>
<br />
项目描述:<%= project.description %>;
</li>
<% unless show_flag.nil? %>
<% case %>
<% when show_flag == '1' %>
<%= render :partial => "show_users",:locals => {:users_results => users_results }%>
<% when show_flag == '2'%>
<%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%>
<% when show_flag == '3'%>
<%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%>
<% when show_flag == '4'%>
<% else %>
<%= 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 }%>
<% end %>
<% else %>
<span>no data.</span>
<% end %>
</ul>

View File

@ -9,6 +9,11 @@
float:right;
}
</style>
<script type="text/javascript" language="JavaScript">
function show_selector(var id){
$('.issues')
}
</script>
<div class="tags_left">
<ul>
@ -30,14 +35,15 @@
<div class="tags_right">
<h2>Search Results</h2>
<div id="filter-menu" align="right">
<%= link_to "Issue",:action => "index"%>(<%= @issues_tags_num %>)|
<%= link_to "Project",:action => "index"%>(<%= @projects_tags_num %>) |
<%= link_to "User",:action => "index"%>(<%= @users_tags_num %>)
<%= toggle_link "Project", 'projects' %> (<%= @users_tags_num %>) |
<%= toggle_link "User", 'users' %> (<%= @projects_tags_num %>)|
<%= toggle_link "Issue", 'issues' %> (<%= @issues_tags_num %>)|
<%= link_to "Bid",:action => "index"%> ()|
<%= link_to "All",:action => "index"%> |
</div>
<div id="show_results">
<!-- 显示规则 0 全部显示 1显示users 2显示projects 3显示issues 4显示需求-->
<%= render :partial => "tag_search_results",:locals => {:issues_results => @issues_results,
:projects_results => @projects_results,:users_results => @users_results }%>
:projects_results => @projects_results,:users_results => @users_results,:show_flag => @show_flag } %>
</div>
</div>
</div>