mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 23:25:31 +08:00
Fix activities button misbehaviour with turbolinks [SCI-1412]
This commit is contained in:
parent
16a68bbaee
commit
5c39b90b2d
2 changed files with 47 additions and 43 deletions
|
@ -177,49 +177,6 @@ $(window).unload(function () {
|
|||
$(window).unbind('unload');
|
||||
});
|
||||
|
||||
$(document.body).ready(function () {
|
||||
// Activity feed modal in main navigation menu
|
||||
var activityModal = $('#activity-modal');
|
||||
var activityModalBody = activityModal.find('.modal-body');
|
||||
|
||||
var initMoreBtn = function () {
|
||||
activityModalBody.find('.btn-more-activities')
|
||||
.on('ajax:success', function (e, data) {
|
||||
$(data.html).insertBefore($(this).parents('li'));
|
||||
$(this).attr('href', data.next_url);
|
||||
if (data.activities_number < data.per_page) {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
notificationAlertClose();
|
||||
|
||||
$('#main-menu .btn-activity')
|
||||
.on('ajax:before', function () {
|
||||
activityModal.modal('show');
|
||||
})
|
||||
.on('ajax:success', function (e, data) {
|
||||
activityModalBody.html(data.html);
|
||||
initMoreBtn();
|
||||
});
|
||||
|
||||
activityModal.on('hidden.bs.modal', function () {
|
||||
activityModalBody.html('');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ajaxComplete(function(){
|
||||
notificationAlertClose();
|
||||
});
|
||||
|
||||
function notificationAlertClose(){
|
||||
$("#notifications .alert").on("closed.bs.alert", function () {
|
||||
$("#content-wrapper")
|
||||
.addClass("alert-hidden")
|
||||
.removeClass("alert-shown");
|
||||
});
|
||||
}
|
||||
var HelperModule = (function(){
|
||||
|
||||
var helpers = {};
|
||||
|
|
|
@ -104,10 +104,57 @@
|
|||
});
|
||||
}
|
||||
|
||||
function initActivitiesButton() {
|
||||
$(document.body).ready(function() {
|
||||
// Activity feed modal in main navigation menu
|
||||
var activityModal = $('#activity-modal');
|
||||
var activityModalBody = activityModal.find('.modal-body');
|
||||
|
||||
var initMoreBtn = function() {
|
||||
activityModalBody.find('.btn-more-activities')
|
||||
.on('ajax:success', function(e, data) {
|
||||
$(data.html).insertBefore($(this).parents('li'));
|
||||
$(this).attr('href', data.next_url);
|
||||
if (data.activities_number < data.per_page) {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
notificationAlertClose();
|
||||
|
||||
$('#main-menu .btn-activity')
|
||||
.on('ajax:before', function() {
|
||||
activityModal.modal('show');
|
||||
})
|
||||
.on('ajax:success', function(e, data) {
|
||||
activityModalBody.html(data.html);
|
||||
initMoreBtn();
|
||||
});
|
||||
|
||||
activityModal.on('hidden.bs.modal', function() {
|
||||
activityModalBody.html('');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ajaxComplete(function() {
|
||||
notificationAlertClose();
|
||||
});
|
||||
|
||||
function notificationAlertClose() {
|
||||
$('#notifications .alert').on('closed.bs.alert', function() {
|
||||
$('#content-wrapper')
|
||||
.addClass('alert-hidden')
|
||||
.removeClass('alert-shown');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// init
|
||||
loadDropdownNotifications();
|
||||
loadUnseenNotificationsNumber();
|
||||
toggleNotificationBellPosition();
|
||||
focusSearchInput();
|
||||
initGlobalSwitchForm();
|
||||
initActivitiesButton();
|
||||
})();
|
||||
|
|
Loading…
Add table
Reference in a new issue