mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-05 14:41:53 +08:00
Merge pull request #721 from okriuchykhin/ok_SCI_1412
Fix activities [SCI-1412]
This commit is contained in:
commit
75c887ce7d
4 changed files with 50 additions and 47 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();
|
||||
})();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class ActivitiesController < ApplicationController
|
||||
include ActivityHelper
|
||||
|
||||
before_filter :load_vars
|
||||
before_action :load_vars
|
||||
|
||||
def index
|
||||
@per_page = Constants::ACTIVITY_AND_NOTIF_SEARCH_LIMIT
|
||||
|
|
|
@ -64,12 +64,11 @@ class Activity < ApplicationRecord
|
|||
]
|
||||
|
||||
validates :type_of, presence: true
|
||||
validates :project, :user, presence: true
|
||||
|
||||
belongs_to :project, inverse_of: :activities, optional: true
|
||||
belongs_to :project, inverse_of: :activities
|
||||
belongs_to :experiment, inverse_of: :activities, optional: true
|
||||
belongs_to :my_module, inverse_of: :activities, optional: true
|
||||
belongs_to :user, inverse_of: :activities, optional: true
|
||||
belongs_to :user, inverse_of: :activities
|
||||
|
||||
private
|
||||
|
||||
|
|
Loading…
Reference in a new issue