通知功能开发完成;通知的内容格式修改;项目成员列表bug修改;分享通知和项目通知经过测试,没有问题,任务通知尚不清楚
This commit is contained in:
parent
bd58f7795c
commit
0ab28d906e
|
@ -8,7 +8,7 @@ class NotesController < ApplicationController
|
|||
#Todo
|
||||
pid = params[:project_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|
|
||||
h[k] = []
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ class ProjectsController < ApplicationController
|
|||
pu = Projects_user.new(params_pu)
|
||||
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
|
||||
params_note = {user_id: uid,content: content,category: 2,project_id: pid}
|
||||
note = Note.new(params_note)
|
||||
|
@ -89,7 +89,7 @@ class ProjectsController < ApplicationController
|
|||
puts projects_user.project_id
|
||||
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
|
||||
params_note = {user_id: uid,content: content,category: 2,project_id: pid}
|
||||
note = Note.new(params_note)
|
||||
|
@ -112,7 +112,7 @@ class ProjectsController < ApplicationController
|
|||
uid = projects_user.user_id
|
||||
i = User.find_by(id: uid)
|
||||
users += [{
|
||||
:nickname => i.name,
|
||||
:name => i.name,
|
||||
:id => i.id
|
||||
}]
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class SharesController < ApplicationController
|
|||
share=Share.new(share_params)
|
||||
share.user_id=uid
|
||||
if share.save
|
||||
content = User.find(uid).name + "分享了一些事"
|
||||
content = "<a>"+User.find(uid).name + "</a> 分享了一些事"
|
||||
pid=share.project_id
|
||||
|
||||
Projects_user.where(:project_id => pid).each do |i|
|
||||
|
|
|
@ -47,89 +47,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<!-- The time line -->
|
||||
<ul class="timeline">
|
||||
<!-- 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 -->
|
||||
<ul class="timeline" id="inform_container">
|
||||
<div class="control-sidebar-bg"></div>
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
@ -143,8 +61,43 @@
|
|||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="../dist/js/demo.js"></script>
|
||||
<!-- date select and query -->
|
||||
<!-- Custom Scripts -->
|
||||
<script src="include/main.js"></script>
|
||||
<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>
|
||||
|
||||
</html>
|
|
@ -95,14 +95,14 @@
|
|||
<div class="box-body">
|
||||
<div class="row">
|
||||
<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>
|
||||
<tr>
|
||||
<th style="text-align:center">姓名</th>
|
||||
<th style="text-align:center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="user_list_container">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -160,14 +160,11 @@
|
|||
$("#project_content").val(data.content);
|
||||
var users = data.users;
|
||||
for(var i = 0; i < users.length; ++i){
|
||||
var tduser = $("<td></td>").text(users[i].nickname);
|
||||
var btn = $("<button></button>").text("删除");
|
||||
btn.attr("class","btn btn-primary btn-danger");
|
||||
btn.attr("onclick","deleteUser("+users[i].id+")");
|
||||
if( users[i].id!=parent.LoginUserInfo.id ){// 不能将自己从项目中删除
|
||||
var tdbtn = $("<td></td>").append(btn);
|
||||
}
|
||||
$("#cy_user_lists").children("tbody").append($("<tr></tr>").append(tduser,tdbtn));
|
||||
var button_label="";
|
||||
if( users[i].id!=parent.LoginUserInfo.id )
|
||||
button_label='<td><button class="btn btn-primary btn-danger" onclick="deleteUser('+users[i].id+')">删除</button></td>';
|
||||
var user_label="<tr><td>"+users[i].name+"</td>"+button_label+"</tr>";
|
||||
$("#user_list_container").append(user_label);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
Loading…
Reference in New Issue