diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-01 09:11:01 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-01 09:11:01 +0000 |
| commit | c7cb37255796023730d0e31324a533e55e25bc46 (patch) | |
| tree | 5140bef8ec205dd79b71066aa3ed3a3e4cb00be0 /app | |
| parent | 21543f57d625a70c3884d1915fa14ad340d01edc (diff) | |
| download | gitlab-ce-c7cb37255796023730d0e31324a533e55e25bc46.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
25 files changed, 31 insertions, 331 deletions
diff --git a/app/assets/javascripts/notifications/components/custom_notifications_modal.vue b/app/assets/javascripts/notifications/components/custom_notifications_modal.vue index 0f628897e17..39f5799f31c 100644 --- a/app/assets/javascripts/notifications/components/custom_notifications_modal.vue +++ b/app/assets/javascripts/notifications/components/custom_notifications_modal.vue @@ -115,7 +115,11 @@ export default { <gl-loading-icon v-if="isLoading" size="lg" class="gl-mt-3" /> <template v-else> <gl-form-group v-for="event in events" :key="event.id"> - <gl-form-checkbox v-model="event.enabled" @change="updateEvent($event, event)"> + <gl-form-checkbox + v-model="event.enabled" + :data-testid="`notification-setting-${event.id}`" + @change="updateEvent($event, event)" + > <strong>{{ event.name }}</strong ><gl-loading-icon v-if="event.loading" :inline="true" class="gl-ml-2" /> </gl-form-checkbox> diff --git a/app/assets/javascripts/notifications/components/notifications_dropdown.vue b/app/assets/javascripts/notifications/components/notifications_dropdown.vue index e4cedfdb810..365831fcdbf 100644 --- a/app/assets/javascripts/notifications/components/notifications_dropdown.vue +++ b/app/assets/javascripts/notifications/components/notifications_dropdown.vue @@ -128,7 +128,8 @@ export default { <gl-button-group v-if="isCustomNotification" v-gl-tooltip="{ title: buttonTooltip }" - data-testid="notificationButton" + data-testid="notification-button" + :class="{ disabled: disabled }" :size="buttonSize" > <gl-button @@ -165,12 +166,13 @@ export default { <gl-dropdown v-else v-gl-tooltip="{ title: buttonTooltip }" - data-testid="notificationButton" + data-testid="notification-button" :text="buttonText" :icon="buttonIcon" :loading="isLoading" :size="buttonSize" :disabled="disabled" + :class="{ disabled: disabled }" > <notifications-dropdown-item v-for="item in notificationLevels" diff --git a/app/assets/javascripts/notifications/components/notifications_dropdown_item.vue b/app/assets/javascripts/notifications/components/notifications_dropdown_item.vue index 73bb9c1b36f..2138372d8ad 100644 --- a/app/assets/javascripts/notifications/components/notifications_dropdown_item.vue +++ b/app/assets/javascripts/notifications/components/notifications_dropdown_item.vue @@ -33,7 +33,13 @@ export default { </script> <template> - <gl-dropdown-item is-check-item :is-checked="isActive" @click="$emit('item-selected', level)"> + <gl-dropdown-item + is-check-item + :is-checked="isActive" + :class="{ 'is-active': isActive }" + data-testid="notification-item" + @click="$emit('item-selected', level)" + > <div class="gl-display-flex gl-flex-direction-column"> <span class="gl-font-weight-bold">{{ title }}</span> <span class="gl-text-gray-500">{{ description }}</span> diff --git a/app/assets/javascripts/notifications/constants.js b/app/assets/javascripts/notifications/constants.js index c12f6a75f96..4f875977d78 100644 --- a/app/assets/javascripts/notifications/constants.js +++ b/app/assets/javascripts/notifications/constants.js @@ -53,6 +53,7 @@ export const i18n = { reassign_merge_request: s__('NotificationEvent|Reassign merge request'), reopen_issue: s__('NotificationEvent|Reopen issue'), reopen_merge_request: s__('NotificationEvent|Reopen merge request'), + merge_when_pipeline_succeeds: s__('NotificationEvent|Merge when pipeline succeeds'), success_pipeline: s__('NotificationEvent|Successful pipeline'), }, }; diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js deleted file mode 100644 index d61defed14d..00000000000 --- a/app/assets/javascripts/notifications_dropdown.js +++ /dev/null @@ -1,35 +0,0 @@ -import $ from 'jquery'; -import { Rails } from '~/lib/utils/rails_ujs'; -import { __ } from '~/locale'; -import { deprecatedCreateFlash as Flash } from './flash'; - -export default function notificationsDropdown() { - $(document).on('click', '.update-notification', function updateNotificationCallback(e) { - e.preventDefault(); - - if ($(this).is('.is-active') && $(this).data('notificationLevel') === 'custom') { - return; - } - - const notificationLevel = $(this).data('notificationLevel'); - const form = $(this).parents('.notification-form').first(); - - form.find('.js-notification-loading').toggleClass('spinner'); - if (form.hasClass('no-label')) { - form.find('.js-notification-loading').toggleClass('hidden'); - form.find('.js-notifications-icon').toggleClass('hidden'); - } - form.find('#notification_setting_level').val(notificationLevel); - Rails.fire(form[0], 'submit'); - }); - - $(document).on('ajax:success', '.notification-form', (e) => { - const data = e.detail[0]; - - if (data.saved) { - $(e.currentTarget).closest('.js-notification-dropdown').replaceWith(data.html); - } else { - Flash(__('Failed to save new settings'), 'alert'); - } - }); -} diff --git a/app/assets/javascripts/notifications_form.js b/app/assets/javascripts/notifications_form.js deleted file mode 100644 index 8b90da71bef..00000000000 --- a/app/assets/javascripts/notifications_form.js +++ /dev/null @@ -1,48 +0,0 @@ -import $ from 'jquery'; -import { deprecatedCreateFlash as flash } from './flash'; -import axios from './lib/utils/axios_utils'; -import { __ } from './locale'; - -export default class NotificationsForm { - constructor() { - this.toggleCheckbox = this.toggleCheckbox.bind(this); - this.initEventListeners(); - } - - initEventListeners() { - $(document).on('change', '.js-custom-notification-event', this.toggleCheckbox); - } - - toggleCheckbox(e) { - const $checkbox = $(e.currentTarget); - const $parent = $checkbox.closest('.form-check'); - - this.saveEvent($checkbox, $parent); - } - - // eslint-disable-next-line class-methods-use-this - showCheckboxLoadingSpinner($parent) { - $parent.find('.is-loading').removeClass('gl-display-none'); - $parent.find('.is-done').addClass('gl-display-none'); - } - - saveEvent($checkbox, $parent) { - const form = $parent.parents('form').first(); - - this.showCheckboxLoadingSpinner($parent); - - axios[form.attr('method')](form.attr('action'), form.serialize()) - .then(({ data }) => { - $checkbox.enable(); - if (data.saved) { - $parent.find('.is-loading').addClass('gl-display-none'); - $parent.find('.is-done').removeClass('gl-display-none'); - - setTimeout(() => { - $parent.find('.is-done').addClass('gl-display-none'); - }, 2000); - } - }) - .catch(() => flash(__('There was an error saving your notification settings.'))); - } -} diff --git a/app/assets/javascripts/pages/groups/shared/group_details.js b/app/assets/javascripts/pages/groups/shared/group_details.js index 8c272e561db..b076ce68250 100644 --- a/app/assets/javascripts/pages/groups/shared/group_details.js +++ b/app/assets/javascripts/pages/groups/shared/group_details.js @@ -7,8 +7,6 @@ import initInviteMembersModal from '~/invite_members/init_invite_members_modal'; import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger'; import { getPagePath, getDashPath } from '~/lib/utils/common_utils'; import initNotificationsDropdown from '~/notifications'; -import notificationsDropdown from '~/notifications_dropdown'; -import NotificationsForm from '~/notifications_form'; import ProjectsList from '~/projects_list'; import GroupTabs from './group_tabs'; @@ -22,13 +20,8 @@ export default function initGroupDetails(actionName = 'show') { new GroupTabs({ parentEl: '.groups-listing', action }); new ShortcutsNavigation(); - new NotificationsForm(); - if (gon.features?.vueNotificationDropdown) { - initNotificationsDropdown(); - } else { - notificationsDropdown(); - } + initNotificationsDropdown(); new ProjectsList(); diff --git a/app/assets/javascripts/pages/profiles/index/index.js b/app/assets/javascripts/pages/profiles/index/index.js deleted file mode 100644 index 586b3be8661..00000000000 --- a/app/assets/javascripts/pages/profiles/index/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import notificationsDropdown from '../../../notifications_dropdown'; -import NotificationsForm from '../../../notifications_form'; - -document.addEventListener('DOMContentLoaded', () => { - new NotificationsForm(); // eslint-disable-line no-new - notificationsDropdown(); -}); diff --git a/app/assets/javascripts/pages/profiles/notifications/show/index.js b/app/assets/javascripts/pages/profiles/notifications/show/index.js index 639f5deb72c..51ba6c7a01e 100644 --- a/app/assets/javascripts/pages/profiles/notifications/show/index.js +++ b/app/assets/javascripts/pages/profiles/notifications/show/index.js @@ -1,9 +1,5 @@ import initNotificationsDropdown from '~/notifications'; -import notificationsDropdown from '../../../../notifications_dropdown'; -import NotificationsForm from '../../../../notifications_form'; document.addEventListener('DOMContentLoaded', () => { - new NotificationsForm(); // eslint-disable-line no-new - notificationsDropdown(); initNotificationsDropdown(); }); diff --git a/app/assets/javascripts/pages/projects/show/index.js b/app/assets/javascripts/pages/projects/show/index.js index e5ec9976ac5..7bb7be45f59 100644 --- a/app/assets/javascripts/pages/projects/show/index.js +++ b/app/assets/javascripts/pages/projects/show/index.js @@ -7,16 +7,13 @@ import initInviteMembersModal from '~/invite_members/init_invite_members_modal'; import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger'; import leaveByUrl from '~/namespaces/leave_by_url'; import initVueNotificationsDropdown from '~/notifications'; -import NotificationsForm from '~/notifications_form'; import initReadMore from '~/read_more'; import UserCallout from '~/user_callout'; -import notificationsDropdown from '../../../notifications_dropdown'; import Star from '../../../star'; initReadMore(); new Star(); // eslint-disable-line no-new -new NotificationsForm(); // eslint-disable-line no-new // eslint-disable-next-line no-new new UserCallout({ setCalloutPerProject: false, @@ -43,12 +40,6 @@ if (document.querySelector('.project-show-activity')) { leaveByUrl('project'); -if (gon.features?.vueNotificationDropdown) { - initVueNotificationsDropdown(); -} else { - notificationsDropdown(); -} - initVueNotificationsDropdown(); new ShortcutsNavigation(); // eslint-disable-line no-new diff --git a/app/assets/stylesheets/framework/lists.scss b/app/assets/stylesheets/framework/lists.scss index b81e9828dec..df2ba718c72 100644 --- a/app/assets/stylesheets/framework/lists.scss +++ b/app/assets/stylesheets/framework/lists.scss @@ -192,11 +192,6 @@ ul.content-list { display: flex; align-items: center; white-space: nowrap; - - // Override style that allows the flex-row text to wrap. - &.allow-wrap { - white-space: normal; - } } .row-main-content { diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 9d7aebe4505..5de207857bb 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -30,7 +30,6 @@ class GroupsController < Groups::ApplicationController before_action do push_frontend_feature_flag(:vue_issuables_list, @group) - push_frontend_feature_flag(:vue_notification_dropdown, @group, default_enabled: :yaml) end before_action do diff --git a/app/controllers/notification_settings_controller.rb b/app/controllers/notification_settings_controller.rb deleted file mode 100644 index 7d8c035c852..00000000000 --- a/app/controllers/notification_settings_controller.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -class NotificationSettingsController < ApplicationController - before_action :authenticate_user! - - feature_category :users - - def create - return render_404 unless can_read?(resource) - - @notification_setting = current_user.notification_settings_for(resource) - @saved = @notification_setting.update(notification_setting_params_for(resource)) - - render_response - end - - def update - @notification_setting = current_user.notification_settings.find(params[:id]) - @saved = @notification_setting.update(notification_setting_params_for(@notification_setting.source)) - - render_response - end - - private - - def resource - @resource ||= - if params[:project_id].present? - Project.find(params[:project_id]) - elsif params[:namespace_id].present? - Group.find(params[:namespace_id]) - end - end - - def can_read?(resource) - ability_name = resource.class.name.downcase - ability_name = "read_#{ability_name}".to_sym - - can?(current_user, ability_name, resource) - end - - def render_response - btn_class = nil - - if params[:hide_label].present? - btn_class = 'btn-xs' if params[:project_id].present? - response_template = 'shared/notifications/_new_button' - else - response_template = 'shared/notifications/_button' - end - - render json: { - html: view_to_html_string(response_template, notification_setting: @notification_setting, btn_class: btn_class), - saved: @saved - } - end - - def notification_setting_params_for(source) - params.require(:notification_setting).permit(NotificationSetting.allowed_fields(source)) - end -end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1185bcc9ea8..cd5dd7346ee 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -31,10 +31,6 @@ class ProjectsController < Projects::ApplicationController # Project Export Rate Limit before_action :export_rate_limit, only: [:export, :download_export, :generate_new_export] - before_action do - push_frontend_feature_flag(:vue_notification_dropdown, @project, default_enabled: :yaml) - end - before_action only: [:edit] do push_frontend_feature_flag(:allow_editing_commit_messages, @project) end diff --git a/app/graphql/types/ci/job_artifact_file_type_enum.rb b/app/graphql/types/ci/job_artifact_file_type_enum.rb index 4b484dec590..5099b0d4850 100644 --- a/app/graphql/types/ci/job_artifact_file_type_enum.rb +++ b/app/graphql/types/ci/job_artifact_file_type_enum.rb @@ -6,7 +6,8 @@ module Types graphql_name 'JobArtifactFileType' ::Ci::JobArtifact::TYPE_AND_FORMAT_PAIRS.keys.each do |file_type| - value file_type.to_s.upcase, value: file_type.to_s + description = file_type == :codequality ? "CODE QUALITY" : file_type.to_s.titleize.upcase # This is needed as doc lint will not allow codequality as one word + value file_type.to_s.upcase, value: file_type.to_s, description: "#{description} job artifact file type." end end end diff --git a/app/views/groups/_home_panel.html.haml b/app/views/groups/_home_panel.html.haml index 37c4ecc09f3..98ac4515bd8 100644 --- a/app/views/groups/_home_panel.html.haml +++ b/app/views/groups/_home_panel.html.haml @@ -23,11 +23,8 @@ .home-panel-buttons.col-md-12.col-lg-6 - if current_user .gl-display-flex.gl-flex-wrap.gl-lg-justify-content-end.gl-mx-n2{ data: { testid: 'group-buttons' } } - - if Feature.enabled?(:vue_notification_dropdown, @group, default_enabled: :yaml) - - if @notification_setting - .js-vue-notification-dropdown{ data: { disabled: emails_disabled, dropdown_items: notification_dropdown_items(@notification_setting).to_json, notification_level: @notification_setting.level, help_page_path: help_page_path('user/profile/notifications'), group_id: @group.id, container_class: 'gl-mr-3 gl-mt-3 gl-vertical-align-top' } } - - else - = render 'shared/notifications/new_button', notification_setting: @notification_setting, btn_class: 'btn gl-button gl-sm-w-auto gl-w-full', dropdown_container_class: 'gl-mr-0 gl-px-2 gl-sm-w-auto gl-w-full', emails_disabled: emails_disabled + - if @notification_setting + .js-vue-notification-dropdown{ data: { disabled: emails_disabled.to_s, dropdown_items: notification_dropdown_items(@notification_setting).to_json, notification_level: @notification_setting.level, help_page_path: help_page_path('user/profile/notifications'), group_id: @group.id, container_class: 'gl-mr-3 gl-mt-3 gl-vertical-align-top' } } - if can_create_subgroups .gl-px-2.gl-sm-w-auto.gl-w-full = link_to _("New subgroup"), new_group_path(parent_id: @group.id), class: "btn btn-success btn-md gl-button btn-success-secondary gl-mt-3 gl-sm-w-auto gl-w-full", data: { qa_selector: 'new_subgroup_button' } diff --git a/app/views/profiles/notifications/_group_settings.html.haml b/app/views/profiles/notifications/_group_settings.html.haml index abbfbd995b6..82083af9ff1 100644 --- a/app/views/profiles/notifications/_group_settings.html.haml +++ b/app/views/profiles/notifications/_group_settings.html.haml @@ -9,11 +9,8 @@ = link_to group.name, group_path(group) .table-section.section-30.text-right - - if Feature.enabled?(:vue_notification_dropdown, default_enabled: :yaml) - - if setting - .js-vue-notification-dropdown{ data: { disabled: emails_disabled, dropdown_items: notification_dropdown_items(setting).to_json, notification_level: setting.level, group_id: group.id, container_class: 'gl-mr-3', show_label: "true" } } - - else - = render 'shared/notifications/button', notification_setting: setting, emails_disabled: emails_disabled + - if setting + .js-vue-notification-dropdown{ data: { disabled: emails_disabled.to_s, dropdown_items: notification_dropdown_items(setting).to_json, notification_level: setting.level, group_id: group.id, container_class: 'gl-mr-3', show_label: "true" } } .table-section.section-30 = form_for setting, url: profile_notifications_group_path(group), method: :put, html: { class: 'update-notifications gl-display-flex' } do |f| diff --git a/app/views/profiles/notifications/_project_settings.html.haml b/app/views/profiles/notifications/_project_settings.html.haml index 8cd552caa3d..e6953d1b32e 100644 --- a/app/views/profiles/notifications/_project_settings.html.haml +++ b/app/views/profiles/notifications/_project_settings.html.haml @@ -8,8 +8,5 @@ = link_to_project(project) .float-right - - if Feature.enabled?(:vue_notification_dropdown, default_enabled: :yaml) - - if setting - .js-vue-notification-dropdown{ data: { disabled: emails_disabled, dropdown_items: notification_dropdown_items(setting).to_json, notification_level: setting.level, project_id: project.id, container_class: 'gl-mr-3', show_label: "true" } } - - else - = render 'shared/notifications/button', notification_setting: setting, emails_disabled: emails_disabled + - if setting + .js-vue-notification-dropdown{ data: { disabled: emails_disabled.to_s, dropdown_items: notification_dropdown_items(setting).to_json, notification_level: setting.level, project_id: project.id, container_class: 'gl-mr-3', show_label: "true" } } diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml index cb0ada414ed..853188c563f 100644 --- a/app/views/profiles/notifications/show.html.haml +++ b/app/views/profiles/notifications/show.html.haml @@ -32,11 +32,8 @@ %br .clearfix .form-group.float-left.global-notification-setting - - if Feature.enabled?(:vue_notification_dropdown, default_enabled: :yaml) - - if @global_notification_setting - .js-vue-notification-dropdown{ data: { dropdown_items: notification_dropdown_items(@global_notification_setting).to_json, notification_level: @global_notification_setting.level, help_page_path: help_page_path('user/profile/notifications'), show_label: 'true' } } - - else - = render 'shared/notifications/button', notification_setting: @global_notification_setting + - if @global_notification_setting + .js-vue-notification-dropdown{ data: { dropdown_items: notification_dropdown_items(@global_notification_setting).to_json, notification_level: @global_notification_setting.level, help_page_path: help_page_path('user/profile/notifications'), show_label: 'true' } } .clearfix diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 0d3049cd9a2..5ebe4a4b741 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -46,11 +46,8 @@ .project-repo-buttons.col-md-12.col-lg-6.d-inline-flex.flex-wrap.justify-content-lg-end - if current_user .d-inline-flex - - if Feature.enabled?(:vue_notification_dropdown, @project, default_enabled: :yaml) - - if @notification_setting - .js-vue-notification-dropdown{ data: { button_size: "small", disabled: emails_disabled, dropdown_items: notification_dropdown_items(@notification_setting).to_json, notification_level: @notification_setting.level, help_page_path: help_page_path('user/profile/notifications'), project_id: @project.id, container_class: 'gl-mr-3 gl-mt-5 gl-vertical-align-top' } } - - else - = render 'shared/notifications/new_button', notification_setting: @notification_setting, btn_class: 'btn-xs', dropdown_container_class: 'gl-mr-3', emails_disabled: emails_disabled + - if @notification_setting + .js-vue-notification-dropdown{ data: { button_size: "small", disabled: emails_disabled.to_s, dropdown_items: notification_dropdown_items(@notification_setting).to_json, notification_level: @notification_setting.level, help_page_path: help_page_path('user/profile/notifications'), project_id: @project.id, container_class: 'gl-mr-3 gl-mt-5 gl-vertical-align-top' } } .count-buttons.d-inline-flex = render 'projects/buttons/star' diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index 61b357831fd..1072d5bce06 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -2,7 +2,7 @@ - release = @releases.find { |release| release.tag == tag.name } - commit_status = @tag_pipeline_statuses[tag.name] unless @tag_pipeline_statuses.nil? -%li.flex-row.allow-wrap.js-tag-list +%li.flex-row.js-tag-list{ class: "gl-white-space-normal!" } .row-main-content = sprite_icon('tag') = link_to tag.name, project_tag_path(@project, tag.name), class: 'item-title ref-name' diff --git a/app/views/shared/notifications/_button.html.haml b/app/views/shared/notifications/_button.html.haml deleted file mode 100644 index e12531b8a8d..00000000000 --- a/app/views/shared/notifications/_button.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -- btn_class = local_assigns.fetch(:btn_class, '') -- emails_disabled = local_assigns.fetch(:emails_disabled, false) - -- if notification_setting - - if emails_disabled - - button_title = notification_description(:owner_disabled) - - aria_label = button_title - - btn_class << " disabled" - - else - - button_title = _("Notification setting") - - aria_label = _("Notification setting - %{notification_title}") % { notification_title: notification_title(notification_setting.level) } - - .js-notification-dropdown.notification-dropdown.mr-md-2.home-panel-action-button.dropdown.inline - = form_for notification_setting, remote: true, html: { class: "inline notification-form" } do |f| - = hidden_setting_source_input(notification_setting) - = f.hidden_field :level, class: "notification_setting_level" - .js-notification-toggle-btns - %div{ class: ("btn-group" if notification_setting.custom?) } - - if notification_setting.custom? - %button.dropdown-new.btn.btn-default.btn-icon.gl-button.has-tooltip.notifications-btn.text-left#notifications-button{ type: "button", title: button_title, class: "#{btn_class}", "aria-label" => aria_label, data: { container: "body", toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), display: 'static' } } - = sprite_icon("notifications", css_class: "js-notification-loading") - = notification_title(notification_setting.level) - %button.btn.dropdown-toggle.gl-display-flex.gl-align-items-center{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } - = sprite_icon('chevron-down') - .sr-only Toggle dropdown - - else - %button.dropdown-new.btn.btn-default.btn-icon.gl-button.has-tooltip.notifications-btn#notifications-button{ type: "button", title: button_title, class: "#{btn_class}", "aria-label" => aria_label, data: { container: "body", toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } - .float-left - = sprite_icon("notifications", css_class: "js-notification-loading") - = notification_title(notification_setting.level) - .float-right - = sprite_icon("chevron-down") - - = render "shared/notifications/notification_dropdown", notification_setting: notification_setting - - = content_for :scripts_body do - = render "shared/notifications/custom_notifications", notification_setting: notification_setting diff --git a/app/views/shared/notifications/_custom_notifications.html.haml b/app/views/shared/notifications/_custom_notifications.html.haml deleted file mode 100644 index 946e3c67dcf..00000000000 --- a/app/views/shared/notifications/_custom_notifications.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- hide_label = local_assigns.fetch(:hide_label, false) - -.modal.fade{ tabindex: "-1", role: "dialog", id: notifications_menu_identifier("modal", notification_setting), "aria-labelledby": "custom-notifications-title" } - .modal-dialog - .modal-content - .modal-header - %h4#custom-notifications-title.modal-title - #{ _('Custom notification events') } - %button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _('Close') } - %span{ "aria-hidden": true } × - - .modal-body - .container-fluid - = form_for notification_setting, html: { class: "custom-notifications-form" } do |f| - = hidden_setting_source_input(notification_setting) - = hidden_field_tag("hide_label", true) if hide_label - .row - .col-lg-4 - %h4.gl-mt-0= _('Notification events') - %p - - notification_link = link_to _('notification emails'), help_page_path('user/profile/notifications'), target: '_blank' - - paragraph = _('Custom notification levels are the same as participating levels. With custom notification levels you will also receive notifications for select events. To find out more, check out %{notification_link}.') % { notification_link: notification_link.html_safe } - #{ paragraph.html_safe } - .col-lg-8 - - notification_setting.email_events.each_with_index do |event, index| - - field_id = "#{notifications_menu_identifier("modal", notification_setting)}_notification_setting[#{event}]" - .form-group - .form-check{ class: ("gl-mt-0" if index == 0) } - = check_box("notification_setting", event, id: field_id, class: "js-custom-notification-event form-check-input", checked: notification_setting.public_send(event)) - %label.form-check-label{ for: field_id } - %strong - = notification_event_name(event) - %span.spinner.is-loading.gl-vertical-align-middle.gl-display-none - = sprite_icon('check', css_class: 'is-done gl-display-none gl-vertical-align-middle gl-text-green-600') diff --git a/app/views/shared/notifications/_new_button.html.haml b/app/views/shared/notifications/_new_button.html.haml deleted file mode 100644 index 4b008601783..00000000000 --- a/app/views/shared/notifications/_new_button.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -- btn_class = local_assigns.fetch(:btn_class, '') -- dropdown_container_class = local_assigns.fetch(:dropdown_container_class, '') -- emails_disabled = local_assigns.fetch(:emails_disabled, false) - -- if notification_setting - - 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) } - - .js-notification-dropdown.notification-dropdown.home-panel-action-button.gl-mt-3.dropdown.inline{ class: dropdown_container_class } - = form_for notification_setting, remote: true, html: { class: "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? - %button.dropdown-new.btn.gl-button.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' } } - = notification_setting_icon(notification_setting) - %span.js-notification-loading.fa.hidden - %button.btn.gl-button.btn-default.dropdown-toggle{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" }, class: "#{btn_class}" } - = sprite_icon("chevron-down", css_class: "icon mr-0") - .sr-only Toggle dropdown - - else - %button.dropdown-new.btn.gl-button.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" } } - = notification_setting_icon(notification_setting) - %span.js-notification-loading.fa.hidden - = sprite_icon("chevron-down", css_class: "icon") - - = render "shared/notifications/notification_dropdown", notification_setting: notification_setting - - = content_for :scripts_body do - = render "shared/notifications/custom_notifications", notification_setting: notification_setting, hide_label: true diff --git a/app/views/shared/notifications/_notification_dropdown.html.haml b/app/views/shared/notifications/_notification_dropdown.html.haml deleted file mode 100644 index a6ef2d51171..00000000000 --- a/app/views/shared/notifications/_notification_dropdown.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -%ul.dropdown-menu.dropdown-menu-no-wrap.dropdown-menu-selectable.dropdown-menu-large{ role: "menu", class: [notifications_menu_identifier("dropdown", notification_setting)] } - - NotificationSetting.levels.each_key do |level| - - next if level == "custom" - - next if level == "global" && notification_setting.source.nil? - - = notification_list_item(level, notification_setting) - - %li.divider - %li - %a.update-notification{ href: "#", role: "button", class: ("is-active" if notification_setting.custom?), data: { toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), notification_level: "custom", notification_title: "Custom" } } - %strong.dropdown-menu-inner-title= s_('NotificationSetting|Custom') - %span.dropdown-menu-inner-content= notification_description("custom") |
