Commit 84508c40 authored by Darby's avatar Darby

PAtrially working notification button

parent a81ce718
......@@ -82,6 +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
render :show
end
else
......
......@@ -12,4 +12,35 @@ module NotificationsHelper
icon('circle-o', class: 'ns-default')
end
end
def notification_list_item(notification_level)
case notification_level
when Notification::N_DISABLED
content_tag(:li) do
icon('microphone-slash') do
'Disabled'
end
end
when Notification::N_PARTICIPATING
content_tag(:li) do
icon('volume-up') do
'Participating'
end
end
when Notification::N_WATCH
content_tag(:li) do
icon('globe') do
'Watch'
end
end
when Notification::N_MENTION
content_tag(:li) do
icon('at') do
'Mention'
end
end
else
# do nothing
end
end
end
......@@ -25,6 +25,8 @@
= icon('download fw')
Download
= render 'projects/buttons/notifications'
= render 'projects/buttons/dropdown'
= render "shared/clone_panel"
- 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
%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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment