通知功能开发完成;通知的内容格式修改;项目成员列表bug修改;分享通知和项目通知经过测试,没有问题,任务通知尚不清楚
This commit is contained in:
parent
bd58f7795c
commit
0ab28d906e
|
@ -8,7 +8,7 @@ class NotesController < ApplicationController
|
||||||
#Todo
|
#Todo
|
||||||
pid = params[:project_id]
|
pid = params[:project_id]
|
||||||
uid = session[:user_id]
|
uid = session[:user_id]
|
||||||
notes = Note.where("user_id = ? AND project_id = ? ",uid,pid).order(:created_at).all
|
notes = Note.where("user_id = ? AND project_id = ? ",uid,pid).order("created_at desc").all
|
||||||
note = Hash.new do |h,k|
|
note = Hash.new do |h,k|
|
||||||
h[k] = []
|
h[k] = []
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ProjectsController < ApplicationController
|
||||||
pu = Projects_user.new(params_pu)
|
pu = Projects_user.new(params_pu)
|
||||||
pu.save
|
pu.save
|
||||||
|
|
||||||
content = User.find_by(id: register).name + "邀请您进入项目" + Project.find_by(id: pid).name
|
content = "<a>"+User.find_by(id: register).name + "</a> 邀请您进入项目 <a>" + Project.find_by(id: pid).name+"</a>"
|
||||||
puts content
|
puts content
|
||||||
params_note = {user_id: uid,content: content,category: 2,project_id: pid}
|
params_note = {user_id: uid,content: content,category: 2,project_id: pid}
|
||||||
note = Note.new(params_note)
|
note = Note.new(params_note)
|
||||||
|
@ -89,7 +89,7 @@ class ProjectsController < ApplicationController
|
||||||
puts projects_user.project_id
|
puts projects_user.project_id
|
||||||
Projects_user.where(project_id:pid,user_id:uid).delete_all
|
Projects_user.where(project_id:pid,user_id:uid).delete_all
|
||||||
|
|
||||||
content = User.find_by(id: register).name + "把您从项目" + Project.find_by(id: pid).name+"中删除"
|
content ="<a>"+ User.find_by(id: register).name + "</a> 把您从项目 <a>" + Project.find_by(id: pid).name+"</a> 中删除"
|
||||||
puts content
|
puts content
|
||||||
params_note = {user_id: uid,content: content,category: 2,project_id: pid}
|
params_note = {user_id: uid,content: content,category: 2,project_id: pid}
|
||||||
note = Note.new(params_note)
|
note = Note.new(params_note)
|
||||||
|
@ -112,7 +112,7 @@ class ProjectsController < ApplicationController
|
||||||
uid = projects_user.user_id
|
uid = projects_user.user_id
|
||||||
i = User.find_by(id: uid)
|
i = User.find_by(id: uid)
|
||||||
users += [{
|
users += [{
|
||||||
:nickname => i.name,
|
:name => i.name,
|
||||||
:id => i.id
|
:id => i.id
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class SharesController < ApplicationController
|
||||||
share=Share.new(share_params)
|
share=Share.new(share_params)
|
||||||
share.user_id=uid
|
share.user_id=uid
|
||||||
if share.save
|
if share.save
|
||||||
content = User.find(uid).name + "分享了一些事"
|
content = "<a>"+User.find(uid).name + "</a> 分享了一些事"
|
||||||
pid=share.project_id
|
pid=share.project_id
|
||||||
|
|
||||||
Projects_user.where(:project_id => pid).each do |i|
|
Projects_user.where(:project_id => pid).each do |i|
|
||||||
|
|
|
@ -47,89 +47,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8 col-md-offset-2">
|
<div class="col-md-8 col-md-offset-2">
|
||||||
<!-- The time line -->
|
<!-- The time line -->
|
||||||
<ul class="timeline">
|
<ul class="timeline" id="inform_container">
|
||||||
<!-- timeline time label -->
|
|
||||||
<li class="time-label">
|
|
||||||
<span class="bg-red">
|
|
||||||
2016年12月8日
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<!-- /.timeline-label -->
|
|
||||||
<!-- timeline item -->
|
|
||||||
<li>
|
|
||||||
<i class="fa fa-tasks bg-blue"></i>
|
|
||||||
<div class="timeline-item">
|
|
||||||
<span class="time"><i class="fa fa-clock-o"></i> 12:05</span>
|
|
||||||
<h3 class="timeline-header"><a href="#">前端原型开发</a> 任务发生了变化</h3>
|
|
||||||
<div class="timeline-body">
|
|
||||||
荷塘的四面,远远近近,高高低低都是树,而杨柳最多。这些树将一片荷塘重重围住;只在小路一旁,漏着几段空隙,像是特为月光留下的。树色一例是阴阴的,乍看像一团烟雾;但杨柳的丰姿⑽,便在烟雾里也辨得出。树梢上隐隐约约的是一带远山,只有些大意罢了。树缝里也漏着一两点路灯光,没精打采的,是渴睡人的眼。这时候最热闹的,要数树上的蝉声与水里的蛙声;但热闹是它们的,我什么也没有。
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- END timeline item -->
|
|
||||||
<!-- timeline item -->
|
|
||||||
<li>
|
|
||||||
<i class="fa fa-share-alt bg-aqua"></i>
|
|
||||||
<div class="timeline-item">
|
|
||||||
<span class="time"><i class="fa fa-clock-o"></i> 5分钟前</span>
|
|
||||||
<h3 class="timeline-header no-border"><a href="#">杨诏</a> 分享了一些事</h3>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- END timeline item -->
|
|
||||||
<!-- timeline item -->
|
|
||||||
<li>
|
|
||||||
<i class="fa fa-sitemap bg-yellow"></i>
|
|
||||||
<div class="timeline-item">
|
|
||||||
<span class="time"><i class="fa fa-clock-o"></i> 27分钟前</span>
|
|
||||||
<h3 class="timeline-header"><a href="#">XX项目</a> 邀请您进入项目</h3>
|
|
||||||
<div class="timeline-body">
|
|
||||||
忽然想起采莲的事情来了。采莲是江南的旧俗,似乎很早就有,而六朝时为盛;从诗歌里可以约略知道。采莲的是少年的女子,她们是荡着小船,唱着艳歌去的。
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- END timeline item -->
|
|
||||||
<!-- timeline time label -->
|
|
||||||
<li class="time-label">
|
|
||||||
<span class="bg-red">
|
|
||||||
2016年12月7日
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
<!-- /.timeline-label -->
|
|
||||||
<!-- timeline item -->
|
|
||||||
<li>
|
|
||||||
<i class="fa fa-tasks bg-blue"></i>
|
|
||||||
<div class="timeline-item">
|
|
||||||
<span class="time"><i class="fa fa-clock-o"></i> 12:05</span>
|
|
||||||
<h3 class="timeline-header"><a href="#">前端原型开发</a> 任务发生了变化</h3>
|
|
||||||
<div class="timeline-body">
|
|
||||||
荷塘的四面,远远近近,高高低低都是树,而杨柳最多。这些树将一片荷塘重重围住;只在小路一旁,漏着几段空隙,像是特为月光留下的。树色一例是阴阴的,乍看像一团烟雾;但杨柳的丰姿⑽,便在烟雾里也辨得出。树梢上隐隐约约的是一带远山,只有些大意罢了。树缝里也漏着一两点路灯光,没精打采的,是渴睡人的眼。这时候最热闹的,要数树上的蝉声与水里的蛙声;但热闹是它们的,我什么也没有。
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- END timeline item -->
|
|
||||||
<!-- timeline item -->
|
|
||||||
<li>
|
|
||||||
<i class="fa fa-share-alt bg-aqua"></i>
|
|
||||||
<div class="timeline-item">
|
|
||||||
<span class="time"><i class="fa fa-clock-o"></i> 5分钟前</span>
|
|
||||||
<h3 class="timeline-header no-border"><a href="#">杨诏</a> 分享了一些事</h3>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- END timeline item -->
|
|
||||||
<!-- timeline item -->
|
|
||||||
<li>
|
|
||||||
<i class="fa fa-sitemap bg-yellow"></i>
|
|
||||||
<div class="timeline-item">
|
|
||||||
<span class="time"><i class="fa fa-clock-o"></i> 27分钟前</span>
|
|
||||||
<h3 class="timeline-header"><a href="#">XX项目</a> 邀请您进入项目</h3>
|
|
||||||
<div class="timeline-body">
|
|
||||||
忽然想起采莲的事情来了。采莲是江南的旧俗,似乎很早就有,而六朝时为盛;从诗歌里可以约略知道。采莲的是少年的女子,她们是荡着小船,唱着艳歌去的。
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<!-- END timeline item -->
|
|
||||||
<!-- Add the sidebar's background. This div must be placed
|
|
||||||
immediately after the control sidebar -->
|
|
||||||
<div class="control-sidebar-bg"></div>
|
<div class="control-sidebar-bg"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- ./wrapper -->
|
<!-- ./wrapper -->
|
||||||
|
@ -143,8 +61,43 @@
|
||||||
<!-- AdminLTE for demo purposes -->
|
<!-- AdminLTE for demo purposes -->
|
||||||
<script src="../dist/js/demo.js"></script>
|
<script src="../dist/js/demo.js"></script>
|
||||||
<!-- date select and query -->
|
<!-- date select and query -->
|
||||||
<!-- Custom Scripts -->
|
<script>
|
||||||
<script src="include/main.js"></script>
|
$(document).ready(function(){
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
dataType: "json",
|
||||||
|
url:"/notes/list.json",
|
||||||
|
data:{
|
||||||
|
"project_id":parent.LoginUserInfo.selectProject
|
||||||
|
},
|
||||||
|
statusCode: {
|
||||||
|
200: function(response) {// 请求成功
|
||||||
|
var data=response.data;
|
||||||
|
for(var i=0;i<data.length;i++){// date
|
||||||
|
var time_label='<li class="time-label"><span class="bg-red">'+data[i].time+'</span></li>';
|
||||||
|
$("#inform_container").append(time_label);
|
||||||
|
var informs=data[i].notes;
|
||||||
|
var icon_class=['fa fa-share-alt bg-aqua','fa fa-sitemap bg-yellow','fa fa-tasks bg-blue'];// 顺序:分享、项目、任务
|
||||||
|
for(var j=0;j<informs.length;j++){
|
||||||
|
var inform_label='\
|
||||||
|
<li>\
|
||||||
|
<i class="'+icon_class[informs[j].type]+'"></i>\
|
||||||
|
<div class="timeline-item">\
|
||||||
|
<span class="time"><i class="fa fa-clock-o"></i>'+informs[j].time.substring(0,5)+'</span>\
|
||||||
|
<h3 class="timeline-header">'+informs[j].content+'</h3>\
|
||||||
|
</div>\
|
||||||
|
</li>';
|
||||||
|
$("#inform_container").append(inform_label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
422:function(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -95,14 +95,14 @@
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-9 col-md-push-2">
|
<div class="col-lg-9 col-md-push-2">
|
||||||
<table id="cy_user_lists" class="table" style="text-align:center">
|
<table class="table" style="text-align:center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align:center">姓名</th>
|
<th style="text-align:center">姓名</th>
|
||||||
<th style="text-align:center">操作</th>
|
<th style="text-align:center">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="user_list_container">
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -160,14 +160,11 @@
|
||||||
$("#project_content").val(data.content);
|
$("#project_content").val(data.content);
|
||||||
var users = data.users;
|
var users = data.users;
|
||||||
for(var i = 0; i < users.length; ++i){
|
for(var i = 0; i < users.length; ++i){
|
||||||
var tduser = $("<td></td>").text(users[i].nickname);
|
var button_label="";
|
||||||
var btn = $("<button></button>").text("删除");
|
if( users[i].id!=parent.LoginUserInfo.id )
|
||||||
btn.attr("class","btn btn-primary btn-danger");
|
button_label='<td><button class="btn btn-primary btn-danger" onclick="deleteUser('+users[i].id+')">删除</button></td>';
|
||||||
btn.attr("onclick","deleteUser("+users[i].id+")");
|
var user_label="<tr><td>"+users[i].name+"</td>"+button_label+"</tr>";
|
||||||
if( users[i].id!=parent.LoginUserInfo.id ){// 不能将自己从项目中删除
|
$("#user_list_container").append(user_label);
|
||||||
var tdbtn = $("<td></td>").append(btn);
|
|
||||||
}
|
|
||||||
$("#cy_user_lists").children("tbody").append($("<tr></tr>").append(tduser,tdbtn));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
Loading…
Reference in New Issue