From 7628a53cdc523a52f4cdef2c590d45c326f2cc86 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 30 Jul 2015 10:45:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=99=E8=A8=80=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_jour_reply.html.erb | 38 ++++++++++ app/views/users/_user_jours_new.html.erb | 84 ++++++++++------------- app/views/words/create_reply.js.erb | 8 +-- public/javascripts/user.js | 4 +- 4 files changed, 79 insertions(+), 55 deletions(-) create mode 100644 app/views/users/_user_jour_reply.html.erb diff --git a/app/views/users/_user_jour_reply.html.erb b/app/views/users/_user_jour_reply.html.erb new file mode 100644 index 000000000..c3b3d86c1 --- /dev/null +++ b/app/views/users/_user_jour_reply.html.erb @@ -0,0 +1,38 @@ + <% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> +
+ <%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %> +
+ <%= link_to "#{reply.user.login} : ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%> +  回复:  + <%= link_to "#{parent_jour.user.login} : ".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%> +
+ <%= reply.notes.html_safe %> +
+
+ + <%= time_tag(reply.created_on).html_safe%> + +
+ <%= 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 %> +
+
+ +
+
\ No newline at end of file diff --git a/app/views/users/_user_jours_new.html.erb b/app/views/users/_user_jours_new.html.erb index 7aa9d97ff..9a9e14787 100644 --- a/app/views/users/_user_jours_new.html.erb +++ b/app/views/users/_user_jours_new.html.erb @@ -1,54 +1,44 @@ -
-
- <%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %> -
-
- <%= link_to "#{jour.user.login} : ".html_safe, user_path(jour.user),:class => 'fl c_blue02 f14 fb mb5', :target => "_blank"%> -
-
-
- <%= jour.notes.html_safe %> -
-
+
+ <%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %> +
+
+ <%= link_to "#{jour.user.login} : ".html_safe, user_path(jour.user),:class => 'fl c_blue02 f14 fb mb5', :target => "_blank"%> +
+
+
+ <%= jour.notes.html_safe %> +
+
<%= time_tag(jour.created_on).html_safe %> -
- <%= 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 %> -
+
+ <%= 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 %> +
+
+
- <% fetch_user_leaveWord_reply(jour).each do |reply|%> -
- <% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> -
- <%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %> -
- <%= link_to "#{reply.user.login} : ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%> -  回复:  - <%= link_to "#{parent_jour.user.login} : ".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%> -
- <%= reply.notes.html_safe %> -
-
- - <%= time_tag(reply.created_on).html_safe%> - -
- <%= 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 %> -
-
-
-
- <% end %> +
+ <% fetch_user_leaveWord_reply(jour).each do |reply|%> + <%= render :partial => 'user_jour_reply', :locals => {:reply => reply} %> + <% end %> +
\ No newline at end of file diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index 8e57d7b0e..a7f0b42c7 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,11 +1,7 @@ <% if @save_succ %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> - var html = $("
"+"<%= escape_javascript( render(:template => 'users/user_feedback4show',:locals => {:feed_list=>[@jfm]} )) %>"+"
"); - $("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( diff --git a/public/javascripts/user.js b/public/javascripts/user.js index 9ad3d1588..e760361b9 100644 --- a/public/javascripts/user.js +++ b/public/javascripts/user.js @@ -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(){