function updateReadState(target, isRead) {
$(target).closest("tr")
.toggleClass("inbox-row", isRead)
- .toggleClass("inbox-row-unread", !isRead);
+ .toggleClass("inbox-row-unread", !isRead)
+ .find(".inbox-mark-unread button").prop("hidden", !isRead).end()
+ .find(".inbox-mark-read button").prop("hidden", isRead);
}
});
}
}
-.inbox-row .inbox-mark-read {
- display: none !important;
-}
-
-.inbox-row-unread .inbox-mark-unread {
- display: none !important;
-}
-
.search_form {
background-color: $lightgrey;
<td class="inbox-subject"><%= link_to message_summary.title, message_path(message_summary) %></td>
<td class="text-nowrap"><%= l message_summary.sent_on, :format => :friendly %></td>
<td class="text-nowrap text-end">
- <%= button_to t(".unread_button"), message_mark_path(message_summary, :mark => "unread"), :remote => true, :class => "btn btn-sm btn-primary", :form_class => "d-inline-block inbox-mark-unread" %>
- <%= button_to t(".read_button"), message_mark_path(message_summary, :mark => "read"), :remote => true, :class => "btn btn-sm btn-primary", :form_class => "d-inline-block inbox-mark-read" %>
+ <%= button_to t(".unread_button"), message_mark_path(message_summary, :mark => "unread"), :remote => true, :class => "btn btn-sm btn-primary", :form_class => "d-inline-block inbox-mark-unread", :hidden => !message_summary.message_read? %>
+ <%= button_to t(".read_button"), message_mark_path(message_summary, :mark => "read"), :remote => true, :class => "btn btn-sm btn-primary", :form_class => "d-inline-block inbox-mark-read", :hidden => message_summary.message_read? %>
<%= button_to t(".destroy_button"), message_path(message_summary, :referer => request.fullpath), :method => :delete, :remote => true, :class => "btn btn-sm btn-danger", :form_class => "d-inline-block inbox-destroy" %>
</td>
</tr>