made notification tabs work

This commit is contained in:
nilsding 2014-12-14 15:24:59 +01:00
parent c9d57e235f
commit b0a2072f96
3 changed files with 11 additions and 6 deletions

View File

@ -3,5 +3,10 @@ class NotificationsController < ApplicationController
def index def index
@type = params[:type] @type = params[:type]
@notifications = if @type == 'all'
Notification.for(current_user)
else
Notification.for(current_user).where('LOWER(target_type) = ?', @type)
end
end end
end end

View File

@ -2,8 +2,8 @@
.panel.panel-default .panel.panel-default
.panel-body .panel-body
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked
= nav_entry "All notifications", "" = nav_entry "All notifications", notifications_path
= nav_entry "Answers", "" = nav_entry "Answers", notifications_path('answer')
= nav_entry "Smiles", "" = nav_entry "Smiles", notifications_path('smile')
= nav_entry "Comments", "" = nav_entry "Comments", notifications_path('comment')
= nav_entry "Followers", "" = nav_entry "Followers", notifications_path('relationship')

View File

@ -2,7 +2,7 @@
= render 'notification_tabs' = render 'notification_tabs'
.col-md-9.col-xs-12.col-sm-9 .col-md-9.col-xs-12.col-sm-9
%ul.list-group %ul.list-group
- Notification.for(current_user).each do |notification| - @notifications.each do |notification|
%li.list-group-item %li.list-group-item
.media .media
- case notification.target_type - case notification.target_type