diff --git a/app/assets/javascripts/projects/index.js b/app/assets/javascripts/projects/index.js index bfe9008df..2e37ae7f1 100644 --- a/app/assets/javascripts/projects/index.js +++ b/app/assets/javascripts/projects/index.js @@ -8,7 +8,7 @@ // - refactor view handling using library, ex. backbone.js /* global Comments CounterBadge animateSpinner initFormSubmitLinks HelperModule - I18n */ + I18n setupSidebarTree */ //= require comments (function() { @@ -454,6 +454,16 @@ } else { TABLE.draw(); } + // Also refresh sidebar tree navigation + $.ajax({ + url: $('#projects-cards-view').data('projects-sidebar-url'), + type: 'GET', + dataType: 'json', + success: function(data) { + $('#slide-panel .tree').html(''); + setupSidebarTree(); + } + }); } function loadCardsView() { diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c17d99ee5..bbfe1c765 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -9,7 +9,7 @@ class ProjectsController < ApplicationController notifications reports samples experiment_archive delete_samples samples_index) - before_action :load_projects_tree, only: %i(show samples archive + before_action :load_projects_tree, only: %i(sidebar show samples archive experiment_archive) before_action :load_archive_vars, only: :archive before_action :check_view_permissions, only: %i(show reports notifications @@ -67,6 +67,19 @@ class ProjectsController < ApplicationController end end + def sidebar + respond_to do |format| + format.json do + render json: { + html: render_to_string( + partial: 'shared/sidebar/projects.html.erb', + formats: :html + ) + } + end + end + end + def archive index end diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index cc798773b..3b239c961 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -153,7 +153,11 @@
-
+
+
<%= render partial: "projects/index/team_projects_table" %>
diff --git a/config/routes.rb b/config/routes.rb index 42df5777e..681793e33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -207,6 +207,7 @@ Rails.application.routes.draw do get 'projects/archive', to: 'projects#archive', as: 'projects_archive' post 'projects/index_dt', to: 'projects#index_dt', as: 'projects_index_dt' + get 'projects/sidebar', to: 'projects#sidebar', as: 'projects_sidebar' get 'projects/dt_state_load', to: 'projects#dt_state_load', as: 'projects_dt_state_load'