75496059a1
Continues the iteration on the project overview UI: - moved star, fork and new clone button (copy SSH/HTTPS URLs) to top right, made them smaller - avatar is now larger (64px) - 'Request access' is now a link instead of a button - overview comes before the description + changed styling and added icons - description font-size is now 16px (large-paragraph) - quick links to files are moved downwards below the commit/pipeline info - margins changed to group content into 4 groups to clean up the interface - visibility info reduced to icon-only and moved to the right of the title
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import $ from 'jquery';
|
|
import 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('fa-bell fa-spin fa-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);
|
|
form.submit();
|
|
});
|
|
|
|
$(document).on('ajax:success', '.notification-form', (e, data) => {
|
|
if (data.saved) {
|
|
$(e.currentTarget)
|
|
.closest('.js-notification-dropdown')
|
|
.replaceWith(data.html);
|
|
} else {
|
|
Flash('Failed to save new settings', 'alert');
|
|
}
|
|
});
|
|
}
|