diff --git a/app/assets/javascripts/reports/new.js b/app/assets/javascripts/reports/new.js
index b63d148c1..4da092c4a 100644
--- a/app/assets/javascripts/reports/new.js
+++ b/app/assets/javascripts/reports/new.js
@@ -980,9 +980,6 @@ function reportHandsonTableConverter() {
// Project
reportData.project_id = dropdownSelector.getValues('#projectSelector');
- // Template
- reportData.template_id = dropdownSelector.getValues('#templateSelector');
-
// Template values
reportData.template_values = {};
$.each($('.report-template-values-container').find('.sci-input-field, select'), function(i, field) {
@@ -1030,6 +1027,7 @@ function reportHandsonTableConverter() {
});
// Settings
+ reportData.report.settings.template = dropdownSelector.getValues('#templateSelector');
reportData.report.settings.all_tasks = $('.project-contents-container .select-all-my-modules-checkbox')
.prop('checked');
$.each($('.task-contents-container .content-element .protocol-setting'), function(i, e) {
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index a12fe6ea9..897e21727 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -186,7 +186,7 @@ class ReportsController < ApplicationController
respond_to do |format|
format.json do
@report.update!(pdf_file_processing: true)
- Reports::PdfJob.perform_later(@report, 'template_1', current_user)
+ Reports::PdfJob.perform_later(@report, @report.settings[:template], current_user)
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
@@ -548,6 +548,6 @@ class ReportsController < ApplicationController
end
def generate_pdf_report
- Reports::PdfJob.perform_later(@report, 'template_1', current_user) if @report.persisted?
+ Reports::PdfJob.perform_later(@report, @report.settings[:template], current_user) if @report.persisted?
end
end
diff --git a/app/views/reports/templates/template_2/cover.html.erb b/app/views/reports/templates/template_2/cover.html.erb
index fe859aeaf..6bd740f9b 100644
--- a/app/views/reports/templates/template_2/cover.html.erb
+++ b/app/views/reports/templates/template_2/cover.html.erb
@@ -23,6 +23,7 @@
ul {
list-style-type: none;
+ padding: 0;
}
li {
@@ -72,7 +73,7 @@
-
+ |
- Objective <%= render Reports::LargeTextInputComponent.new(report: report, name: :objective, label: 'Objective', editing: false) %>
- Background <%= render Reports::LargeTextInputComponent.new(report: report, name: :background, label: 'Background ', editing: false) %>
diff --git a/app/views/reports/templates/template_3/cover.html.erb b/app/views/reports/templates/template_3/cover.html.erb
new file mode 100644
index 000000000..a5f41cbd7
--- /dev/null
+++ b/app/views/reports/templates/template_3/cover.html.erb
@@ -0,0 +1,90 @@
+
+
+
+
+
+ |
+ |
+
+
+ OTR-Short Form Report |
+
+
+ |
+
+
+ Date: |
+ <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %> |
+
+
+ From: |
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From', editing: false) %> |
+
+
+ Through: |
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_through, label: 'Through', editing: false) %> |
+
+
+ To: |
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_to, label: 'To', editing: false) %> |
+
+
+ Subject: |
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_subject, label: 'Subject', editing: false) %> |
+
+
+ |
+
+
+
+
+ - Report file name: <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %>
+ - Associated Protocol: <%= render Reports::TextInputComponent.new(report: report, name: :associated_protocol, label: 'Associated Protocol', editing: false) %>
+ - Background: <%= render Reports::LargeTextInputComponent.new(report: report, name: :report_background, label: 'Background', editing: false) %>
+ - Conclusions: <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Conclusions', editing: false) %>
+ - Results and Discussion <%= render Reports::LargeTextInputComponent.new(report: report, name: :results, label: 'Results and Discussion', editing: false) %>
+ - References (if needed) <%= render Reports::LargeTextInputComponent.new(report: report, name: :references, label: 'References (if needed)', editing: false) %>
+ - Records Management Project Name: <%= render Reports::LargeTextInputComponent.new(report: report, name: :management_project_name, label: 'Records Management Project Name', editing: false) %>
+
+ |
+
+
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %> |
+ Page 1 of |
+ <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %> |
+
+
+
diff --git a/app/views/reports/templates/template_3/edit.html.erb b/app/views/reports/templates/template_3/edit.html.erb
new file mode 100644
index 000000000..be0882810
--- /dev/null
+++ b/app/views/reports/templates/template_3/edit.html.erb
@@ -0,0 +1,14 @@
+<% content_for :cover do %>
+ <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_from, label: 'From') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_through, label: 'Through') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_to, label: 'To') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_subject, label: 'Subject') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :associated_protocol, label: 'Associated Protocol') %>
+ <%= render Reports::LargeTextInputComponent.new(report: report, name: :report_background, label: 'Background') %>
+ <%= render Reports::LargeTextInputComponent.new(report: report, name: :outcome_impact, label: 'Conclusions') %>
+ <%= render Reports::LargeTextInputComponent.new(report: report, name: :results, label: 'Results and Discussion') %>
+ <%= render Reports::LargeTextInputComponent.new(report: report, name: :references, label: 'References (if needed)') %>
+ <%= render Reports::TextInputComponent.new(report: report, name: :management_project_name, label: 'Records Management Project Name') %>
+<% end %>
diff --git a/app/views/reports/templates/template_3/footer.html.erb b/app/views/reports/templates/template_3/footer.html.erb
new file mode 100644
index 000000000..d7a5c7ff4
--- /dev/null
+++ b/app/views/reports/templates/template_3/footer.html.erb
@@ -0,0 +1,36 @@
+
+
+
+ <%= render Reports::TextInputComponent.new(report: report, name: :report_file_name, label: 'Report file name', editing: false) %> |
+
+ <%= render Reports::DateInputComponent.new(report: report, name: :report_date, label: 'Date', editing: false) %> |
+
+
diff --git a/app/views/reports/templates/template_3/header.html.erb b/app/views/reports/templates/template_3/header.html.erb
new file mode 100644
index 000000000..7b52b05f8
--- /dev/null
+++ b/app/views/reports/templates/template_3/header.html.erb
@@ -0,0 +1,26 @@
+
+
diff --git a/app/views/reports/wizard/_project_template_selector.html.erb b/app/views/reports/wizard/_project_template_selector.html.erb
index 4473d2683..0cf371d7d 100644
--- a/app/views/reports/wizard/_project_template_selector.html.erb
+++ b/app/views/reports/wizard/_project_template_selector.html.erb
@@ -12,7 +12,7 @@
<%= label_tag :templateSelector, t('projects.reports.wizard.first_step.select_template') %>
<%= select_tag :templateSelector,
- options_for_select(@templates),
+ options_for_select(@templates, report.settings[:template]),
data: {
placeholder: t('projects.reports.wizard.first_step.select_template'),
values_editor_path: reports_new_template_values_path(report_id: report.id)
diff --git a/config/initializers/extends.rb b/config/initializers/extends.rb
index 1aa69f9ed..b0c95139a 100644
--- a/config/initializers/extends.rb
+++ b/config/initializers/extends.rb
@@ -422,6 +422,7 @@ class Extends
REPORT_TEMPLATES = {
template_1: 'template_1',
- template_2: 'template_2'
+ template_2: 'template_2',
+ template_3: 'template_3'
}
end
|