留言回复

This commit is contained in:
sw 2015-07-30 10:45:58 +08:00
parent 51a7044e05
commit 7628a53cdc
4 changed files with 79 additions and 55 deletions

View File

@ -0,0 +1,38 @@
<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
<div class="mes_box02" id = '<%= reply.id %>'>
<%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %>
<div class=" mes_box02_info fl">
<%= link_to "#{reply.user.login}&nbsp;:&nbsp;".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%>
<span class="fl c_grey">&nbsp;回复:&nbsp;</span>
<%= link_to "#{parent_jour.user.login}&nbsp;:&nbsp;".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%>
<div class="cl">
<%= reply.notes.html_safe %>
</div>
</div>
<span class="c_grey fr">
<%= time_tag(reply.created_on).html_safe%>
</span>
<div class="fr cr">
<%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %>
<% if User.current.admin? || reply.user == User.current%>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "c_purple ml5", :title => l(:button_delete)) %>
<% end %>
</div>
<div class="cl"></div>
<div nhname='div_form' class="mt10 ml40" style="display:none;">
<form action="<%= url_for(:controller => 'words', :action => 'create_reply') %>" data-remote="true" method="post">
<input id="reference_id" name="reference_id" type="hidden" value="<%= (reply.m_parent_id.nil? || reply.m_parent_id==0 ) ? reply.id : reply.m_parent_id %>">
<input id="reference_user_id" name="reference_user_id" type="hidden" value="<%= reply.user.id %>">
<input id="reference_message_id" name="reference_message_id" type="hidden" value="<%= reply.id %>">
<input id="show_name" name="show_name" type="hidden" value="true">
<textarea name='user_notes' style="display:none;"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a nhname="cancel_btn" href="javascript:;" class="grey_n_btn fr" style="margin-top:3px;">取消</a>
<a nhname="submit_btn" href="javascript:;" class="blue_n_btn fr mr5" style="margin-top:3px;">发布</a>
</form>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div><!--mes_box02 end-->

View File

@ -1,5 +1,4 @@
<div class="message_list" id="<%= jour.id%>">
<div>
<div class="message_list" id="<%= jour.id %>" nhname="rec" data-id="<%= jour.id %>">
<%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %>
<div class="fl ml5 mes_box mb10" >
<div>
@ -15,40 +14,31 @@
</span>
<div class="fr cr">
<%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %>
<% if User.current.admin? || jour.user == User.current%>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %>
<% end %>
</div>
<div class="cl"></div>
<div nhname='div_form' class="mt10 ml80" style="display:none;">
<form action="<%= url_for(:controller => 'words', :action => 'create_reply') %>" data-remote="true" method="post">
<input id="reference_id" name="reference_id" type="hidden" value="<%= (jour.m_parent_id.nil? || jour.m_parent_id==0 ) ? jour.id : jour.m_parent_id %>">
<input id="reference_user_id" name="reference_user_id" type="hidden" value="<%= jour.user.id %>">
<input id="reference_message_id" name="reference_message_id" type="hidden" value="<%= jour.id %>">
<input id="show_name" name="show_name" type="hidden" value="true">
<textarea name='user_notes' style="display:none;"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a nhname="cancel_btn" href="javascript:;" class="grey_n_btn fr" style="margin-top:3px;">取消</a>
<a nhname="submit_btn" href="javascript:;" class="blue_n_btn fr mr5" style="margin-top:3px;">发布</a>
</form>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div nhname="reply_list">
<% fetch_user_leaveWord_reply(jour).each do |reply|%>
<div id = '<%= reply.id %>'>
<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
<div class="mes_box02">
<%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %>
<div class=" mes_box02_info fl">
<%= link_to "#{reply.user.login}&nbsp;:&nbsp;".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%>
<span class="fl c_grey">&nbsp;回复:&nbsp;</span>
<%= link_to "#{parent_jour.user.login}&nbsp;:&nbsp;".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%>
<div class="cl">
<%= reply.notes.html_safe %>
</div>
</div>
<span class="c_grey fr">
<%= time_tag(reply.created_on).html_safe%>
</span>
<div class="fr cr">
<%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %>
<% if User.current.admin? || reply.user == User.current%>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "c_purple ml5", :title => l(:button_delete)) %>
<%= render :partial => 'user_jour_reply', :locals => {:reply => reply} %>
<% end %>
</div>
<div class="cl"></div>
</div><!--mes_box02 end-->
</div>
<% end %>
</div><!--message_list end-->

View File

@ -1,11 +1,7 @@
<% if @save_succ %>
<% if !@jfm.nil? && @jfm.jour_type == 'Principal' %>
var html = $("<div>"+"<%= escape_javascript( render(:template => 'users/user_feedback4show',:locals => {:feed_list=>[@jfm]} )) %>"+"</div>");
$("div[nhname='container']",$("#nh_messages")).prepend(html.html());
// $('#new_message_cancel_btn').click();
$("a[nhname='reply_btn']",$("#nh_jours_<%= @jfm.m_reply_id %>")).click();
var params = init_list_more_div_params($("#nh_messages"));
change_status_4_list_more_div(params);
$("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>");
$("#<%= @jfm.m_reply_id%>").children("div[nhname='div_form']").hide();
<% else %>
var pre_append = $('<%= j(

View File

@ -83,10 +83,11 @@ $(function(){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div');
params.container = $(this).parent().parent('div');
params.div_form = $("div[nhname='div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form);
@ -111,7 +112,6 @@ $(function(){
params.textarea.hide();
}
},300);
});
$("div[nhname='new_message']").each(function(){