Pass projects mode(archived/active) to move_to modal for list [SCI-5334]

This commit is contained in:
Urban Rotnik 2021-01-07 17:31:27 +01:00
parent 3dc76a3e57
commit 5d79eaa843
3 changed files with 6 additions and 2 deletions

View file

@ -539,7 +539,7 @@
folders = selectedProjectFolders.map(e => ({ id: e, type: 'project_folder' }));
let movables = projects.concat(folders);
$.get(url, { items: items }, function(result) {
$.get(url, { items: items, sort: projectsCurrentSort, mode: $('.projects-index').data('mode') }, function(result) {
$(moveToModal).find('.modal-content').html(result.html);
$(moveToModal).modal('show');
initializeJSTree($(moveToModal).find('#moveToFolders'));

View file

@ -64,6 +64,10 @@ class ProjectFoldersController < ApplicationController
end
def move_to_modal
view_state = current_team.current_view_state(current_user)
@current_view_mode = params[:mode] || :active
@current_sort = view_state.state.dig('projects', @current_view_mode.to_s, 'sort') || 'atoz'
render json: {
html: render_to_string(partial: 'projects/index/modals/move_to_modal_contents.html.erb',
locals: { items_label: items_label(params[:items]) })

View file

@ -20,7 +20,7 @@
<li class="jstree-open" id="root_folder" data-jstree='{"icon":"fas fa-folder root-folder"}'>
<a class="jstree-clicked" href="#">Projects</a>
<%= render partial: 'projects/index/modals/move_to_folders_tree.html.erb',
locals: { records: sidebar_folders_tree(current_team, current_user, folders_only: true) } %>
locals: { records: sidebar_folders_tree(current_team, current_user, @current_sort, @current_view_mode, folders_only: true) } %>
</li>
</ul>
</div>