at所有人

This commit is contained in:
cxt 2016-08-24 17:46:18 +08:00
parent 7682a4d45d
commit 21c48ea383
2 changed files with 10 additions and 10 deletions

View File

@ -10,7 +10,7 @@ class AtController < ApplicationController
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
#加上all #加上all
if @user && @users.size > 0 if User.current.logged? && @users.size > 0
allUser = Struct.new(:id, :name).new allUser = Struct.new(:id, :name).new
allUser.id = @users.map{|u| u.id}.join(",") allUser.id = @users.map{|u| u.id}.join(",")
allUser.name = "all" allUser.name = "all"

View File

@ -1,11 +1,11 @@
[ [
<% @users && @users.each_with_index do |person,index| %> <% @users && @users.each_with_index do |person,index| %>
<% if index == 0 %> <% if index == 0 %>
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "", "searchKey": ""} {"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"}
<%= index != @users.size-1 ? ',' : '' %> <%= index != @users.size-1 ? ',' : '' %>
<% else %> <% else %>
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"} {"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
<%= index != @users.size-1 ? ',' : '' %> <%= index != @users.size-1 ? ',' : '' %>
<% end %> <% end %>
<% end %> <% end %>
] ]