mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-29 03:01:58 +08:00
Add default template selection [SCI-5740]
This commit is contained in:
parent
ed1467635f
commit
1b56190116
2 changed files with 3 additions and 1 deletions
|
@ -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?
|
||||
|
||||
|
|
|
@ -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?,
|
||||
|
|
Loading…
Reference in a new issue