--- /dev/null
+$(document).ready(function () {
+ $(".inbox-mark-unread").on("ajax:success", function (event, data) {
+ $("#inboxanchor").remove();
+ $(".user-button").before(data.inboxanchor);
+
+ $("#inbox-count").replaceWith(data.inbox_count);
+
+ $(this).parents(".inbox-row").removeClass("inbox-row").addClass("inbox-row-unread");
+ });
+
+ $(".inbox-mark-read").on("ajax:success", function (event, data) {
+ $("#inboxanchor").remove();
+ $(".user-button").before(data.inboxanchor);
+
+ $("#inbox-count").replaceWith(data.inbox_count);
+
+ $(this).parents(".inbox-row-unread").removeClass("inbox-row-unread").addClass("inbox-row");
+ });
+
+ $(".inbox-destroy").on("ajax:success", function (event, data) {
+ $("#inboxanchor").remove();
+ $(".user-button").before(data.inboxanchor);
+
+ $("#inbox-count").replaceWith(data.inbox_count);
+
+ $(this).parents(".inbox-row, .inbox-row-unread").fadeOut(800, "linear", function () {
+ $(this).remove();
+ });
+ });
+});
<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>
+++ /dev/null
-$("#inboxanchor").replaceWith("<%=j render :partial => "layouts/inbox" %>");
-$("#inbox-count").replaceWith("<%=j render :partial => "message_count" %>");
-$("#inbox-<%= @message.id %>").fadeOut(800, "linear", function () {
- $(this).remove();
-});
--- /dev/null
+json.inboxanchor render(:partial => "layouts/inbox")
+json.inbox_count render(:partial => "message_count")
+<% 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 %>
+++ /dev/null
-$("#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 -%>
--- /dev/null
+json.inboxanchor render(:partial => "layouts/inbox")
+json.inbox_count render(:partial => "message_count")
+<% 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 %>
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
Rails.application.config.assets.precompile += %w[index.js browse.js welcome.js fixthemap.js]
-Rails.application.config.assets.precompile += %w[user.js login.js diary_entry.js edit/*.js]
+Rails.application.config.assets.precompile += %w[user.js login.js diary_entry.js messages.js edit/*.js]
Rails.application.config.assets.precompile += %w[screen-ltr.css print-ltr.css]
Rails.application.config.assets.precompile += %w[screen-rtl.css print-rtl.css]
Rails.application.config.assets.precompile += %w[leaflet-all.css leaflet.ie.css]