diff --git a/app/assets/javascripts/activities/index.js b/app/assets/javascripts/activities/index.js new file mode 100644 index 000000000..78471e4e6 --- /dev/null +++ b/app/assets/javascripts/activities/index.js @@ -0,0 +1,19 @@ +'use strict'; + +(function() { + function initActivitiesButton() { + $(document).ready(function() { + $(document).find('.btn-more-activities') + .on('ajax:success', function(e, data) { + $(data.html).insertAfter($('#list-activities li').last()); + if(data.more_url) { + $(this).attr('href', data.more_url); + } else { + $(this).remove(); + } + }); + }); + } + initActivitiesButton(); + +})(); diff --git a/app/assets/javascripts/navigation.js b/app/assets/javascripts/navigation.js index 4e731df63..bce30d4ad 100644 --- a/app/assets/javascripts/navigation.js +++ b/app/assets/javascripts/navigation.js @@ -104,57 +104,10 @@ }); } - 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')); - if(data.more_url) { - $(this).attr('href', data.more_url); - } else { - $(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(); })(); diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index fe368ab50..1d6252158 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -4,7 +4,6 @@ /** Layout **/ body, -#activity-modal, #main-nav, #notifications, #notifications .alert { @@ -1126,11 +1125,8 @@ ul.double-line > li { left: 8px; } -#activity-modal { - .modal-body { - background-color: $color-concrete; - color: $color-mine-shaft; - } +#global-activity-page { + margin-top: 50px; } /** Activity list resembling Bootstrap wells */ diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 1563bf73f..fe43522a3 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -2,15 +2,17 @@ class ActivitiesController < ApplicationController include ActivityHelper def index + @vars = local_vars respond_to do |format| format.json do render json: { more_url: local_vars.fetch(:more_activities_url), html: render_to_string( - partial: 'index.html.erb', locals: local_vars + partial: 'list.html.erb', locals: @vars ) } end + format.html end end diff --git a/app/views/activities/_activity.html.erb b/app/views/activities/_activity.html.erb index 0e1af449a..e4865539a 100644 --- a/app/views/activities/_activity.html.erb +++ b/app/views/activities/_activity.html.erb @@ -1,6 +1,6 @@