notifications index/show
This commit is contained in:
parent
aefab7bc0d
commit
7dd37c50d3
4 changed files with 53 additions and 0 deletions
19
app/controllers/notifications_controller.rb
Normal file
19
app/controllers/notifications_controller.rb
Normal 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
|
|
@ -110,4 +110,8 @@ class User < ApplicationRecord
|
|||
def settings=(val)
|
||||
self[:settings] = val
|
||||
end
|
||||
|
||||
def mailboxer_email(object)
|
||||
nil # email
|
||||
end
|
||||
end
|
||||
|
|
18
app/views/notifications/index.html.erb
Normal file
18
app/views/notifications/index.html.erb
Normal 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>
|
12
app/views/notifications/show.html.erb
Normal file
12
app/views/notifications/show.html.erb
Normal 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>
|
Loading…
Reference in a new issue