This commit is contained in:
nieguanghui 2013-11-09 09:26:02 +08:00
parent 57c28102e9
commit 6352ae7aa6
2 changed files with 18 additions and 8 deletions

View File

@ -428,7 +428,7 @@ class UsersController < ApplicationController
if params[:user].present? if params[:user].present?
user_temp = User.find_by_sql("select id from users where firstname like '%#{params[:user]}%' or lastname like '%#{params[:user]}%'") user_temp = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:user]}%' or lastname like '%#{params[:user]}%'")
if user_temp.size > 1 if user_temp.size > 1
activity = Activity.where('user_id in (?)', user_temp).where('user_id in (?)', watcher).order('id desc') activity = Activity.where('user_id in (?)', user_temp).where('user_id in (?)', watcher).order('id desc')

View File

@ -1,11 +1,21 @@
<% if User.current.id == @user.id%> <% if User.current.id == @user.id%>
<%= show_activity @state%> <%= show_activity @state%>
<%= form_tag(:controller => 'users', :action => "show") do %> <%= form_tag(:controller => 'users', :action => "show") do %>
<div class="user-search-block" style="float:right;margin-top:-55px">
<% end %> <table width="100%" valign="center">
<% end %> <tr>
<% unless @state == 2%> <td align="right">
<% unless @activity.empty? %> <div class="project-search">
<%= text_field_tag 'user', params[:user], :size => 30 %>
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
</div></td>
</tr>
</table>
</div>
<% end %>
<% end %>
<% unless @state == 2%>
<% unless @activity.empty? %>
<div id="activity"> <div id="activity">
<% @activity.each do |e| %> <% @activity.each do |e| %>
<% act = e.act %> <% act = e.act %>