给留言增加删除功能;

_message.html.erb, _journal_reply_items.html.erb
调用words的destroy方法。
This commit is contained in:
nieguanghui 2013-12-26 16:06:59 +08:00
parent 4c9f9d9210
commit 809e7023ee
2 changed files with 21 additions and 12 deletions

View File

@ -12,10 +12,14 @@
<p> <p>
<span class="time"><%= format_time reply.created_on %></span> <span class="time"><%= format_time reply.created_on %></span>
<span style="display: none; margin-left: 4px;" id=<%= ids_r %>> <span style="display: none; margin-left: 4px;" id=<%= ids_r %>>
<%#= toggle_link l(:label_projects_feedback_respond), id, {:focus => 'project_respond'} %> <%= link_to l(:label_projects_feedback_respond),'',
<%= link_to l(:label_projects_feedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}:'); return false;"}
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{reply.user.show_name}: '); return false;"} %>
%>
<% if @user == User.current %>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) if (User.current.id == reply.user_id) || journal.jour_id == User.current.id %></td>
<% end %>
</span> </span>
</p> </p>
</div> </div>

View File

@ -8,20 +8,25 @@
<span class="body"> <span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span> <span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<% if @user == User.current %> <% if @user == User.current %>
<span class="font_lighter"><%= l(:label_leave_me_message) %></span> <span class="font_lighter"><%= l(:label_leave_me_message) %>&nbsp;:</span>
<% else %> <% else %>
<span class="font_lighter"><%= l(:label_leave_others_message) %></span> <span class="font_lighter"><%= l(:label_leave_others_message) %>&nbsp;:</span>
<% end %> <% end %>
<p> <p>
<%= textilizable journal.notes%> <%= textilizable journal.notes%>
</p> </p>
<span class="font_lighter"> <%= l :label_comment_time %>&nbsp; <%= format_time journal.created_on %></span> <span class="font_lighter"> <%= l :label_comment_time %>&nbsp; <%= format_time journal.created_on %></span>
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
<%#= toggle_link l(:label_projects_feedback_respond), ids, {:focus => 'project_respond'} %> <span>
<%= link_to l(:label_projects_feedback_respond),'',
<%= link_to l(:label_projects_feedback_respond),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}:'); return false;"}
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}:'); return false;"} %>
%>
<% if @user == User.current %>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.jour_id == User.current.id %></td>
<% end %>
</span>
</span> </span>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div id=<%= ids %> class="respond-form"> <div id=<%= ids %> class="respond-form">