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