Notification level can now be saved from within the project view.
This commit is contained in:
parent
ab56718feb
commit
adcae6ebd5
|
@ -24,3 +24,9 @@ class @Project
|
|||
$.cookie('hide_no_password_message', 'false', { path: path })
|
||||
$(@).parents('.no-password-message').remove()
|
||||
e.preventDefault()
|
||||
|
||||
$('.update-notification').on 'click', (e) ->
|
||||
e.preventDefault()
|
||||
level = $(this).data('notification-level')
|
||||
$('#notification_level').val(level)
|
||||
$('#notification-form').submit()
|
|
@ -338,3 +338,7 @@ pre.light-well {
|
|||
margin-top: -1px;
|
||||
}
|
||||
}
|
||||
|
||||
.inline-form {
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class ProjectsController < ApplicationController
|
|||
if @project.empty_repo?
|
||||
render 'projects/empty'
|
||||
else
|
||||
@membership_id = @project.project_members.where(user_id: current_user.id).first
|
||||
@membership_id = @project.project_members.where(user_id: current_user.id).first.id
|
||||
render :show
|
||||
end
|
||||
else
|
||||
|
|
|
@ -17,23 +17,27 @@ module NotificationsHelper
|
|||
case notification_level
|
||||
when Notification::N_DISABLED
|
||||
content_tag(:li) do
|
||||
icon('microphone-slash')
|
||||
'Disabled'
|
||||
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_DISABLED } do
|
||||
icon('microphone-slash', text: 'Disabled')
|
||||
end
|
||||
end
|
||||
when Notification::N_PARTICIPATING
|
||||
content_tag(:li) do
|
||||
icon('volume-up')
|
||||
'Participating'
|
||||
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_PARTICIPATING } do
|
||||
icon('volume-up', text: 'Participating')
|
||||
end
|
||||
end
|
||||
when Notification::N_WATCH
|
||||
content_tag(:li) do
|
||||
icon('globe')
|
||||
'Watch'
|
||||
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_WATCH } do
|
||||
icon('globe', text: 'Watch')
|
||||
end
|
||||
end
|
||||
when Notification::N_MENTION
|
||||
content_tag(:li) do
|
||||
icon('at')
|
||||
'Mention'
|
||||
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_MENTION } do
|
||||
icon('at', text: 'Mention')
|
||||
end
|
||||
end
|
||||
else
|
||||
# do nothing
|
||||
|
|
|
@ -12,7 +12,7 @@ class Notification
|
|||
|
||||
class << self
|
||||
def notification_levels
|
||||
[N_DISABLED, N_PARTICIPATING, N_WATCH, N_MENTION]
|
||||
[N_DISABLED, N_MENTION, N_PARTICIPATING, N_WATCH]
|
||||
end
|
||||
|
||||
def options_with_labels
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
- if current_user and !@membership_id.nil?
|
||||
%span.dropdown
|
||||
= form_tag profile_notifications_path, method: :put, remote: true do
|
||||
= hidden_field_tag :notification_type, 'project'
|
||||
= hidden_field_tag :notification_id, @membership_id
|
||||
= form_tag profile_notifications_path, method: :put, remote: true, class: 'inline-form', id: 'notification-form' do
|
||||
= hidden_field_tag :notification_type, 'project'
|
||||
= hidden_field_tag :notification_id, @membership_id
|
||||
= hidden_field_tag :notification_level
|
||||
%span.dropdown
|
||||
%a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"}
|
||||
= icon('bell')
|
||||
Notifications
|
||||
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
|
||||
- Notification.notification_levels.each do | level |
|
||||
= notification_list_item(level)
|
||||
|
||||
|
||||
|
||||
|
||||
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
|
||||
- Notification.notification_levels.each do |level|
|
||||
= notification_list_item(level)
|
Loading…
Reference in New Issue