课程通知的回复
This commit is contained in:
parent
d47f887fd1
commit
9da89ef5e2
|
@ -35,6 +35,8 @@ module Mobile
|
|||
comment.comments = params[:content]
|
||||
comment.author = current_user
|
||||
if news.comments << comment
|
||||
data = comment
|
||||
present :data, data, with: Mobile::Entities::Comment
|
||||
result = 2
|
||||
else
|
||||
result = 3
|
||||
|
@ -50,6 +52,8 @@ module Mobile
|
|||
reply.parent_id = params[:id]
|
||||
reply.subject = "RE: #{topic.subject}"
|
||||
if topic.children << reply
|
||||
data = reply
|
||||
present :data, data, with: Mobile::Entities::Message
|
||||
result = 2
|
||||
else
|
||||
result = 3
|
||||
|
|
|
@ -9,7 +9,7 @@ module Mobile
|
|||
elsif f.is_a?(::Comment)
|
||||
if f.respond_to?(field)
|
||||
if field == :created_on
|
||||
format_time(f.send(field))
|
||||
time_from_now(f.send(field))
|
||||
else
|
||||
f.send(field)
|
||||
end
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="post-interactive">
|
||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" <!--onclick="window.open('course_notice.html?id=<!=activities[i].act_id!>');"--> class="c-grey">回复 (<!=activities[i].reply_count!>)</a></div>
|
||||
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" onclick="window.open('course_notice.html?id=<!=activities[i].act_id!>');" class="c-grey">回复 (<!=activities[i].reply_count!>)</a></div>
|
||||
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -36,9 +36,10 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=discussion.replies_count!>)</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">()</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">((<!=discussion.message_praise_count!>))</span></div>
|
||||
</div>
|
||||
<! for(var j =0; j < discussion.message_children.length; ++j){ !>
|
||||
<div id="all_course_message_reply">
|
||||
<! for(var j = (discussion.message_children.length -1); j >= 0; --j){ !>
|
||||
<div class="post-reply-wrap border-bottom">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img src="<!=discussion.message_children[j].user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
|
@ -52,11 +53,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<! } !>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl" id = "100"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<input type="text" class="post-reply-input" id="postInput" />
|
||||
<input type="submit" value="回复" class="post-reply-submit fr mt10" onclick="replyInsert()" />
|
||||
<input type="submit" value="回复" class="post-reply-submit fr mt10"/>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,6 +66,20 @@
|
|||
</div>
|
||||
</script>
|
||||
|
||||
<script id="t:c-message-detail-reply" type="text/html">
|
||||
<div class="post-reply-wrap border-bottom">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img src="<!=reply.user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden"><!=reply.user.realname!></div>
|
||||
<div class="post-reply-content c-grey2 mb10"><!:=reply.content!></div>
|
||||
<div class="post-reply-date fl"><!=reply.lasted_comment!></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script src="/javascripts/jquery-1.3.2.js"></script>
|
||||
<script src="/javascripts/baiduTemplate.js"></script>
|
||||
<script src="/javascripts/wechat/course_discussion.js"></script>
|
||||
|
|
|
@ -36,14 +36,15 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=course.comments_count!>)</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">1</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">(<!=course.news_praise_count!>)</span></div>
|
||||
</div>
|
||||
<! for(var j =0; j < course.comments.length; ++j){ !>
|
||||
<div id="all_news_reply">
|
||||
<! for(var j = (course.comments.length -1); j >= 0; --j){ !>
|
||||
<div class="post-reply-wrap border-bottom">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img src="<!=course.comments[j].user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="post-reply-avatar fl"><img src="<!=course.comments[j].author.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden"><!=course.comments[j].user.realname!></div>
|
||||
<div class="post-reply-user hidden"><!=course.comments[j].author.realname!></div>
|
||||
<div class="post-reply-content c-grey2 mb10"><!:=course.comments[j].comments!></div>
|
||||
<div class="post-reply-date fl"><!=course.comments[j].created_on!></div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
|
@ -52,11 +53,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<! } !>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl" id = "100"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<input type="text" class="post-reply-input" id="postInput" />
|
||||
<input type="submit" value="回复" class="post-reply-submit fr mt10" onclick="replyInsert()" />
|
||||
<input type="submit" value="回复" class="post-reply-submit fr mt10" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,6 +66,22 @@
|
|||
</div>
|
||||
</script>
|
||||
|
||||
<script id="t:news-detail-reply" type="text/html">
|
||||
<div class="post-reply-wrap border-bottom">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img src="<!=reply.author.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden"><!=reply.author.realname!></div>
|
||||
<div class="post-reply-content c-grey2 mb10"><!:=reply.comments!></div>
|
||||
<div class="post-reply-date fl"><!=reply.created_on!></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script src="/javascripts/jquery-1.3.2.js"></script>
|
||||
<script src="/javascripts/baiduTemplate.js"></script>
|
||||
<script src="/javascripts/wechat/course_notice.js"></script>
|
||||
|
|
|
@ -10,6 +10,12 @@ $(document).ready(function(){
|
|||
|
||||
var apiUrl = '/api/v1/';
|
||||
|
||||
var setReplyTemplate = function(data){
|
||||
console.log(data);
|
||||
var html=bt('t:c-message-detail-reply',{reply: data});
|
||||
$('#all_course_message_reply').prepend(html);
|
||||
};
|
||||
|
||||
var setTemplate = function(data){
|
||||
console.log(data);
|
||||
var html=bt('t:course-discussion',{discussion: data});
|
||||
|
@ -17,9 +23,9 @@ $(document).ready(function(){
|
|||
$('.post-reply-submit').click(function(){
|
||||
replyInsert();
|
||||
});
|
||||
$('post-interactive-praise').click(function(){
|
||||
/*$('post-interactive-praise').click(function(){
|
||||
praiseClick();
|
||||
});
|
||||
});*/
|
||||
};
|
||||
|
||||
var loadDataFromServer = function(id){
|
||||
|
@ -52,9 +58,9 @@ $(document).ready(function(){
|
|||
}else{
|
||||
|
||||
//将用户输入内容插入最后一条回复
|
||||
$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
|
||||
/*$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
|
||||
$(".post-reply-content:last").append(replyContent);
|
||||
$(".post-reply-date:last").append(Date());
|
||||
$(".post-reply-date:last").append(Date());*/
|
||||
var postInput = $("#postInput").val();
|
||||
$("#postInput").val("");
|
||||
//回复数目+1
|
||||
|
@ -71,10 +77,11 @@ $(document).ready(function(){
|
|||
$.ajax({
|
||||
type: "POST", //提交方式
|
||||
dataType: "json", //类型
|
||||
url: "前台地址/后台方法", //提交的页面,方法名
|
||||
url: apiUrl + 'new_comment/' + homeworkID, //提交的页面,方法名
|
||||
data: userInfo, //参数,如果没有,可以为null
|
||||
success: function (data) { //如果执行成功,那么执行此方法
|
||||
alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句
|
||||
setReplyTemplate(data.data);
|
||||
alert("6");
|
||||
},
|
||||
error: function (err) { //如果执行不成功,那么执行此方法
|
||||
alert("err:" + err);
|
||||
|
@ -84,12 +91,12 @@ $(document).ready(function(){
|
|||
|
||||
}
|
||||
|
||||
//点赞效果
|
||||
/*//点赞效果
|
||||
var praiseClick = function(){
|
||||
var praiseNum = $(".post-interactive-praise").text().match(/\d+/g);
|
||||
praiseNum++;
|
||||
$(".praise-num").text("(" + praiseNum + ")");
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
});
|
|
@ -10,6 +10,12 @@ $(document).ready(function(){
|
|||
|
||||
var apiUrl = '/api/v1/';
|
||||
|
||||
var setReplyTemplate = function(data){
|
||||
console.log(data);
|
||||
var html=bt('t:news-detail-reply',{reply: data});
|
||||
$('#all_news_reply').prepend(html);
|
||||
};
|
||||
|
||||
var setTemplate = function(data){
|
||||
console.log(data);
|
||||
var html=bt('t:course-notice',{course: data});
|
||||
|
@ -17,9 +23,9 @@ $(document).ready(function(){
|
|||
$('.post-reply-submit').click(function(){
|
||||
replyInsert();
|
||||
});
|
||||
$('post-interactive-praise').click(function(){
|
||||
/*$('post-interactive-praise').click(function(){
|
||||
praiseClick();
|
||||
});
|
||||
});*/
|
||||
};
|
||||
|
||||
var loadDataFromServer = function(id){
|
||||
|
@ -52,9 +58,9 @@ $(document).ready(function(){
|
|||
}else{
|
||||
|
||||
//将用户输入内容插入最后一条回复
|
||||
$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
|
||||
/*$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
|
||||
$(".post-reply-content:last").append(replyContent);
|
||||
$(".post-reply-date:last").append(Date());
|
||||
$(".post-reply-date:last").append(Date());*/
|
||||
var postInput = $("#postInput").val();
|
||||
$("#postInput").val("");
|
||||
//回复数目+1
|
||||
|
@ -64,17 +70,17 @@ $(document).ready(function(){
|
|||
|
||||
//获取并传送回复用户数据
|
||||
var userInfo = {
|
||||
"replyType" : "homework_assignment",
|
||||
"replyContent" : postInput
|
||||
"type" : "News",
|
||||
"content" : postInput
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST", //提交方式
|
||||
dataType: "json", //类型
|
||||
url: "前台地址/后台方法", //提交的页面,方法名
|
||||
url: apiUrl + 'new_comment/' + homeworkID, //提交的页面,方法名
|
||||
data: userInfo, //参数,如果没有,可以为null
|
||||
success: function (data) { //如果执行成功,那么执行此方法
|
||||
alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句
|
||||
setReplyTemplate(data.data);
|
||||
},
|
||||
error: function (err) { //如果执行不成功,那么执行此方法
|
||||
alert("err:" + err);
|
||||
|
|
Loading…
Reference in New Issue