Add default template selection [SCI-5740]

This commit is contained in:
aignatov-bio 2021-05-20 13:18:57 +02:00
parent ed1467635f
commit 1b56190116
2 changed files with 3 additions and 1 deletions

View file

@ -51,6 +51,7 @@ class ReportsController < ApplicationController
# Report grouped by modules
def new
@templates = Extends::REPORT_TEMPLATES
@active_template = @templates.one? ? @templates.keys[0] : nil
@repositories = Repository.accessible_by_teams(current_team).active.select(:id, :name)
@report = current_team.reports.new
end
@ -114,6 +115,7 @@ class ReportsController < ApplicationController
def edit
@edit = true
@templates = Extends::REPORT_TEMPLATES
@active_template = @report.settings[:template]
@repositories = Repository.accessible_by_teams(current_team).active.select(:id, :name)
@report.settings = Report::DEFAULT_SETTINGS if @report.settings.blank?

View file

@ -14,7 +14,7 @@
<div class='template-selector'>
<%= label_tag :templateSelector, t('projects.reports.wizard.first_step.select_template') %>
<%= select_tag :templateSelector,
options_for_select(@templates.invert, report.settings[:template]),
options_for_select(@templates.invert, @active_template),
prompt: t('projects.reports.wizard.first_step.select_template'),
data: {
disable_on_load: report.settings[:template].blank?,