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 })
|
$.cookie('hide_no_password_message', 'false', { path: path })
|
||||||
$(@).parents('.no-password-message').remove()
|
$(@).parents('.no-password-message').remove()
|
||||||
e.preventDefault()
|
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;
|
margin-top: -1px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inline-form {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class ProjectsController < ApplicationController
|
||||||
if @project.empty_repo?
|
if @project.empty_repo?
|
||||||
render 'projects/empty'
|
render 'projects/empty'
|
||||||
else
|
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
|
render :show
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,27 @@ module NotificationsHelper
|
||||||
case notification_level
|
case notification_level
|
||||||
when Notification::N_DISABLED
|
when Notification::N_DISABLED
|
||||||
content_tag(:li) do
|
content_tag(:li) do
|
||||||
icon('microphone-slash')
|
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_DISABLED } do
|
||||||
'Disabled'
|
icon('microphone-slash', text: 'Disabled')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
when Notification::N_PARTICIPATING
|
when Notification::N_PARTICIPATING
|
||||||
content_tag(:li) do
|
content_tag(:li) do
|
||||||
icon('volume-up')
|
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_PARTICIPATING } do
|
||||||
'Participating'
|
icon('volume-up', text: 'Participating')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
when Notification::N_WATCH
|
when Notification::N_WATCH
|
||||||
content_tag(:li) do
|
content_tag(:li) do
|
||||||
icon('globe')
|
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_WATCH } do
|
||||||
'Watch'
|
icon('globe', text: 'Watch')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
when Notification::N_MENTION
|
when Notification::N_MENTION
|
||||||
content_tag(:li) do
|
content_tag(:li) do
|
||||||
icon('at')
|
link_to '#', class: 'update-notification', data: { notification_level: Notification::N_MENTION } do
|
||||||
'Mention'
|
icon('at', text: 'Mention')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class Notification
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def notification_levels
|
def notification_levels
|
||||||
[N_DISABLED, N_PARTICIPATING, N_WATCH, N_MENTION]
|
[N_DISABLED, N_MENTION, N_PARTICIPATING, N_WATCH]
|
||||||
end
|
end
|
||||||
|
|
||||||
def options_with_labels
|
def options_with_labels
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
- if current_user and !@membership_id.nil?
|
- if current_user and !@membership_id.nil?
|
||||||
%span.dropdown
|
= form_tag profile_notifications_path, method: :put, remote: true, class: 'inline-form', id: 'notification-form' do
|
||||||
= form_tag profile_notifications_path, method: :put, remote: true do
|
|
||||||
= hidden_field_tag :notification_type, 'project'
|
= hidden_field_tag :notification_type, 'project'
|
||||||
= hidden_field_tag :notification_id, @membership_id
|
= hidden_field_tag :notification_id, @membership_id
|
||||||
|
= hidden_field_tag :notification_level
|
||||||
|
%span.dropdown
|
||||||
%a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"}
|
%a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"}
|
||||||
= icon('bell')
|
= icon('bell')
|
||||||
Notifications
|
Notifications
|
||||||
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
|
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
|
||||||
- Notification.notification_levels.each do | level |
|
- Notification.notification_levels.each do |level|
|
||||||
= notification_list_item(level)
|
= notification_list_item(level)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue