Made wording more clear, refactored read_all
This commit is contained in:
parent
6456a441fe
commit
406397988b
3 changed files with 15 additions and 11 deletions
|
|
@ -65,22 +65,22 @@ class NotificationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_all
|
def read_all
|
||||||
if params[:type]
|
current_type = Notification.types[params[:type]]
|
||||||
Notification.where(:recipient_id => current_user.id, :type => Notification.types[params[:type]]).update_all(:unread => false)
|
notifications = Notification.where(:recipient_id => current_user.id)
|
||||||
else
|
notifications = notifications.where(:type => current_type) if params[:type]
|
||||||
Notification.where(:recipient_id => current_user.id).update_all(:unread => false)
|
notifications.update_all(:unread => false)
|
||||||
end
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if current_user.unread_notifications.count > 0
|
if current_user.unread_notifications.count > 0
|
||||||
format.html { redirect_to notifications_path}
|
format.html { redirect_to notifications_path }
|
||||||
format.mobile{ redirect_to notifications_path}
|
format.mobile { redirect_to notifications_path }
|
||||||
else
|
else
|
||||||
format.html { redirect_to stream_path }
|
format.html { redirect_to stream_path }
|
||||||
format.mobile{ redirect_to stream_path}
|
format.mobile { redirect_to stream_path }
|
||||||
end
|
end
|
||||||
format.xml { render :xml => {}.to_xml }
|
format.xml { render :xml => {}.to_xml }
|
||||||
format.json { render :json => {}.to_json }
|
format.json { render :json => {}.to_json }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@
|
||||||
%a.btn.btn-default{ :class => ('active' if params[:show] == 'unread'), :href => '/notifications?show=unread' + (params[:type] ? '&type=' + params[:type] : '') }
|
%a.btn.btn-default{ :class => ('active' if params[:show] == 'unread'), :href => '/notifications?show=unread' + (params[:type] ? '&type=' + params[:type] : '') }
|
||||||
= t('.show_unread')
|
= t('.show_unread')
|
||||||
%a.btn.btn-default{:href => read_all_notifications_path(:type => params[:type] ), :class => ('disabled' unless @unread_notification_count > 0)}
|
%a.btn.btn-default{:href => read_all_notifications_path(:type => params[:type] ), :class => ('disabled' unless @unread_notification_count > 0)}
|
||||||
= t('.mark_all_as_read')
|
-if params[:type]
|
||||||
|
= t('.mark_all_shown_as_read')
|
||||||
|
-else
|
||||||
|
= t('.mark_all_as_read')
|
||||||
- @group_days.each do |day, notes|
|
- @group_days.each do |day, notes|
|
||||||
.day_group.row-fluid
|
.day_group.row-fluid
|
||||||
.date.span2
|
.date.span2
|
||||||
|
|
|
||||||
|
|
@ -708,6 +708,7 @@ en:
|
||||||
index:
|
index:
|
||||||
notifications: "Notifications"
|
notifications: "Notifications"
|
||||||
mark_all_as_read: "Mark all as read"
|
mark_all_as_read: "Mark all as read"
|
||||||
|
mark_all_shown_as_read: "Mark all shown as read"
|
||||||
mark_read: "Mark read"
|
mark_read: "Mark read"
|
||||||
mark_unread: "Mark unread"
|
mark_unread: "Mark unread"
|
||||||
show_all: "show all"
|
show_all: "show all"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue