Avoid using inline javascript to update message list
This commit is contained in:
parent
ed1f441ef3
commit
4a6779abf7
9 changed files with 44 additions and 14 deletions
|
@ -2,5 +2,5 @@
|
|||
<td class="inbox-sender"><%= link_to h(sent_message_summary.recipient.display_name), user_path(sent_message_summary.recipient) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(sent_message_summary.title), message_path(sent_message_summary) %></td>
|
||||
<td class="inbox-sent"><%= l sent_message_summary.sent_on, :format => :friendly %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), destroy_message_path(sent_message_summary, :referer => request.fullpath) %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), destroy_message_path(sent_message_summary, :referer => request.fullpath), { :remote => true } %></td>
|
||||
</tr>
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
$("#inboxanchor").replaceWith("<%=j render :partial => "layouts/inbox" %>");
|
||||
$("#inbox-count").replaceWith("<%=j render :partial => "message_count" %>");
|
||||
$("#inbox-<%= @message.id %>").fadeOut(800, "linear", function () {
|
||||
$(this).remove();
|
||||
});
|
2
app/views/messages/destroy.json.jsonify
Normal file
2
app/views/messages/destroy.json.jsonify
Normal file
|
@ -0,0 +1,2 @@
|
|||
json.inboxanchor render(:partial => "layouts/inbox")
|
||||
json.inbox_count render(:partial => "message_count")
|
|
@ -1,3 +1,7 @@
|
|||
<% content_for :head do %>
|
||||
<%= javascript_include_tag "messages" %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :heading do %>
|
||||
<h2><%= t '.my_inbox'%>/<%= link_to t('.outbox'), outbox_path(current_user.display_name) %></h2>
|
||||
<% end %>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
$("#inboxanchor").replaceWith("<%=j render :partial => "layouts/inbox" %>");
|
||||
$("#inbox-count").replaceWith("<%=j render :partial => "message_count" %>");
|
||||
<% if @message.message_read? -%>
|
||||
$("#inbox-<%= @message.id %>").removeClass("inbox-row-unread").addClass("inbox-row");
|
||||
<% else -%>
|
||||
$("#inbox-<%= @message.id %>").removeClass("inbox-row").addClass("inbox-row-unread");
|
||||
<% end -%>
|
2
app/views/messages/mark.json.jsonify
Normal file
2
app/views/messages/mark.json.jsonify
Normal file
|
@ -0,0 +1,2 @@
|
|||
json.inboxanchor render(:partial => "layouts/inbox")
|
||||
json.inbox_count render(:partial => "message_count")
|
|
@ -1,3 +1,7 @@
|
|||
<% content_for :head do %>
|
||||
<%= javascript_include_tag "messages" %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :heading do %>
|
||||
<h2><%= raw(t '.my_inbox', :inbox_link => link_to(t('.inbox'), inbox_path(current_user.display_name))) %>/<%= t'.outbox' %></h2>
|
||||
<% end %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue