%h3.page_title Setup your notification level

%br

%p.light
  %strong Disabled
  &ndash; You will not get any notifications via email
%p.light
  %strong Participating
  &ndash; You will receive only notifications from related resources(ex. from assigned issue or your commit)
%p.light
  %strong Watch
  &ndash; You will receive all notifications from projects in which you participate
%hr

.row
  .span4
    %h5 Global setting
  .span7
    = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do
      = hidden_field_tag :notification_type, 'global'

      = label_tag do
        = radio_button_tag :notification_level, Notification::N_DISABLED, @notification.disabled?, class: 'trigger-submit'
        %span Disabled

      = label_tag do
        = radio_button_tag :notification_level, Notification::N_PARTICIPATING, @notification.participating?, class: 'trigger-submit'
        %span Participating

      = label_tag do
        = radio_button_tag :notification_level, Notification::N_WATCH, @notification.watch?, class: 'trigger-submit'
        %span Watch

%hr
= link_to '#', class: 'js-toggle-visibility-link' do
  %h6.btn.btn-tiny
    %i.icon-chevron-down
    %span Per project notifications setting

%ul.well-list.js-toggle-visibility-container.hide
  - @users_projects.each do |users_project|
    - notification = Notification.new(users_project)
    %li
      .row
        .span4
          %span
            = link_to_project(users_project.project)
        .span7
          = form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do
            = hidden_field_tag :notification_type, 'project', id: dom_id(users_project, 'notification_type')
            = hidden_field_tag :notification_id, users_project.id, id: dom_id(users_project, 'notification_id')

            = label_tag do
              = radio_button_tag :notification_level, Notification::N_GLOBAL, notification.global?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit'
              %span Use global setting

            = label_tag do
              = radio_button_tag :notification_level, Notification::N_DISABLED, notification.disabled?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit'
              %span Disabled

            = label_tag do
              = radio_button_tag :notification_level, Notification::N_PARTICIPATING, notification.participating?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit'
              %span Participating

            = label_tag do
              = radio_button_tag :notification_level, Notification::N_WATCH, notification.watch?, id: dom_id(users_project, 'notification_level'), class: 'trigger-submit'
              %span Watch


.save-status-fixed
  %span.update-success.cgreen.hide
    %i.icon-ok
    Saved
  %span.update-failed.cred.hide
    %i.icon-remove
    Failed
