notifications index/show

This commit is contained in:
Devin Howard 2016-11-16 23:04:30 -05:00
parent aefab7bc0d
commit 7dd37c50d3
4 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,19 @@
class NotificationsController < ApplicationController
def index
@notifications = current_user.mailbox.notifications
respond_to do |format|
format.html
format.json { render json: @notifications.to_json }
end
end
def show
@notification = current_user.mailbox.notifications.find_by(id: params[:id])
respond_to do |format|
format.html
format.json { render json: @notification.to_json }
end
end
end

View file

@ -110,4 +110,8 @@ class User < ApplicationRecord
def settings=(val)
self[:settings] = val
end
def mailboxer_email(object)
nil # email
end
end

View file

@ -0,0 +1,18 @@
<% content_for :title, 'Notifications | Metamaps' %>
<% content_for :mobile_title, 'Notifications' %>
<div id="yield">
<div class="centerContent">
<h4>Notifications</h4>
<ul>
<% @notifications.each do |notification| %>
<li>
<strong>
<%= link_to notification.subject, notification_path(notification.id) %>
</strong>
<%= notification.body.truncate(140) %>
</li>
<% end %>
</ul>
</div>
</div>

View file

@ -0,0 +1,12 @@
<% content_for :title, 'Notifications | Metamaps' %>
<% content_for :mobile_title, 'Notifications' %>
<div id="yield">
<div class="centerContent">
<h4><%= @notification.subject %></h4>
<hr />
<%= @notification.body %>
<hr />
<%= link_to 'Back', notifications_path %>
</div>
</div>