2013-06-24 15:24:14 +00:00
|
|
|
class Profiles::NotificationsController < ApplicationController
|
2013-03-27 17:04:29 +00:00
|
|
|
layout 'profile'
|
|
|
|
|
|
|
|
def show
|
|
|
|
@notification = current_user.notification
|
2014-09-14 16:51:54 +00:00
|
|
|
@project_members = current_user.project_members
|
|
|
|
@group_members = current_user.group_members
|
2013-03-27 17:04:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2013-04-04 19:11:51 +00:00
|
|
|
type = params[:notification_type]
|
|
|
|
|
|
|
|
@saved = if type == 'global'
|
|
|
|
current_user.notification_level = params[:notification_level]
|
|
|
|
current_user.save
|
2013-06-21 20:17:58 +00:00
|
|
|
elsif type == 'group'
|
2014-09-14 16:32:51 +00:00
|
|
|
users_group = current_user.group_members.find(params[:notification_id])
|
2013-06-21 20:17:58 +00:00
|
|
|
users_group.notification_level = params[:notification_level]
|
|
|
|
users_group.save
|
2013-04-04 19:11:51 +00:00
|
|
|
else
|
2014-09-14 16:32:51 +00:00
|
|
|
users_project = current_user.project_members.find(params[:notification_id])
|
2013-04-04 19:11:51 +00:00
|
|
|
users_project.notification_level = params[:notification_level]
|
|
|
|
users_project.save
|
|
|
|
end
|
2013-03-27 17:04:29 +00:00
|
|
|
end
|
|
|
|
end
|