parent
0532c68044
commit
24a278d7d6
@ -1,6 +1,11 @@
|
||||
[
|
||||
<% @users && @users.each_with_index do |person,index| %>
|
||||
<% if index == 0 %>
|
||||
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"}
|
||||
<%= index != @users.size-1 ? ',' : '' %>
|
||||
<% else %>
|
||||
{"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
|
||||
<%= index != @users.size-1 ? ',' : '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,23 @@
|
||||
#coding=utf-8
|
||||
|
||||
module Trustie
|
||||
module At
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
module ClassMethods
|
||||
def act_as_at_message(content, send_id)
|
||||
self.send :define_method, :act_as_at_message_func do
|
||||
users = self[content].scan /<span class="at" data-user-id="(.+?)">/m
|
||||
users && users.flatten.uniq.each do |uids|
|
||||
uids.split(",").each do |uid|
|
||||
self.at_messages << AtMessage.new(user_id: uid, sender_id: self[send_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ActiveRecord::Base.send(:include, Trustie::At)
|
Loading…
Reference in new issue