mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-29 03:01:58 +08:00
Fix ordering tasks in report and wizard [SCI-5706]
This commit is contained in:
parent
56a6c0825d
commit
44a17dc014
3 changed files with 6 additions and 5 deletions
|
@ -1019,7 +1019,7 @@ function reportHandsonTableConverter() {
|
|||
let experimentId = $(experiment).find('.report-experiment-checkbox').val();
|
||||
reportData.project_content.experiments[experimentId] = [];
|
||||
$.each($(experiment).find('.report-my-module-checkbox:checked'), function(j, myModule) {
|
||||
reportData.project_content.experiments[experimentId].push(myModule.value);
|
||||
reportData.project_content.experiments[experimentId].push(parseInt(myModule.value, 10));
|
||||
});
|
||||
});
|
||||
$.each($('.task-contents-container .repositories-contents .sci-checkbox:checked'), function(i, e) {
|
||||
|
@ -1364,6 +1364,7 @@ function reportHandsonTableConverter() {
|
|||
});
|
||||
|
||||
$('#reportWizardEditWarning').modal('show');
|
||||
$('.experiment-contents').sortable();
|
||||
|
||||
initGenerateButton();
|
||||
initReportWizard();
|
||||
|
|
|
@ -115,8 +115,8 @@ class ReportsController < ApplicationController
|
|||
@report.settings = Report::DEFAULT_SETTINGS if @report.settings.blank?
|
||||
|
||||
@project_contents = {
|
||||
experiments: @report.report_elements.experiment.pluck(:experiment_id),
|
||||
my_modules: @report.report_elements.my_module.pluck(:my_module_id),
|
||||
experiments: @report.report_elements.order(:position).experiment.pluck(:experiment_id),
|
||||
my_modules: @report.report_elements.order(:position).my_module.pluck(:my_module_id),
|
||||
repositories: @report.report_elements.my_module_repository.distinct(:repository_id).pluck(:repository_id)
|
||||
}
|
||||
render :new
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<ul>
|
||||
<% project.experiments.includes(:my_modules).active.each do |experiment| %>
|
||||
<% project.experiments.includes(:my_modules).active.sort_by{|e| @project_contents[:experiments].index(e.id) || @project_contents[:experiments].length if report}.each do |experiment| %>
|
||||
<li class="experiment-element">
|
||||
<div class="experiment-block">
|
||||
<span class="sci-checkbox-container">
|
||||
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<ul class="experiment-contents collapse in" id="experimentContentContainer<%= experiment.id %>">
|
||||
<% experiment.my_modules.active.each do |my_module| %>
|
||||
<% experiment.my_modules.active.sort_by{|m| @project_contents[:my_modules].index(m.id) || @project_contents[:my_modules].length if report}.each do |my_module| %>
|
||||
<li class="experiment-my-module">
|
||||
<span class="sci-checkbox-container">
|
||||
<input type="checkbox" value="<%= my_module.id %>" class="sci-checkbox report-my-module-checkbox"
|
||||
|
|
Loading…
Reference in a new issue