mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 03:36:44 +08:00
Refresh sidebar when project is archived/restored [SCI-2881]
This commit is contained in:
parent
60a19734b2
commit
2c96f08b98
4 changed files with 31 additions and 3 deletions
|
@ -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('<ul>' + data.html + '</ul>');
|
||||
setupSidebarTree();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadCardsView() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -153,7 +153,11 @@
|
|||
</div>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="projects-cards-view" data-projects-url="<%= projects_path %>"></div>
|
||||
<div class="tab-pane active"
|
||||
id="projects-cards-view"
|
||||
data-projects-url="<%= projects_path %>"
|
||||
data-projects-sidebar-url="<%= projects_sidebar_path %>">
|
||||
</div>
|
||||
<div class="tab-pane" id="projects-table-view">
|
||||
<%= render partial: "projects/index/team_projects_table" %>
|
||||
</div>
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue