Skip to content
Open
5 changes: 5 additions & 0 deletions app/controllers/app_notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def view
end
end

def view_by_issue_id
AppNotification.where(:recipient_id => User.current.id, :viewed => false,:issue_id => params[:issue_id] ).update_all( :viewed => true )
redirect_to :action => 'index'
end

def view_all
AppNotification.where(:recipient_id => User.current.id, :viewed => false).update_all( :viewed => true )
redirect_to :action => 'index'
Expand Down
8 changes: 8 additions & 0 deletions app/views/app_notifications/_mark_notify_by_issue.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<%
mnum=AppNotification.where(:recipient_id => User.current.id, :viewed => false,:issue_id => issue.id ).count.to_i
if mnum>0
%>
<%= button_to l(:mark_this_issue_all_notify_as_seen)+":"+mnum.to_s,:controller=>"app_notifications", action: "view_by_issue_id", :issue_id => issue.id %>
<%
end
%>
1 change: 1 addition & 0 deletions app/views/app_notifications/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<% @app_notifications.each do |notification| %>
<div class="notification <%= "new" if !notification.viewed %>">
<strong> <%= notification.issue.subject %> </strong>
<% if notification.is_edited? %>
<%= render :partial => 'issues/issue_edit', :formats => [:html], :locals => { :notification => notification, :journal => notification.journal, :journal_details => details_to_strings(notification.journal.visible_details(notification.author), false, :only_path => false) }%>
<% else %>
Expand Down
1 change: 1 addition & 0 deletions app/views/issues/_issue_ajax_add.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="notification-container <%= 'new' if !notification.viewed %>">
<div class="notification-title">
<%= avatar(notification.issue.author, :size => "24") %>
<strong> <%= notification.issue.subject %> </strong><br/>
<%= l(:text_issue_added, :id => "##{notification.issue.id}", :author => h(notification.issue.author)) %>
</div>
<div class="notification-date"><%= format_time(notification.created_on) %></div>
Expand Down
1 change: 1 addition & 0 deletions app/views/issues/_issue_ajax_edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="notification-container <%= 'new' if !notification.viewed %>">
<div class="notification-title">
<%= avatar(notification.journal.user, :size => "24") %>
<strong> <%= notification.issue.subject %> </strong><br/>
<%= l(:text_issue_updated, :id => "##{notification.issue.id}", :author => h(notification.journal.user)) %>
</div>
<div class="notification-content">
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ en:
filter_button: "Filter"
view_app_notifications: "View notifications"
unreachable_faye_server: "Your Faye server is unreachable"
mark_this_issue_all_notify_as_seen: "Mark all notify of this issue as seen"
22 changes: 22 additions & 0 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# English strings go here for Rails i18n
zh:
field_app_notification: "redmine内部通知"
field_app_notification_desktop: "如果浏览器支持则使用桌面通知"
notifications: "通知"
see_all: "查看所有"
notifications_events_settings: "通知事件设置"
issue_added: "问题添加"
issue_updated: "问题更新"
issue_note_added: "问题note添加"
issue_status_updated: "问题状态更新"
issue_assigned_to_updated: "问题指派者更新"
issue_priority_updated: "问题优先级更新"
faye_server_adress: "faye的server地址,如果为空则关闭"
mark_as_seen: "标记为已读"
mark_all_as_seen: "标记所有为已读"
viewed_notification: "已读通知"
new_notification: "新通知"
filter_button: "过滤器"
view_app_notifications: "查看通知"
unreachable_faye_server: "你的 Faye服务器不可用"
mark_this_issue_all_notify_as_seen: "标记此问题的所有通知为已读"
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
get 'app-notifications', :to => 'app_notifications#index'
get 'app-notifications/:id', :to => 'app_notifications#view'
post 'app-notifications/view-all', :to => 'app_notifications#view_all'
post 'app-notifications/view_by_issue_id', :to => 'app_notifications#view_by_issue_id'
3 changes: 2 additions & 1 deletion lib/app_notifications_hook_listener.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class AppNotificationsHookListener < Redmine::Hook::ViewListener
render_on :view_my_account_preferences, :partial => "app_notifications/my_account_preferences"
render_on :view_layouts_base_html_head, :partial => "app_notifications/layouts_base_html_head"
end
render_on(:view_issues_show_details_bottom, :partial => "app_notifications/mark_notify_by_issue" )
end