_new_button.html.haml 2.49 KB
Newer Older
1 2
- btn_class = local_assigns.fetch(:btn_class, '')
- emails_disabled = local_assigns.fetch(:emails_disabled, false)
3 4

- if notification_setting
5 6 7 8 9 10
  - if emails_disabled
    - button_title = notification_description(:owner_disabled)
    - btn_class << " disabled"
  - else
    - button_title = _("Notification setting - %{notification_title}") % { notification_title: notification_title(notification_setting.level) }

11
  .js-notification-dropdown.notification-dropdown.home-panel-action-button.prepend-top-default.append-right-8.dropdown.inline
12 13 14 15 16 17 18
    = form_for notification_setting, remote: true, html: { class: "inline notification-form no-label" } do |f|
      = hidden_setting_source_input(notification_setting)
      = hidden_field_tag "hide_label", true
      = f.hidden_field :level, class: "notification_setting_level"
      .js-notification-toggle-btns
        %div{ class: ("btn-group" if notification_setting.custom?) }
          - if notification_setting.custom?
19
            %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: button_title, class: "#{btn_class}", "aria-label" => button_title, data: { container: "body", placement: 'top', toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), display: 'static' } }
20
              = notification_setting_icon(notification_setting)
21
              %span.js-notification-loading.fa.hidden
22 23
            %button.btn.dropdown-toggle{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" }, class: "#{btn_class}" }
              = sprite_icon("arrow-down", css_class: "icon mr-0")
24 25
              .sr-only Toggle dropdown
          - else
26
            %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: button_title, class: "#{btn_class}", "aria-label" => button_title, data: { container: "body", placement: 'top', toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } }
27
              = notification_setting_icon(notification_setting)
28 29 30 31 32 33
              %span.js-notification-loading.fa.hidden
              = sprite_icon("arrow-down", css_class: "icon")

          = render "shared/notifications/notification_dropdown", notification_setting: notification_setting

          = content_for :scripts_body do
34
            = render "shared/notifications/custom_notifications", notification_setting: notification_setting, hide_label: true