在动态中回复通知动态
This commit is contained in:
parent
147afc09a5
commit
84ff3450d2
|
@ -34,7 +34,7 @@ class CommentsController < ApplicationController
|
|||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
|
||||
end
|
||||
# 与我相关动态的记录add start
|
||||
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add start
|
||||
if( @comment.id && @news.course )
|
||||
if(@news.author_id != User.current.id)
|
||||
notify = ActivityNotify.new()
|
||||
|
@ -47,11 +47,18 @@ class CommentsController < ApplicationController
|
|||
notify.save()
|
||||
end
|
||||
end
|
||||
# 与我相关动态的记录add end
|
||||
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end
|
||||
flash[:notice] = l(:label_comment_added)
|
||||
end
|
||||
|
||||
redirect_to news_url(@news)
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
else
|
||||
redirect_to news_url(@news)
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
|
||||
init_KindEditor_data(<%= @user_activity_id%>);
|
|
@ -1,4 +1,4 @@
|
|||
<div class="resources mt10" id="course_news_<%= activity.id%>">
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
|
@ -18,9 +18,9 @@
|
|||
<div class="homepagePostDate">
|
||||
发布时间:<%= format_date(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity.id %>">通知描述:<%= activity.description.html_safe %></div>
|
||||
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id %>">通知描述:<%= activity.description.html_safe %></div>
|
||||
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden">
|
||||
<div class="homepagePostSetting none" id="act-<%= user_activity_id %>">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
@ -40,12 +40,27 @@
|
|||
<div class="homepagePostReplyBannerCount">回复(<%= count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>2 %>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity.id%>" onclick="expand_reply('#reply_div_<%= user_activity.id %> li','#reply_btn_<%=user_activity.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >点击展开更多回复(<%= count.to_s%>)</a></div>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >点击展开更多回复(<%= count.to_s%>)</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="homepagePostReplyInputContainer">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="comment"></textarea>
|
||||
<p nhname='contentmsg'></p>
|
||||
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
|
||||
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:3px;">取消</a>
|
||||
<a id="new_message_submit_btn" href="javascript:void(0)" class="blue_n_btn fr mr5 " style="margin-top:3px;">发送</a>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% unless activity.comments.empty? %>
|
||||
<div class="homepagePostReplyContainer" id="reply_div_<%= user_activity.id %>">
|
||||
<div class="homepagePostReplyContainer" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
|
||||
<% user_activities.each do |user_activity|
|
||||
unless user_activities.nil? %>
|
||||
if user_activities %>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container);
|
||||
|
@ -16,6 +17,10 @@
|
|||
target.eq(1).show();
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
init_KindEditor_data(<%= user_activity.id%>);
|
||||
});
|
||||
</script>
|
||||
<% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>
|
||||
<% case user_activity.container_type.to_s %>
|
||||
|
@ -25,7 +30,7 @@
|
|||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity =>user_activity} %>
|
||||
<% when 'Poll' %>
|
||||
|
|
|
@ -1,29 +1,4 @@
|
|||
<!--<div class="top_new">-->
|
||||
<!--<span class="<%#= (@user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true)) ? 'top_new_bg' : 'top_newcourses_bg'%> fl"></span>-->
|
||||
<!--<%# if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>-->
|
||||
<!--<a href="<%#= url_for(:controller => 'courses', :action => 'new',) %>" class="green_n_btn fr mt2" target="_blank">新建课程</a>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<style type="text/css">
|
||||
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}
|
||||
|
||||
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
|
||||
div.recall_con{width:570px;}
|
||||
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
|
||||
.fr.cr{ clear: right}
|
||||
</style>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %>
|
||||
<!--<div id="RSide" class="fl">-->
|
||||
<!--<div class="users_r_top">-->
|
||||
<!--<h2 class="users_r_h2">用户留言</h2>-->
|
||||
<!--</div>-->
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor","user" %>
|
||||
<div >
|
||||
<div class="resources mb10">
|
||||
<div class="homepageRightBanner">
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
function init_editor(params){
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",height:"80px",
|
||||
items:['emoticons'],
|
||||
afterChange:function(){//按键事件
|
||||
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
},
|
||||
afterCreate:function(){
|
||||
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty()){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function init_form(params){
|
||||
params.form.submit(function(){
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function nh_reset_form(params){
|
||||
params.form[0].reset();
|
||||
params.textarea.empty();
|
||||
if(params.editor != undefined){
|
||||
params.editor.html(params.textarea.html());
|
||||
}
|
||||
params.contentmsg.hide();
|
||||
}
|
||||
|
||||
function init_KindEditor_data(id){
|
||||
KindEditor.ready(function (K) {
|
||||
$("div[nhname='new_message_" + id + "']").each(function () {
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form", params.div_form);
|
||||
if (params.form == undefined || params.form.length == 0) {
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='new_message_textarea']", params.div_form);
|
||||
params.contentmsg = $("p[nhname='contentmsg']", params.div_form);
|
||||
params.toolbar_container = $("div[nhname='toolbar_container']", params.div_form);
|
||||
params.cancel_btn = $("#new_message_cancel_btn");
|
||||
params.submit_btn = $("#new_message_submit_btn");
|
||||
|
||||
if (params.textarea.data('init') == undefined) {
|
||||
params.editor = init_editor(params);
|
||||
init_form(params);
|
||||
params.cancel_btn.click(function () {
|
||||
nh_reset_form(params);
|
||||
});
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,74 +1,5 @@
|
|||
//个人动态
|
||||
$(function(){
|
||||
function init_editor(params){
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",height:"80px",
|
||||
items:['emoticons'],
|
||||
afterChange:function(){//按键事件
|
||||
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
},
|
||||
afterCreate:function(){
|
||||
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty()){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function init_form(params){
|
||||
params.form.submit(function(){
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function nh_reset_form(params){
|
||||
params.form[0].reset();
|
||||
params.textarea.empty();
|
||||
if(params.editor != undefined){
|
||||
params.editor.html(params.textarea.html());
|
||||
}
|
||||
params.contentmsg.hide();
|
||||
}
|
||||
|
||||
KindEditor.ready(function(K){
|
||||
$("a[nhname='reply_btn']").live('click',function(){
|
||||
var params = {};
|
||||
|
@ -167,110 +98,4 @@ $(function(){
|
|||
});
|
||||
});
|
||||
});
|
||||
function init_list_more_div(params){
|
||||
var p=params;
|
||||
p.exbtn.click(function(){
|
||||
var isclose = p.container.data('isclose');
|
||||
var hasmore = p.container.data('hasmore');
|
||||
if(isclose == '1'){
|
||||
$("div[nhname='rec']",p.container).show();
|
||||
p.container.data('isclose','0');
|
||||
change_status_4_list_more_div(params);
|
||||
return;
|
||||
}
|
||||
if(hasmore == '0'){
|
||||
change_status_4_list_more_div(params,'get');
|
||||
return;
|
||||
}
|
||||
var url = p.container.data('url');
|
||||
if($("div[nhname='rec']",p.container).length > 0){
|
||||
var lastid = $("div[nhname='rec']",p.container).filter(':last').data('id');
|
||||
url += "?lastid="+lastid;
|
||||
var lasttime = $("div[nhname='rec']",p.container).filter(':last').data('time');
|
||||
if(lasttime != undefined){
|
||||
url += "&lasttime="+lasttime;
|
||||
}
|
||||
}
|
||||
$.ajax( {url:url,dataType:'text',success:function(data){
|
||||
var html = $("<div>"+data+"</div>");
|
||||
var lens = $("div[nhname='rec']",html).length;
|
||||
if(lens < p.size){
|
||||
p.container.data('hasmore','0');
|
||||
}
|
||||
if(lens>0){
|
||||
var currpage = parseInt(p.container.data('currpage'))+1;
|
||||
p.container.data('currpage',currpage);
|
||||
p.container.append(html.html())
|
||||
}
|
||||
change_status_4_list_more_div(params,'get');
|
||||
p.div.show();
|
||||
}} );
|
||||
});
|
||||
p.clbtn.click(function(){
|
||||
var i=0;
|
||||
$("div[nhname='rec']",p.container).each(function(){
|
||||
i++;
|
||||
if(i> p.size){
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
p.container.data('isclose','1');
|
||||
change_status_4_list_more_div(params);
|
||||
});
|
||||
p.exbtn.click();
|
||||
}
|
||||
function change_status_4_list_more_div(params,opt){
|
||||
var p=params;
|
||||
if($("div[nhname='rec']",p.container).length == 0 && opt != 'get'){
|
||||
p.exbtn.click();
|
||||
return;
|
||||
}
|
||||
var show_lens = $("div[nhname='rec']",p.container).length - $("div[nhname='rec']",p.container).filter(':hidden').length;
|
||||
if( show_lens > p.size ){
|
||||
p.clbtn.show();
|
||||
}else{
|
||||
p.clbtn.hide();
|
||||
}
|
||||
if($("div[nhname='rec']",p.container).length == 0){
|
||||
p.exbtn.html(p.nodatamsg);
|
||||
}else if( p.container.data('hasmore') == '1' || p.container.data('isclose')=='1' ){
|
||||
p.exbtn.html('点击展开更多');
|
||||
}else{
|
||||
p.exbtn.html('没有更多了');
|
||||
}
|
||||
}
|
||||
function init_list_more_div_params(div){
|
||||
var params = {};
|
||||
params.div = div;
|
||||
params.container = $("div[nhname='container']",div);
|
||||
params.exbtn = $("a[nhname='expand']",div);
|
||||
params.clbtn = $("a[nhname='close']",div);
|
||||
params.size = params.container.data('pagesize');
|
||||
params.nodatamsg = params.container.data('nodatamsg');
|
||||
if( params.size == undefined ){
|
||||
params.size = 13;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
$(function(){
|
||||
$("div[nhname='list_more_div']").each(function(){
|
||||
var params = init_list_more_div_params($(this));
|
||||
init_list_more_div(params)
|
||||
});
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$(".newsType").mouseover(function(){
|
||||
$(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px -25px no-repeat"});
|
||||
});
|
||||
$(".newsType").mouseout(function(){
|
||||
$(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px 0px no-repeat"});
|
||||
});
|
||||
$(".resourcesSelected").mouseover(function(){
|
||||
$(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px -25px no-repeat"});
|
||||
});
|
||||
$(".resourcesSelected").mouseout(function(){
|
||||
$(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px 0px no-repeat"});
|
||||
});
|
||||
});
|
||||
//个人动态 end
|
|
@ -587,7 +587,7 @@ a.postTypeGrey:hover {color:#269ac9;}
|
|||
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;}
|
||||
.homepagePostReplyBannerTime{width:85px; display:inline-block;}
|
||||
.homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;}
|
||||
.homepagePostReplyInputContainer {width:670px; margin:0px auto;}
|
||||
.homepagePostReplyInputContainer {width:670px; margin: 10px auto 0 auto;}
|
||||
.homepagePostReplyInput {width:663px; height:45px; max-width:663px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:20px auto 10px auto;}
|
||||
.homepagePostReplyEmotion {background:url(../images/homepage_icon.png) -90px -88px no-repeat; width:50px; height:24px; float:left; padding-left:30px;}
|
||||
.homepagePostReplySubmit {float:right; width:45px; height:24px; text-align:center; line-height:24px; vertical-align:middle; font-size:12px; color:#ffffff; background-color:#269ac9;}
|
||||
|
@ -955,6 +955,20 @@ img.ui-datepicker-trigger {
|
|||
.is_public{display: none !important;}
|
||||
.ui-corner-left{background: #64bdd9;}
|
||||
|
||||
/*回复框*/
|
||||
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}
|
||||
|
||||
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
|
||||
div.recall_con{width:570px;}
|
||||
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
|
||||
.fr.cr{ clear: right}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue