私信的页面的完成
This commit is contained in:
parent
82c5fbd4fe
commit
14353bceb6
|
@ -6,14 +6,25 @@ class PrivateMessagesController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
#用户更新私信为全部已读
|
#用户更新私信为全部已读
|
||||||
|
if User.current == @user || User.current.admin?
|
||||||
|
@onclick_time = User.current.onclick_time.onclick_time
|
||||||
|
User.current.onclick_time.update_attribute(:onclick_time, Time.now)
|
||||||
|
jours = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
|
||||||
|
|
||||||
jours = PrivateMessage.without_deleted.where("user_id = ?", @user.id).order("created_at desc")
|
@unred_all_messages = 0
|
||||||
|
@unred_private_messages = @user.unread_private_messages
|
||||||
|
# jours = PrivateMessage.without_deleted.where("user_id = ?", @user.id).order("created_at desc")
|
||||||
@limit = 20
|
@limit = 20
|
||||||
@jours_count = jours.count
|
@jours_count = jours.count
|
||||||
@jours_all_pages = Paginator.new @jours_count, @limit, params['page'] || 1
|
@jours_all_pages = Paginator.new @jours_count, @limit, params['page'] || 1
|
||||||
@offset ||= @jours_all_pages.offset
|
@offset ||= @jours_all_pages.offset
|
||||||
@jours_alls = paginateHelper jours, @limit
|
@jours_alls = paginateHelper jours, @limit
|
||||||
render :layout=>'base_user_message'
|
render :layout=>'base_user_message'
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -53,7 +64,7 @@ class PrivateMessagesController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
format.html{
|
format.html{
|
||||||
redirect_to user_private_message_path(current_user,@sender_message.id)
|
redirect_to private_messages_detail_user_private_messages_path(@user, target_ids: user_id)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -66,29 +77,47 @@ class PrivateMessagesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
|
||||||
@jour_messages = @user.journals_for_messages.where(m_parent_id: @jour.id)
|
|
||||||
|
|
||||||
render :layout=>'base_user_message'
|
|
||||||
end
|
|
||||||
|
|
||||||
def private_messages_detail
|
def private_messages_detail
|
||||||
@user_message_details = @user.private_messages.where(target_id: params[:target_ids])
|
if User.current == @user || User.current.admin?
|
||||||
@contact_user = User.find_by_id(params[:target_ids])
|
@unred_private_messages = 0
|
||||||
|
@unred_all_messages = 0
|
||||||
|
@target_user = User.where(:id => params[:target_ids]).includes(:user_extensions).first
|
||||||
|
if @target_user.present?
|
||||||
|
target_user_messages = @user.private_messages.where(:target_id => params[:target_ids], :status => [0, 1])
|
||||||
|
@message_list = target_user_messages.order("send_time asc")
|
||||||
|
target_user_messages.where(status: 0).update_all(status: 1)
|
||||||
|
@onclick_time = User.current.onclick_time.onclick_time
|
||||||
|
User.current.onclick_time.update_attribute(:onclick_time, Time.now)
|
||||||
|
@all_users = params[:all_user] || "0"
|
||||||
|
user_message_details = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
|
||||||
|
user_message_details_count = user_message_details.size
|
||||||
|
if user_message_details_count > 10 && @all_users == "0"
|
||||||
|
user_message_details = user_message_details.first(10)
|
||||||
|
end
|
||||||
|
@user_message_details = user_message_details
|
||||||
render :layout=>'base_user_message'
|
render :layout=>'base_user_message'
|
||||||
|
else
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@message.update_attribute(:status, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_recent_users
|
def get_recent_users
|
||||||
@recent_users = @user.recent_contacts.without_deleted.distinct.order("created_at desc").limit(10).includes(:user_extension)
|
@recent_users = User.where(:id => @user.private_messages.without_deleted.order("created_at desc").map(&:target_id)).includes(:user_extensions).limit(10)
|
||||||
|
render "get_recent_users", layout: false
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_users
|
def message_search_users
|
||||||
all_search_users = User.where("LOWER(concat(lastname, ifnull(firstname, ''), login)) LIKE ?", "#{params[:user_name].strip.to_s.downcase}")
|
@search_users = User.where("id != #{@user.id} and LOWER(concat(lastname, firstname)) LIKE '%#{params[:receiver_name].strip.to_s.downcase}%'").includes(:user_extensions)
|
||||||
|
|
||||||
|
# @search_users = User.where("LOWER(concat(lastname, ifnull(firstname, ''), login)) LIKE ?", "#{params[:receiver_name].strip.to_s.downcase}")
|
||||||
|
render "message_search_users", layout: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +128,7 @@ class PrivateMessagesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_message
|
def set_message
|
||||||
@jour = JournalsForMessage.find_by_id(params[:id])
|
@message = PrivateMessage.find_by_id(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_type_and_count
|
def set_type_and_count
|
||||||
|
|
|
@ -517,6 +517,7 @@ class UsersController < ApplicationController
|
||||||
@message_alls = user_all_messages.where(message_type: %w(SystemMessage ContestMessage OrgMessage))
|
@message_alls = user_all_messages.where(message_type: %w(SystemMessage ContestMessage OrgMessage))
|
||||||
end
|
end
|
||||||
@unred_all_messages = @user.count_new_message(@msg_type)
|
@unred_all_messages = @user.count_new_message(@msg_type)
|
||||||
|
@unred_private_messages = 0
|
||||||
@message_alls = @message_alls.order("created_at desc")
|
@message_alls = @message_alls.order("created_at desc")
|
||||||
|
|
||||||
#点击进入tab后,全部更新为已读,全部页面除外
|
#点击进入tab后,全部更新为已读,全部页面除外
|
||||||
|
|
|
@ -354,7 +354,7 @@ class User < Principal
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_user_contact_messages(user_id)
|
def get_user_contact_messages(user_id)
|
||||||
private_messages.where(user_id: user_id).size
|
private_messages.where(target_id: user_id).size
|
||||||
end
|
end
|
||||||
|
|
||||||
#判断是否可以点击项目或issue
|
#判断是否可以点击项目或issue
|
||||||
|
@ -512,6 +512,11 @@ class User < Principal
|
||||||
messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count
|
messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#未读私信数量
|
||||||
|
def unread_private_messages
|
||||||
|
private_messages.where(status: 0).size
|
||||||
|
end
|
||||||
|
|
||||||
# 查询指派给我的缺陷记录
|
# 查询指派给我的缺陷记录
|
||||||
def issue_status_update
|
def issue_status_update
|
||||||
self.status_updates
|
self.status_updates
|
||||||
|
|
|
@ -5,6 +5,16 @@
|
||||||
<title><%= h html_title %></title>
|
<title><%= h html_title %></title>
|
||||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||||
<meta name="keywords" content="issue,bug,tracker" />
|
<meta name="keywords" content="issue,bug,tracker" />
|
||||||
|
<%#= csrf_meta_tag %>
|
||||||
|
<%#= favicon %>
|
||||||
|
<%#= javascript_heads %>
|
||||||
|
<%#= heads_for_theme %>
|
||||||
|
<%#= call_hook :view_layouts_base_html_head %>
|
||||||
|
<%#= stylesheet_link_tag 'css/common','css/structure', 'css/public', 'css/courses','prettify', 'css/org', 'css/syllabus'%>
|
||||||
|
<%#= javascript_include_tag "course","header",'prettify','contest' %>
|
||||||
|
|
||||||
|
<%#= yield :header_tags -%>
|
||||||
|
|
||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
<%= favicon %>
|
<%= favicon %>
|
||||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome.css','css/iconfont/iconfont', :media => 'all' %>
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome.css','css/iconfont/iconfont', :media => 'all' %>
|
||||||
|
@ -13,6 +23,10 @@
|
||||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||||
<%= heads_for_theme %>
|
<%= heads_for_theme %>
|
||||||
<%= call_hook :view_layouts_base_html_head %>
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
|
<!-- page specific tags -->
|
||||||
|
<%= content_for(:header_tags) do %>
|
||||||
|
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||||
|
<% end %>
|
||||||
<%= yield :header_tags -%>
|
<%= yield :header_tags -%>
|
||||||
</head>
|
</head>
|
||||||
<body onload="prettyPrint();">
|
<body onload="prettyPrint();">
|
||||||
|
@ -26,6 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="homepageContentContainer">
|
<div class="homepageContentContainer">
|
||||||
|
<%= render_flash_messages %>
|
||||||
<div class="mt15">
|
<div class="mt15">
|
||||||
<div class="df middlePanel">
|
<div class="df middlePanel">
|
||||||
<div class="fl pagePanel_left">
|
<div class="fl pagePanel_left">
|
||||||
|
@ -41,5 +56,14 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
function get_message_link(path) {
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: path,
|
||||||
|
dataType: "script"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -12,24 +12,14 @@
|
||||||
<div class="mb20 pr">
|
<div class="mb20 pr">
|
||||||
<div class="myw100baifenbi">
|
<div class="myw100baifenbi">
|
||||||
<span class="ant-input-affix-wrapper">
|
<span class="ant-input-affix-wrapper">
|
||||||
<%= m.text_field :receiver_id, class: "ant-input",placeholder: "发送给" %>
|
<input class="ant-input" id="private_message_receiver_name" name="receiver_name" placeholder="发送给">
|
||||||
<span class="ant-input-suffix">
|
<%= m.hidden_field :receiver_id %>
|
||||||
|
<span class="ant-input-suffix" id="search-recent-user-<%= @user.try(:login) %>">
|
||||||
<img src="/images/search.png">
|
<img src="/images/search.png">
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="recently_person" style="display: none;">
|
<div class="recently_person" style="display: none;" id="recent-contact-users-<%= @user.try(:login) %>">
|
||||||
<div class="ant-spin-nested-loading">
|
|
||||||
<div class="ant-spin-container">
|
|
||||||
<p class="padding10-20 color-grey-9 cdefault">最近联系人</p>
|
|
||||||
<div id>
|
|
||||||
<p class="clearfix recently_item">
|
|
||||||
<img alt="头像" class="radius fl mr10 myimgw48 myimgh48" src="/images/avatars/User/1?t=1569554901">
|
|
||||||
<span class="recently_name">实践教学</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="writeLetter_Info">
|
<div class="writeLetter_Info">
|
||||||
|
|
|
@ -1,80 +1,80 @@
|
||||||
<div class="df clearfix">
|
<%= content_for(:header_tags) do %>
|
||||||
<div class="flex1">
|
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||||
|
<% end %>
|
||||||
|
<div class="df clearfix" >
|
||||||
|
<div class="flex1" id="dialogPanelscroll">
|
||||||
<p class="clearfix pt30 pb30 t-center font-16 bor-bottom-greyE">
|
<p class="clearfix pt30 pb30 t-center font-16 bor-bottom-greyE">
|
||||||
<%= link_to "<i class='iconfont icon-zuojiantou font-14 fl ml25 color-grey-9' data-tip-down='返回到列表'></i>".html_safe,user_private_messages_path(@user),remote: true %>
|
<%= link_to "<i class='iconfont icon-zuojiantou font-14 fl ml25 color-grey-9' data-tip-down='返回到列表'></i>".html_safe,user_private_messages_path(@user),remote: true %>
|
||||||
<%= @contact_user.try(:show_name) %>与你的私信
|
<%= @target_user.try(:show_name) %>与你的私信
|
||||||
</p>
|
</p>
|
||||||
<% if @user_message_details.size > 0 %>
|
<div id="dialogPanel">
|
||||||
<% @user_message_details.chunk { |c| format_date(c.created_at).to_date }.each do |day, jour| %>
|
<% if @message_list.size > 0 %>
|
||||||
<div class="letterBox" id="contact-messages-<%= current_user.try(:login) %>" >
|
<div class="letterBox" id="contact-messages-<%= current_user.try(:login) %>" >
|
||||||
|
<% @message_list.chunk { |c| format_date(c.created_at).to_date }.each do |day, jour| %>
|
||||||
|
|
||||||
<p class="mt30 t-center"><span class="letter-time"><%= day %></span></p>
|
<p class="mt30 t-center"><span class="letter-time"><%= day %></span></p>
|
||||||
<% jour.each do |j| %>
|
<% jour.each do |j| %>
|
||||||
<% if j.sender_id == current_user.id %>
|
<% if j.sender_id == @user.id %>
|
||||||
<div class="OtherSide clearfix" id="message_content_<%= j.id %>">
|
<div class="OtherSide clearfix" id="message_content_<%= j.id %>">
|
||||||
<%= link_to image_tag(url_to_avatar(j.sender), class: "r_list_img"), user_path(j.sender), :alt => "用户头像", class: "mr10 radius fl", target: "_blank" %>
|
<%= link_to image_tag(url_to_avatar(@user), class: "img-50 mr10"), user_path(@user), :alt => "用户头像", class: "fl", target: "_blank" %>
|
||||||
<div class="fl pr OtherSide-info">
|
<div class="fl pr OtherSide-info">
|
||||||
<span class="trangle"></span>
|
<span class="trangle"></span>
|
||||||
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
||||||
<%= j.content %>
|
<%= j.content.html_safe %>
|
||||||
</div>
|
</div>
|
||||||
<div class="edu-txt-right mt5">
|
<div class="edu-txt-right mt5">
|
||||||
<%= link_to "删除", user_private_message_path(j.sender, j.id), remote: true, data: {confirm: "确认删除吗?"} %>
|
<%= link_to "删除", user_private_message_path(@user, j.id),method: :delete, remote: true, data: {confirm: "确认删除吗?"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="fl ml15 color-grey-c lineh-15 mt15"><%= j.created_at.strftime("%H:%M") %></span>
|
<span class="fl ml15 color-grey-c lineh-15 mt15"><%= j.created_at.strftime("%H:%M") %></span>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="ThisSide clearfix" id="message_content_<%= j.id %>">
|
<div class="ThisSide clearfix" id="message_content_<%= j.id %>">
|
||||||
<%= link_to image_tag(url_to_avatar(j.receiver), class: "r_list_img"), user_path(j.receiver), :alt => "用户头像", class: "mr10 radius fl", target: "_blank" %>
|
<%= link_to image_tag(url_to_avatar(j.sender), class: "img-50 ml10"), user_path(j.sender), :alt => "用户头像", class: "fr", target: "_blank" %>
|
||||||
<div class="fl pr ThisSide-info">
|
<div class="fr pr ThisSide-info">
|
||||||
<span class="trangle"></span>
|
<span class="trangle"></span>
|
||||||
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
||||||
<%= j.content %>
|
<%= j.content.html_safe %>
|
||||||
</div>
|
</div>
|
||||||
<div class="edu-txt-right mt5">
|
<div class="edu-txt-right mt5">
|
||||||
<%= link_to "删除", user_private_message_path(j.receiver, j.id), remote: true, data: {confirm: "确认删除吗?"} %>
|
<%= link_to "删除", user_private_message_path(j.sender, j.id),method: :delete, remote: true, data: {confirm: "确认删除吗?"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="fl ml15 color-grey-c lineh-15 mt15"><%= j.created_at.strftime("%H:%M") %></span>
|
<span class="fr mr15 color-grey-c lineh-15 mt15"><%= j.created_at.strftime("%H:%M") %></span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render partial: "projects/no_data" %>
|
<%= render partial: "projects/no_data" %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= form_for [current_user, PrivateMessage.new], remote: true do |f| %>
|
<%= form_for [@user, PrivateMessage.new], remote: true do |f| %>
|
||||||
<%= f.hidden_field :receiver_id,value: @contact_user.id, class: "ant-input",placeholder: "发送给" %>
|
<%= f.hidden_field :receiver_id,value: @target_user.id, class: "ant-input",placeholder: "发送给" %>
|
||||||
<div class="repeatBox padding20">
|
<div class="repeatBox padding20">
|
||||||
<div>
|
<div>
|
||||||
<%= f.text_area :content, class: "writeLetter_text greyInput" %>
|
<%= f.kindeditor :content,:width=>'100%', :editor_id => "new_private_message",:resizeType => 0,:height => 200 %>
|
||||||
</div>
|
</div>
|
||||||
<p class="clearfix mt15">
|
<p class="clearfix mt15">
|
||||||
<span class="fl ml5 color-orange f12 mt5">在问题反馈时,请同时发送问题发生页的网址链接,以便我们高效的为您服务</span>
|
<span class="fl ml5 color-orange f12 mt5">在问题反馈时,请同时发送问题发生页的网址链接,以便我们高效的为您服务</span>
|
||||||
<%= f.submit "回复", class: "fr task-btn task-btn-orange", data: {"disabled-with": "回复中..."} %>
|
<%= f.submit "回复", class: "fr task-btn task-btn-orange", data: {'disabled-with': "回复中..."} %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="bor-left-greyE" style="width: 290px;">
|
|
||||||
<p class="pt30 pb30 pl30 edu-txt-left font-16 bor-bottom-greyE">私信列表</p>
|
|
||||||
<div class="private-list">
|
|
||||||
<div class="part-line">
|
|
||||||
<img height="48" width="48" src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1820523987,3798556096&fm=26&gp=0.jpg" class="radius mr10">
|
|
||||||
<div class="flex1">
|
|
||||||
<p class="clearfix mb10 lineh-17">
|
|
||||||
<span class="fl">
|
|
||||||
<span class="task-hide privatePartName">陈晓婷</span>
|
|
||||||
</span>
|
|
||||||
<span class="color-grey-c fr">2小时前</span>
|
|
||||||
</p>
|
|
||||||
<p class="color-grey-6 lh20 justify break_word task-hide-2 markdown-body" id="MakedownHTML" style="word-break: break-word;">
|
|
||||||
jhgjkhjkh
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="right-user-messages-<%= @user.try(:login) %>">
|
||||||
|
<%= render partial: "private_messages/right_message_users" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#contact-messages-<%= @user.try(:login) %>').animate({
|
||||||
|
scrollTop: $('#contact-messages-<%= @user.try(:login) %>')[0].scrollHeight
|
||||||
|
},
|
||||||
|
260);
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<div class="bor-left-greyE" style="width: 290px;">
|
||||||
|
<p class="pt30 pb30 pl30 edu-txt-left font-16 bor-bottom-greyE">私信列表</p>
|
||||||
|
|
||||||
|
<div class="private-list" id="private-list-right">
|
||||||
|
<% @user_message_details.each_with_index do |message, index| %>
|
||||||
|
<div class="part-line <%= message.target_id == @target_user.id ? 'active' : '' %>" onclick="javascript:window.location.href='<%= private_messages_detail_user_private_messages_path(@user, target_ids: message.target_id) %>';return false;" >
|
||||||
|
<%= link_to image_tag(url_to_avatar(message.target), class: "r_list_img"), user_path(message.target), :alt => "用户头像", target: "_blank" %>
|
||||||
|
<div class="flex1">
|
||||||
|
<p class="clearfix mb10 lineh-17">
|
||||||
|
<span class="fl">
|
||||||
|
<span class="task-hide privatePartName"><%= message.target.try(:show_name) %></span>
|
||||||
|
</span>
|
||||||
|
<span class="color-grey-c fr"><%= time_from_now(message.send_time) %></span>
|
||||||
|
</p>
|
||||||
|
<p class="color-grey-6 lh20 justify break_word task-hide-2 markdown-body" id="MakedownHTML" style="word-break: break-word;">
|
||||||
|
<%= message_content(message.content.html_safe) %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if index == 9 && @all_users == "0" %>
|
||||||
|
<div class="part-line just_center">
|
||||||
|
<%= link_to "加载全部",private_messages_detail_user_private_messages_path(@user, target_ids: message.target_id, all_user: "1"), remote: true %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(window).load(function(){
|
||||||
|
$(".private-list").css("max-height",$("#dialogPanel").height());
|
||||||
|
// $("#private-list-right").scrollTop($("#private-list-right").scrollTop() + $('.part-line.active').offset().top - $("#private-list-right").offset().top);
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -4,10 +4,10 @@
|
||||||
<div class="fl pr OtherSide-info">
|
<div class="fl pr OtherSide-info">
|
||||||
<span class="trangle"></span>
|
<span class="trangle"></span>
|
||||||
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
||||||
<%= j.content %>
|
<%= j.content.html_safe %>
|
||||||
</div>
|
</div>
|
||||||
<div class="edu-txt-right mt5">
|
<div class="edu-txt-right mt5">
|
||||||
<%= link_to "删除", user_private_message_path(j.target, j.id), remote: true, data: {confirm: "确认删除吗?"} %>
|
<%= link_to "删除", user_private_message_path(j.target, j.id),method: :delete, remote: true, data: {confirm: "确认删除吗?"} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="fl ml15 color-grey-c lineh-15 mt15"><%= j.created_at.strftime("%H:%M") %></span>
|
<span class="fl ml15 color-grey-c lineh-15 mt15"><%= j.created_at.strftime("%H:%M") %></span>
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
<p class="clearfix font-16 padding30-20 bor-bottom-greyE">
|
<p class="clearfix font-16 padding30-20 bor-bottom-greyE">
|
||||||
<span class="fl">全部私信</span>
|
<span class="fl">全部私信</span>
|
||||||
<%= link_to "写私信", new_user_private_message_path(current_user), remote: true, class: "c-blue fr" %>
|
<%= link_to "写私信", new_user_private_message_path(@user), remote: true, class: "c-blue fr" %>
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<% if @jours_count > 0 %>
|
<% if @jours_count > 0 %>
|
||||||
<% @jours_alls.each do |jour| %>
|
<% @jours_alls.each do |jour| %>
|
||||||
<div class="private-item clearfix df" onclick="get_message_link('<%= private_messages_detail_user_private_messages_path(current_user, target_ids: jour.target_id) %>')">
|
<div class="private-item clearfix df" onclick="javascript:window.location.href='<%= private_messages_detail_user_private_messages_path(@user, target_ids: jour.target_id) %>'; return false;">
|
||||||
<%= link_to image_tag(url_to_avatar(jour.target), class: "r_list_img"), user_path(jour.target), :alt => "用户头像", class: "fl mr10 private_message_a", target: "_blank" %>
|
<%= link_to image_tag(url_to_avatar(jour.target), class: "r_list_img"), user_path(jour.target), :alt => "用户头像", class: "fl mr10 private_message_a", target: "_blank" %>
|
||||||
<div class="fl flex1">
|
<div class="fl flex1">
|
||||||
<p>
|
<p>
|
||||||
<span class="mr20"><%= link_to jour.target.try(:show_name), user_path(jour.target) %></span>
|
<span class="mr20"><%= link_to jour.target.try(:show_name), user_path(jour.target) %></span>
|
||||||
<messpan>与你的私信</messpan>
|
<messpan>与你的私信</messpan>
|
||||||
<span class="color-grey-c mr20">[<%= (jour.target.get_user_contact_messages(jour.user_id) + 1) %>条]</span>
|
<span class="color-grey-c mr20">[<%= (@user.get_user_contact_messages(jour.target_id) + 1) %>条]</span>
|
||||||
<span class="color-grey-c"><%= time_from_now(jour.updated_at) %></span>
|
<span class="color-grey-c"><%= time_from_now(jour.updated_at) %></span>
|
||||||
</p>
|
</p>
|
||||||
<div class="color-grey-6 markdown-body mt10">
|
<div class="color-grey-6 markdown-body mt10">
|
||||||
<%= jour.content.html_safe %>
|
<%= message_content(jour.content.html_safe) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
$("#contact-messages-<%= current_user.try(:login) %>").append("<%= j render partial: "private_messages/user_contact_content", locals: {j: @sender_message} %>")
|
$("#contact-messages-<%= current_user.try(:login) %>").append("<%= j render partial: "private_messages/user_contact_content", locals: {j: @sender_message} %>")
|
||||||
|
$('#contact-messages-<%= @user.try(:login) %>').animate({
|
||||||
|
scrollTop: $('#contact-messages-<%= @user.try(:login) %>')[0].scrollHeight
|
||||||
|
},
|
||||||
|
260);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
$("#message_content_<%= @message.id %>").remove()
|
|
@ -0,0 +1,14 @@
|
||||||
|
<% if @recent_users.present? %>
|
||||||
|
<div class="ant-spin-nested-loading">
|
||||||
|
<div class="ant-spin-container">
|
||||||
|
<p class="padding10-20 color-grey-9 cdefault">最近联系人</p>
|
||||||
|
<% @recent_users.each do |user| %>
|
||||||
|
<p class="clearfix recently_item" data-id="<%= user.id %>">
|
||||||
|
<%= image_tag(url_to_avatar(user), class: "radius fl mr10 myimgw48 myimgh48") %>
|
||||||
|
<span class="recently_name"><%= user.try(:show_name) %></span>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
json.array @recent_users.each.to_a do |a|
|
|
||||||
json.user_id a.id
|
|
||||||
json.user_login a.login
|
|
||||||
json.user_name a.try(:show_name)
|
|
||||||
json.image_url url_to_avatar(a)
|
|
||||||
end
|
|
|
@ -1,14 +1,3 @@
|
||||||
<div id="user-messages-<%= current_user.try(:login) %>">
|
<div id="user-messages-<%= current_user.try(:login) %>">
|
||||||
<%= render partial: "private_messages/user_new_feedbacks" %>
|
<%= render partial: "private_messages/user_new_feedbacks" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
function get_message_link(path) {
|
|
||||||
console.log(path)
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: path,
|
|
||||||
dataType: "script"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<% if @search_users.present? %>
|
||||||
|
<div class="ant-spin-nested-loading">
|
||||||
|
<div class="ant-spin-container">
|
||||||
|
<p class="padding10-20 color-grey-9 cdefault">最近联系人</p>
|
||||||
|
<% @search_users.each do |user| %>
|
||||||
|
<p class="clearfix recently_item" data-id="<%= user.id %>">
|
||||||
|
<%= image_tag(url_to_avatar(user), class: "radius fl mr10 myimgw48 myimgh48") %>
|
||||||
|
<span class="recently_name"><%= user.try(:show_name) %></span>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="ant-spin-nested-loading">
|
||||||
|
<div class="ant-spin-container">
|
||||||
|
<p class="padding10-20 color-grey-9 cdefault">用户不存在</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -1,2 +1,56 @@
|
||||||
var htmlvalue = "<%= escape_javascript(render :partial => 'private_messages/new_message') %>";
|
var htmlvalue = "<%= escape_javascript(render :partial => 'private_messages/new_message') %>";
|
||||||
pop_box_new(htmlvalue,460,316);
|
pop_box_new(htmlvalue,460,316);
|
||||||
|
|
||||||
|
var recent_users = $("#recent-contact-users-<%= @user.try(:login) %>")
|
||||||
|
var search_name = $("input[name='receiver_name']")
|
||||||
|
$("#private_message_receiver_name").on("focus",function () {
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: '<%= get_recent_users_user_private_messages_path(@user) %>',
|
||||||
|
success: function (data) {
|
||||||
|
if(data.length > 0){
|
||||||
|
recent_users.show().html(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
recent_users.on("click", ".recently_item",function () {
|
||||||
|
var reciver_id = $(this).attr("data-id");
|
||||||
|
var reviver_name = $(this).find(".recently_name").text()
|
||||||
|
$("input[name='private_message[receiver_id]']").val(reciver_id)
|
||||||
|
search_name.val(reviver_name)
|
||||||
|
recent_users.html("")
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#search-recent-user-<%= @user.try(:login) %>").on("click",function () {
|
||||||
|
var search_name_val = search_name.val();
|
||||||
|
search_users(search_name_val)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
search_name.on("keydown",function (e) {
|
||||||
|
if(e.keyCode == 13){
|
||||||
|
search_users($(this).val())
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function search_users(search_name_val){
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: '<%= message_search_users_user_private_messages_path(@user) %>',
|
||||||
|
data: {receiver_name: search_name_val},
|
||||||
|
success: function (data) {
|
||||||
|
if(data.length > 0){
|
||||||
|
recent_users.show().html(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
<div id="user-messages-<%= current_user.try(:login) %>">
|
<div id="user-messages-<%= current_user.try(:login) %>">
|
||||||
<%= render partial: "private_messages/private_box" %>
|
<%= render partial: "private_messages/private_box" %>
|
||||||
</div>
|
</div>
|
|
@ -1 +1,7 @@
|
||||||
|
|
||||||
|
<% if params[:all_user] == "1" %>
|
||||||
|
$("#right-user-messages-<%= @user.try(:login) %>").html("<%= j render partial: "private_messages/right_message_users" %>")
|
||||||
|
<% else %>
|
||||||
$("#user-messages-<%= current_user.try(:login) %>").html("<%= j render partial: "private_messages/private_box" %>")
|
$("#user-messages-<%= current_user.try(:login) %>").html("<%= j render partial: "private_messages/private_box" %>")
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="clearfix <%= @user_message_type == "2" ? "active" : "" %>">
|
<li class="clearfix <%= @user_message_type == "2" ? "active" : "" %>">
|
||||||
<%= link_to "私信", user_private_messages_path(current_user), class: "ml30 width100" %>
|
<%= link_to "私信", user_private_messages_path(current_user), class: "ml30 width100" %>
|
||||||
|
<% if @unred_private_messages > 0 %>
|
||||||
|
<span class="readingNum"><%= @unred_private_messages %></span>
|
||||||
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -710,6 +710,8 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :private_messages do
|
resources :private_messages do
|
||||||
collection do
|
collection do
|
||||||
get "private_messages_detail"
|
get "private_messages_detail"
|
||||||
|
get "get_recent_users"
|
||||||
|
get "message_search_users"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
|
|
|
@ -615,9 +615,13 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
.just_center{justify-content: center;}
|
||||||
.OtherSide, .ThisSide {
|
.OtherSide, .ThisSide {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
.sms img{
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
.task-btn-orange {
|
.task-btn-orange {
|
||||||
background: #4CACFF!important;
|
background: #4CACFF!important;
|
||||||
color: #fff!important;
|
color: #fff!important;
|
||||||
|
@ -650,6 +654,10 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
.part-line:hover {
|
.part-line:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
.part-line.active{
|
||||||
background-color: #F5F5F5;
|
background-color: #F5F5F5;
|
||||||
}
|
}
|
||||||
.private-part:last-child .part-line {
|
.private-part:last-child .part-line {
|
||||||
|
@ -987,6 +995,11 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right:18px;
|
margin-right:18px;
|
||||||
}
|
}
|
||||||
|
.img-50{
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
.pagePanel_right li:last-child{
|
.pagePanel_right li:last-child{
|
||||||
border:none;
|
border:none;
|
||||||
}
|
}
|
||||||
|
@ -1279,6 +1292,7 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
}
|
}
|
||||||
.ant-input-suffix{
|
.ant-input-suffix{
|
||||||
|
cursor: pointer;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
@ -1291,7 +1305,8 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
|
||||||
-webkit-transform: translateY(-50%);
|
-webkit-transform: translateY(-50%);
|
||||||
-ms-transform: translateY(-50%);
|
-ms-transform: translateY(-50%);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
right: 12px;
|
right: 0;
|
||||||
|
padding: 8px 10px;
|
||||||
background: transparent!important;
|
background: transparent!important;
|
||||||
}
|
}
|
||||||
.writeLetter_Info {
|
.writeLetter_Info {
|
||||||
|
@ -1319,3 +1334,43 @@ a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; tex
|
||||||
color: #999999;
|
color: #999999;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
}
|
}
|
||||||
|
.recently_person{
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
top: 35px;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0px 1px 6px rgba(76,76,76,0.2);
|
||||||
|
left: 0px;
|
||||||
|
z-index: 1;
|
||||||
|
background-color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.ant-spin-nested-loading{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ant-spin-container{
|
||||||
|
position: relative;
|
||||||
|
-webkit-transition: opacity .3s;
|
||||||
|
-o-transition: opacity .3s;
|
||||||
|
transition: opacity .3s;
|
||||||
|
}
|
||||||
|
.padding10-20{
|
||||||
|
padding: 10px 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.cdefault {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.recently_item {
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
.recently_name {
|
||||||
|
float: left;
|
||||||
|
line-height: 48px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.color-grey-9 {
|
||||||
|
color: #999999!important;
|
||||||
|
}
|
Loading…
Reference in New Issue