diff --git a/app/assets/javascripts/reports/new.js b/app/assets/javascripts/reports/new.js index b518eb537..8ed9f8e3d 100644 --- a/app/assets/javascripts/reports/new.js +++ b/app/assets/javascripts/reports/new.js @@ -982,7 +982,7 @@ function reportHandsonTableConverter() { // Template values reportData.template_values = {}; - $.each($('.report-template-values-container').find('.sci-input-field, select'), function(i, field) { + $.each($('.report-template-values-container').find('.sci-input-field'), function(i, field) { if (field.value.length === 0) return; reportData.template_values[field.name] = { @@ -991,6 +991,15 @@ function reportHandsonTableConverter() { }; }); + $.each($('.report-template-values-container').find('select'), function(i, field) { + if (dropdownSelector.getValues(field).length === 0) return; + + reportData.template_values[field.name] = { + value: dropdownSelector.getValues(field), + view_component: field.dataset.type + }; + }); + $.each($('.report-template-values-container .sci-checkbox'), function(i, checkbox) { if (checkbox.name.includes('[]')) { let name = checkbox.name.replace('[]', ''); @@ -1307,10 +1316,7 @@ function reportHandsonTableConverter() { $('.report-template-values-container').html(result.html); $('.report-template-value-dropdown').each(function() { dropdownSelector.init($(this), { - singleSelect: false, - closeOnSelect: true, - noEmptyOption: true, - selectAppearance: 'simple' + noEmptyOption: true }); }); }); diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 7ea2e7bf0..00c989780 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -56,8 +56,11 @@ class ReportsController < ApplicationController end def new_template_values - template = Extends::REPORT_TEMPLATES[params[:template].to_sym] - return render_404 if template.blank? + if Extends::REPORT_TEMPLATES.key?(params[:template]&.to_sym) + template = params[:template] + else + return render_404 + end report = current_team.reports.where(project: @project).find_by(id: params[:report_id]) report ||= current_team.reports.new(project: @project)