新增私信的前端和后端
This commit is contained in:
parent
52bebf73b8
commit
40941b0f6d
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the private_messages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,56 @@
|
|||
class PrivateMessagesController < ApplicationController
|
||||
before_filter :require_login
|
||||
before_filter :set_user
|
||||
before_filter :set_message, except: [:index]
|
||||
|
||||
def index
|
||||
#用户更新私信为全部已读
|
||||
jours = current_user.private_messages
|
||||
@limit = 20
|
||||
@jours_count = jours.count
|
||||
@jours_all_pages = Paginator.new @jours_count, @limit, params['page'] || 1
|
||||
@offset ||= @jours_all_pages.offset
|
||||
@jours_alls = paginateHelper jours, @limit
|
||||
render :layout=>'base_user_message'
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@jour_messages = @user.journals_for_messages.where(m_parent_id: @jour.id)
|
||||
|
||||
render :layout=>'base_user_message'
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
end
|
||||
|
||||
def get_recent_users
|
||||
|
||||
end
|
||||
|
||||
def search_users
|
||||
all_search_users = User.where("LOWER(concat(lastname, ifnull(firstname, ''), login)) LIKE ?", "#{params[:user_name].strip.to_s.downcase}")
|
||||
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def set_user
|
||||
@user = User.find_by_login(params[:user_id])
|
||||
end
|
||||
|
||||
def set_message
|
||||
@jour = JournalsForMessage.find_by_id(params[:id])
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -477,8 +477,8 @@ class UsersController < ApplicationController
|
|||
messages.each do |message_all|
|
||||
# 未读的消息存放在数组
|
||||
mess = message_all.message
|
||||
if (message_all.message_type != "SystemMessage" && !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
if mess.created_at > onclick_time
|
||||
unless message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1
|
||||
@message_alls << mess
|
||||
end
|
||||
break if @message_alls.length == 10
|
||||
|
@ -516,7 +516,7 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@message_alls = user_all_messages.where(message_type: %w(SystemMessage ContestMessage OrgMessage))
|
||||
end
|
||||
@unred_all_messages = @user.count_new_message
|
||||
@unred_all_messages = @user.count_new_message(@msg_type)
|
||||
@message_alls = @message_alls.order("created_at desc")
|
||||
|
||||
#点击进入tab后,全部更新为已读,全部页面除外
|
||||
|
@ -1639,55 +1639,6 @@ class UsersController < ApplicationController
|
|||
render :layout=>'base_users_new'
|
||||
end
|
||||
|
||||
# modified by fq
|
||||
def user_newfeedback
|
||||
unless User.current.logged?
|
||||
redirect_to signin_url
|
||||
return
|
||||
end
|
||||
|
||||
#用户更新私信为全部已读
|
||||
UserFeedbackMessage.where("user_id =? and viewed =? and journals_for_message_type =? ", User.current.id, 0, "JournalsForMessage").update_all(:viewed => true)
|
||||
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
|
||||
|
||||
@state = false
|
||||
@limit = 20
|
||||
@jours_count = jours.count
|
||||
@jours_all_pages = Paginator.new @jours_count, @limit, params['page'] || 1
|
||||
@offset ||= @jours_all_pages.offset
|
||||
@jours_alls = paginateHelper jours, @limit
|
||||
render :layout=>'base_user_message'
|
||||
|
||||
# 自己访问自己的页面才更新消息状态
|
||||
# UserFeedbackMessage.where("user_id =? and viewed =? and journals_for_message_type =? ", User.current.id, 0, "JournalsForMessage").update_all(:viewed => true)
|
||||
# end
|
||||
# @page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
# if params[:type].present?
|
||||
# case params[:type]
|
||||
# when "public"
|
||||
# jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC')
|
||||
# when "private"
|
||||
# jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC')
|
||||
# else
|
||||
# jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
|
||||
# end
|
||||
# else
|
||||
# jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
|
||||
# end
|
||||
# @unred_all_messages = @user.count_new_message
|
||||
# @jour_count = jours.count
|
||||
# @jour = jours.limit(10).offset(@page * 10)
|
||||
# @type = params[:type]
|
||||
# if User.current == @user
|
||||
# @jour.update_all(:is_readed => true, :status => false)
|
||||
# @jour.each do |journal|
|
||||
# # fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
# journal.delay.set_children_readed_delay
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
#给某人留言
|
||||
def feedBackTo
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module PrivateMessagesHelper
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class PrivateMessage < ActiveRecord::Base
|
||||
# 私信
|
||||
belongs_to :user
|
||||
belongs_to :target, class_name: "User"
|
||||
belongs_to :sender, class_name: "User"
|
||||
belongs_to :receiver, class_name: "User"
|
||||
|
||||
#status 0表示未读,1表示已读,2表示已删除
|
||||
scope :without_deleted, -> { where.not(status: 2) }
|
||||
scope :only_unread, -> { where(status: 0) }
|
||||
|
||||
end
|
|
@ -143,6 +143,8 @@ class User < Principal
|
|||
##ended by xianbo
|
||||
|
||||
#####fq
|
||||
# 新版私信
|
||||
has_many :private_messages, dependent: :destroy
|
||||
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
|
||||
has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
|
||||
# has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||
|
@ -446,7 +448,7 @@ class User < Principal
|
|||
end
|
||||
|
||||
# 新消息统计,
|
||||
def count_new_message
|
||||
def count_new_message(type)
|
||||
message_new_time = OnclickTime.where("user_id =?", User.current).first
|
||||
if message_new_time.nil?
|
||||
message_new_time = OnclickTime.new
|
||||
|
@ -458,17 +460,49 @@ class User < Principal
|
|||
user = User.current
|
||||
onclick_time = user.onclick_time.onclick_time
|
||||
delete_courses = Course.where(:is_delete => 1).blank? ? "(-1)" : "(" + Course.where(:is_delete => 1).map(&:id).join(",") + ")"
|
||||
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >? and course_id not in #{delete_courses}", user.id, 0, onclick_time).count
|
||||
contest_count = ContestMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
|
||||
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
|
||||
applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
blog_message_count = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time).count
|
||||
message_new_time.update_attribute(:onclick_time, Time.now)
|
||||
course_messages = CourseMessage.where("user_id =? and viewed =? and created_at >? and course_id not in #{delete_courses}", user.id, 0, onclick_time)
|
||||
course_count = course_messages.size
|
||||
|
||||
contest_messages = ContestMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
|
||||
contest_count = contest_messages.count
|
||||
|
||||
forge_messages = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
|
||||
forge_count = forge_messages.count
|
||||
|
||||
user_feedbacks = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
|
||||
user_feedback_count = user_feedbacks.count
|
||||
|
||||
user_memos = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
|
||||
user_memo_count = user_memos.count
|
||||
|
||||
system_messages = SystemMessage.where("created_at >?", onclick_time)
|
||||
system_messages_count = system_messages.count
|
||||
|
||||
at_messages = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time)
|
||||
at_count = at_messages.count
|
||||
|
||||
org_messages = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time)
|
||||
org_count = org_messages.count
|
||||
|
||||
applied_messages = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time)
|
||||
applied_count = applied_messages.count
|
||||
|
||||
blog_messages = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time)
|
||||
blog_message_count = blog_messages.count
|
||||
|
||||
if type != "all"
|
||||
Rails.logger.info("######________type__________##########{type}")
|
||||
message_new_time.update_attribute(:onclick_time, Time.now)
|
||||
course_messages.update_all(:viewed => true) unless course_messages.nil?
|
||||
forge_messages.update_all(:viewed => true) unless forge_messages.nil?
|
||||
user_feedbacks.update_all(:viewed => true) unless user_feedbacks.nil?
|
||||
user_memos.update_all(:viewed => true) unless user_memos.nil?
|
||||
org_messages.update_all(:viewed => true) unless org_messages.nil?
|
||||
at_messages.update_all(:viewed => true) unless at_messages.nil?
|
||||
contest_messages.update_all(:viewed => true) unless contest_messages.nil?
|
||||
blog_messages.update_all(:viewed => true) unless blog_messages.nil?
|
||||
applied_messages.update_all(:viewed => true) unless applied_messages.nil?
|
||||
end
|
||||
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
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
|
||||
<div class="navHomepageNews" id="user_messages">
|
||||
<a href="<%= user_message_path(User.current,click_user_message: true) %>" class="fl"><i class="iconfont icon-xiaoxilingdang fontGrey4 f22 fl mt7"></i></a>
|
||||
<% new_message_count = User.current.count_new_message.to_i %>
|
||||
<% new_message_count = User.current.count_new_message(nil).to_i %>
|
||||
<% if new_message_count > 0 %>
|
||||
<%#= link_to new_message_count, user_path(User.current, :click_user_message => true), :class => "newsActive", :target => "_Blank" %>
|
||||
<span class="haveNews"></span>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<div>
|
||||
<div class="ant-modal-mask"></div>
|
||||
<div tabindex="-1" class="ant-modal-wrap ant-modal-centered" role="dialog" aria-labelledby="rcDialogTitle4">
|
||||
<div role="document" class="ant-modal" style="width: 550px; transform-origin: 821.5px -113px;">
|
||||
<div tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden;"></div>
|
||||
<div class="ant-modal-content"><div class="ant-modal-header">
|
||||
<div class="ant-modal-title" id="rcDialogTitle4">写私信</div>
|
||||
</div>
|
||||
<div class="ant-modal-body">
|
||||
<div>
|
||||
<div class="mb20 pr">
|
||||
<div class="myw100baifenbi">
|
||||
<span class="ant-input-affix-wrapper">
|
||||
<input class="ant-input" placeholder="发送给..." type="text" value="">
|
||||
<span class="ant-input-suffix">
|
||||
<img src="/images/search.png">
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="recently_person" style="display: none;">
|
||||
<div class="ant-spin-nested-loading">
|
||||
<div class="ant-spin-container">
|
||||
<p class="padding10-20 color-grey-9 cdefault">最近联系人</p>
|
||||
<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>
|
||||
<p class="clearfix recently_item">
|
||||
<img alt="头像" class="radius fl mr10 myimgw48 myimgh48" src="/images/avatars/User/b">
|
||||
<span class="recently_name">innov</span>
|
||||
</p>
|
||||
<p class="clearfix recently_item">
|
||||
<img alt="头像" class="radius fl mr10 myimgw48 myimgh48" src="/images/avatars/User/15582?t=1566447907">
|
||||
<span class="recently_name">胡莎莎</span>
|
||||
</p>
|
||||
<p class="clearfix recently_item">
|
||||
<img alt="头像" class="radius fl mr10 myimgw48 myimgh48" src="/images/avatars/User/b">
|
||||
<span class="recently_name">asdad</span>
|
||||
</p>
|
||||
<p class="clearfix recently_item">
|
||||
<img alt="头像" class="radius fl mr10 myimgw48 myimgh48" src="/images/avatars/User/75650?t=1569488496">
|
||||
<span class="recently_name">汪维</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="writeLetter_Info">
|
||||
<textarea class="writeLetter_text greyInput" name="content" id="writeLetter_text" maxlength="200"></textarea>
|
||||
<span class="longchar">200</span>
|
||||
</div>
|
||||
</div>
|
||||
<p style="height: 25px;"></p>
|
||||
<p class="clearfix edu-txt-center">
|
||||
<a class="pop_close task-btn mr30">取消</a>
|
||||
<a class="task-btn task-btn-orange" id="submit_send_letter">确定</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div tabindex="0" aria-hidden="true" style="width: 0px; height: 0px; overflow: hidden;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,80 @@
|
|||
<div class="df clearfix">
|
||||
<div class="flex1">
|
||||
<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 %>
|
||||
<%= @jour_messages.first.user.try(:show_name) %>与你的私信
|
||||
</p>
|
||||
|
||||
<% @jour_messages.chunk { |c| format_date(c.created_at).to_date }.each do |day, jour| %>
|
||||
<%= day %>
|
||||
<%= jour.notes %>
|
||||
<% end %>
|
||||
|
||||
<div class="letterBox">
|
||||
<p class="mt30 t-center"><span class="letter-time">2019-10-19</span></p>
|
||||
<div class="OtherSide clearfix" id="message_content_25148">
|
||||
<a href="javascript:void(0)"><img alt="头像" class="mr10 radius fl" height="48" width="48" src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1820523987,3798556096&fm=26&gp=0.jpg" /></a>
|
||||
<div class="fl pr OtherSide-info">
|
||||
<span class="trangle"></span>
|
||||
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
||||
<p><a href="http://www.baidu.com" title="wwwbaidu">wwwbaidu</a></p>
|
||||
<ol>
|
||||
<li>kdajlkd</li>
|
||||
<li>dskdfjslakfj</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="edu-txt-right mt5">
|
||||
<a href="javascript:void(0)" class="color-grey-c">删除</a>
|
||||
</div>
|
||||
</div>
|
||||
<span class="fl ml15 color-grey-c lineh-15 mt15">9:53</span>
|
||||
</div>
|
||||
<div class="ThisSide clearfix" id="message_content_25149">
|
||||
<a href="javascript:void(0)"><img alt="头像" class="ml10 radius fr" height="48" width="48" src="https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1820523987,3798556096&fm=26&gp=0.jpg" /></a>
|
||||
<div class="fr pr ThisSide-info">
|
||||
<span class="trangle"></span>
|
||||
<div class="sms break_word markdown-body" id="Leftdialogue1">
|
||||
<p><a href="http://www.baidu.com" title="wwwbaidu">wwwbaidu</a></p>
|
||||
<ol>
|
||||
<li>kdajlkd</li>
|
||||
<li>dskdfjslakfj</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="edu-txt-left mt5">
|
||||
<a href="javascript:void(0)" class="color-grey-c">删除</a>
|
||||
</div>
|
||||
</div>
|
||||
<span class="fr mr15 color-grey-c lineh-15 mt15">9:53</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="repeatBox padding20">
|
||||
<div>
|
||||
<textarea></textarea>
|
||||
</div>
|
||||
<p class="clearfix mt15">
|
||||
<span class="fl ml5 color-orange f12 mt5">在问题反馈时,请同时发送问题发生页的网址链接,以便我们高效的为您服务</span>
|
||||
<a href="javascript:void(0)" class="fr task-btn task-btn-orange">回复</a>
|
||||
</p>
|
||||
</div>
|
||||
</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>
|
|
@ -1,23 +1,25 @@
|
|||
<p class="clearfix font-16 padding30-20 bor-bottom-greyE">
|
||||
<span class="fl">全部私信</span>
|
||||
<a class="c-blue fr" href="javascript:void(0)">写私信</a>
|
||||
<%= link_to "写私信", new_user_private_message_path(current_user), remote: true, class: "c-blue fr" %>
|
||||
</p>
|
||||
<div>
|
||||
<% if @jours_count > 0 %>
|
||||
<% @jours_alls.each do |jour| %>
|
||||
<div class="private-item clearfix df">
|
||||
<%= link_to image_tag(url_to_avatar(jour.user), class: "r_list_img"), user_path(jour.user), :alt => "用户头像", class: "fl mr10 private_message_a", target: "_blank" %>
|
||||
<div class="fl flex1">
|
||||
<p>
|
||||
<%= link_to jour.user.try(:show_name), jour.user, class: "mr20 private_message_a f16" %>
|
||||
<span>与你的私信</span>
|
||||
<span class="color-grey-c mr20">[<%= jour.m_reply_count.to_i %>条]</span>
|
||||
<span class="color-grey-c">6天前</span>
|
||||
</p>
|
||||
<div class="color-grey-6 markdown-body mt10">
|
||||
<%= jour.notes.html_safe %>
|
||||
<%= link_to user_private_message_path(current_user,jour.id), remote: true do%>
|
||||
<div class="fl flex1">
|
||||
<p>
|
||||
<%= jour.user.try(:show_name) %>
|
||||
<span>与你的私信</span>
|
||||
<span class="color-grey-c mr20">[<%= (jour.m_reply_count.to_i + 1) %>条]</span>
|
||||
<span class="color-grey-c">6天前</span>
|
||||
</p>
|
||||
<div class="color-grey-6 markdown-body mt10">
|
||||
<%= jour.notes.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
|
|
@ -0,0 +1,3 @@
|
|||
<div id="user-messages-<%= current_user.try(:login) %>">
|
||||
<%= render partial: "private_messages/user_new_feedbacks" %>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
$("#user-messages-<%= current_user.try(:login) %>").html("<%= j render partial: "private_messages/user_new_feedbacks" %>")
|
|
@ -0,0 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'private_messages/new_message') %>";
|
||||
pop_box_new(htmlvalue,460,316);
|
|
@ -0,0 +1 @@
|
|||
$("#ant-spin-nested-loading").html("<%= j render pa%>")
|
|
@ -1 +1 @@
|
|||
$("#user-messages-<%= current_user.try(:login) %>").html("<%= j render partial: "users/user_new_feedbacks" %>")
|
||||
$("#user-messages-<%= current_user.try(:login) %>").html("<%= j render partial: "private_messages/private_box" %>")
|
|
@ -0,0 +1,3 @@
|
|||
<% if @unred_all_messages > 0 %>
|
||||
<span class="readingNum"><%= @unred_all_messages %></span>
|
||||
<% end %>
|
|
@ -17,10 +17,12 @@
|
|||
<div class="l_InfoNav mb20">
|
||||
<li class="clearfix active">
|
||||
<%= link_to "消息", user_message_path(current_user), remote: true, class: "ml30 width100" %>
|
||||
<span class="readingNum" id="unread-message-count-<%= current_user.login %>"><%= @unred_all_messages %></span>
|
||||
<span id="unread-message-count-<%= current_user.login %>">
|
||||
<%= render partial: "users/messages_count" %>
|
||||
</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<%= link_to "私信", feedback_path(current_user), class: "ml30 width100", remote: true %>
|
||||
<%= link_to "私信", user_private_messages_path(current_user), class: "ml30 width100", remote: true %>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
|
||||
$("#user-messages-<%= current_user.try(:login) %>").html("<%= escape_javascript( render :partial => 'users/infos', :locals => { :message_alls => @message_alls }) %>");
|
||||
|
||||
//$("#user-message-type-choose").html("<#%= j render partial: "users/user_message_types" %>")
|
||||
<% if @msg_type.present? %>
|
||||
$("#unread-message-count-<%= current_user.login %>").html("")
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<div id="user-messages-<%= current_user.try(:login) %>">
|
||||
<%= render partial: "users/user_new_feedbacks" %>
|
||||
</div>
|
|
@ -707,6 +707,7 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
#added by young
|
||||
resources :users do
|
||||
resources :private_messages
|
||||
collection do
|
||||
match "tag_saveEx" , :via => [:get, :post]
|
||||
post "user_new_homework"
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
class CreatePrivateMessages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :private_messages do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "target_id"
|
||||
t.integer "sender_id"
|
||||
t.integer "receiver_id"
|
||||
t.text "content"
|
||||
t.datetime "send_time"
|
||||
t.integer "status"
|
||||
t.timestamps
|
||||
end
|
||||
add_index :private_messages, [:user_id]
|
||||
end
|
||||
end
|
16
db/schema.rb
16
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20191023031103) do
|
||||
ActiveRecord::Schema.define(:version => 20191026085118) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1954,6 +1954,20 @@ ActiveRecord::Schema.define(:version => 20191023031103) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "private_messages", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "target_id"
|
||||
t.integer "sender_id"
|
||||
t.integer "receiver_id"
|
||||
t.text "content"
|
||||
t.datetime "send_time"
|
||||
t.integer "status"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "private_messages", ["user_id"], :name => "index_private_messages_on_user_id"
|
||||
|
||||
create_table "professional_levels", :force => true do |t|
|
||||
t.string "level"
|
||||
t.datetime "created_at", :null => false
|
||||
|
|
|
@ -1173,3 +1173,148 @@ a.task-btn {
|
|||
left: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
/*写私信的弹框*/
|
||||
.ant-modal-mask{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
height: 100%;
|
||||
background-color: rgba(0,0,0,.45);
|
||||
}
|
||||
.ant-modal-wrap{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
overflow: auto;
|
||||
outline: 0;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.ant-modal-centered{
|
||||
text-align: center;
|
||||
}
|
||||
.ant-modal-centered .ant-modal{
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.ant-modal{
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: rgba(0,0,0,.65);
|
||||
font-size: 14px;
|
||||
font-variant: tabular-nums;
|
||||
line-height: 1.5;
|
||||
list-style: none;
|
||||
-webkit-font-feature-settings: "tnum";
|
||||
font-feature-settings: "tnum";
|
||||
position: relative;
|
||||
top: 100px;
|
||||
width: auto;
|
||||
margin: 0 auto;
|
||||
padding-bottom: 24px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.ant-modal-content{
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
background-clip: padding-box;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 4px 12px rgba(0,0,0,.15);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,.15);
|
||||
pointer-events: auto;
|
||||
}
|
||||
.ant-modal-header{
|
||||
padding: 16px 24px;
|
||||
color: rgba(0,0,0,.65);
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
.ant-modal-title{
|
||||
font-size: 16px;
|
||||
font-weight: 700!important;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
}
|
||||
.ant-modal-body {
|
||||
padding: 30px 40px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.ant-input{
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font-variant: tabular-nums;
|
||||
list-style: none;
|
||||
-webkit-font-feature-settings: "tnum";
|
||||
font-feature-settings: "tnum";
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
padding: 4px 11px;
|
||||
color: rgba(0,0,0,.65);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
background-color: #fff;
|
||||
background-image: none;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 4px;
|
||||
-webkit-transition: all .3s;
|
||||
-o-transition: all .3s;
|
||||
transition: all .3s;
|
||||
}
|
||||
.ant-input-affix-wrapper .ant-input:not(:last-child) {
|
||||
padding-right: 30px;
|
||||
}
|
||||
.ant-input-suffix{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
z-index: 2;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
color: rgba(0,0,0,.65);
|
||||
line-height: 0;
|
||||
-webkit-transform: translateY(-50%);
|
||||
-ms-transform: translateY(-50%);
|
||||
transform: translateY(-50%);
|
||||
right: 12px;
|
||||
background: transparent!important;
|
||||
}
|
||||
.writeLetter_Info {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 260px;
|
||||
background-color: #F6F6F6;
|
||||
cursor: default;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.writeLetter_text {
|
||||
width: 100%;
|
||||
background-color: #F6F6F6;
|
||||
outline: none;
|
||||
height: 100%;
|
||||
padding: 5px 5px 30px 5px;
|
||||
border: 1px solid #EAEAEA;
|
||||
box-sizing: border-box;
|
||||
resize: none;
|
||||
}
|
||||
.longchar {
|
||||
position: absolute;
|
||||
background-color: #F6F6F6;
|
||||
bottom: 1px;
|
||||
color: #999999;
|
||||
right: 10px;
|
||||
}
|
Loading…
Reference in New Issue