<%= form.number_field :fee, min:"0", max:"99999999", step: "0.01", prepend: "$", help: "Leave at $0.00 for no-fee", wrapper_class: "col-sm-6" %>
- <%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase")do %>
+ <%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase"), id: "exploitable_rights_fields" do %>
<%= render "shared/exploitable_rights_fields", form: form %>
+
+ <% end %>
+
+ <%= field_set_tag content_tag(:span, t(".custom_fields.heading"), class: "h6 text-muted text-uppercase"), id: "custom_fields", style: "display: none;" do %>
+ <%= render "shared/custom_fields", form: form %>
+
<%= field_set_tag content_tag(:span, t(".legal.heading"), class: "h6 text-muted text-uppercase") do %>
<%= form.form_group do %>
diff --git a/app/views/contracts/_signature_page.html.erb b/app/views/contracts/_signature_page.html.erb
index e39c8be..276e5de 100644
--- a/app/views/contracts/_signature_page.html.erb
+++ b/app/views/contracts/_signature_page.html.erb
@@ -39,6 +39,15 @@
<% end %>
+<% if releasable.model_name == "MedicalRelease" %>
+ <% (1..10).each do |n| %>
+ <% if contract_template.public_send("question_#{n}_text").present? %>
+
diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb
index a8a91d7..677a545 100644
--- a/app/views/projects/_form.html.erb
+++ b/app/views/projects/_form.html.erb
@@ -1,6 +1,6 @@
<%= bootstrap_form_with model: project, local: true do |form| %>
<%= form.text_field :name %>
- <%= form.select :predefined_client_name, options_for_select(options_for_predefined_client_name_select, selected_project_client_value(project)), {}, data: { toggle: "collapse-select", target: "#other_client", show_values: [:other] }, class: "form-control custom-select" %>
+ <%= form.select :predefined_client_name, options_for_select(options_for_predefined_client_name_select, selected_project_client_value(project)), {}, data: { toggle: "collapse-select", target_show_values_mapping: { "#other_client": [:other] } }, class: "form-control custom-select" %>
<%= form.text_field :client_name, placeholder: true %>
<%= form.form_group do %>
diff --git a/app/views/public/medical_releases/new.html.erb b/app/views/public/medical_releases/new.html.erb
index 93199d6..c673178 100644
--- a/app/views/public/medical_releases/new.html.erb
+++ b/app/views/public/medical_releases/new.html.erb
@@ -13,6 +13,19 @@
<% end %>
+
+ <% if (1..10).map {|n| @contract_template.public_send("question_#{n}_text").presence }.compact.any? %>
+ <%= card_field_set_tag t(".questionnaire.heading") do %>
+ <% (1..10).each do |n| %>
+ <% if @contract_template.public_send("question_#{n}_text").present? %>
+
+ <%= form.text_area "question_#{n}_answer", wrapper_class: "col-sm-12", label: @contract_template.public_send("question_#{n}_text") %>
+
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <% end %>
<%= card_field_set_tag t(".personal_info.heading") do %>
<%= t ".personal_info.instructions" %>
diff --git a/app/views/shared/_custom_fields.html.erb b/app/views/shared/_custom_fields.html.erb
new file mode 100644
index 0000000..48f729a
--- /dev/null
+++ b/app/views/shared/_custom_fields.html.erb
@@ -0,0 +1,5 @@
+<% (1..10).each do |n| %>
+
+ <%= form.text_area "question_#{n}_text", wrapper_class: "col-sm-12" %>
+
+<% end%>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 19afb42..5ce9bc8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -212,12 +212,14 @@ en:
archived_failure: Failed to archive the release template
archived_notice: The release template has been archived
form:
+ custom_fields:
+ heading: Custom Fields
exploitable_rights:
- heading: 2 of 3 Exploitable Rights
+ heading: Exploitable Rights
legal:
- heading: 3 of 3 Legal
+ heading: Legal
release_info:
- heading: 1 of 3 Release Info
+ heading: Release Info
index:
actions:
import: Import Release Template
@@ -851,6 +853,8 @@ en:
instructions: Now, enter your personal information.
photo:
heading: Photos
+ questionnaire:
+ heading: Questionnaire
signature:
heading: Signature
talent_releases:
diff --git a/db/migrate/20200610085411_add_question_fields_to_contract_templates.rb b/db/migrate/20200610085411_add_question_fields_to_contract_templates.rb
new file mode 100644
index 0000000..0187af8
--- /dev/null
+++ b/db/migrate/20200610085411_add_question_fields_to_contract_templates.rb
@@ -0,0 +1,14 @@
+class AddQuestionFieldsToContractTemplates < ActiveRecord::Migration[6.0]
+ def change
+ add_column :contract_templates, :question_1_text, :text
+ add_column :contract_templates, :question_2_text, :text
+ add_column :contract_templates, :question_3_text, :text
+ add_column :contract_templates, :question_4_text, :text
+ add_column :contract_templates, :question_5_text, :text
+ add_column :contract_templates, :question_6_text, :text
+ add_column :contract_templates, :question_7_text, :text
+ add_column :contract_templates, :question_8_text, :text
+ add_column :contract_templates, :question_9_text, :text
+ add_column :contract_templates, :question_10_text, :text
+ end
+end
diff --git a/db/migrate/20200610140459_add_answer_fields_to_medical_releases.rb b/db/migrate/20200610140459_add_answer_fields_to_medical_releases.rb
new file mode 100644
index 0000000..3e78fb5
--- /dev/null
+++ b/db/migrate/20200610140459_add_answer_fields_to_medical_releases.rb
@@ -0,0 +1,14 @@
+class AddAnswerFieldsToMedicalReleases < ActiveRecord::Migration[6.0]
+ def change
+ add_column :medical_releases, :question_1_answer, :text
+ add_column :medical_releases, :question_2_answer, :text
+ add_column :medical_releases, :question_3_answer, :text
+ add_column :medical_releases, :question_4_answer, :text
+ add_column :medical_releases, :question_5_answer, :text
+ add_column :medical_releases, :question_6_answer, :text
+ add_column :medical_releases, :question_7_answer, :text
+ add_column :medical_releases, :question_8_answer, :text
+ add_column :medical_releases, :question_9_answer, :text
+ add_column :medical_releases, :question_10_answer, :text
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 2888215..06d35f1 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -606,7 +606,17 @@ CREATE TABLE public.contract_templates (
term_text character varying,
restriction_id bigint,
restriction_text character varying,
- archived_at timestamp without time zone
+ archived_at timestamp without time zone,
+ question_1_text text,
+ question_2_text text,
+ question_3_text text,
+ question_4_text text,
+ question_5_text text,
+ question_6_text text,
+ question_7_text text,
+ question_8_text text,
+ question_9_text text,
+ question_10_text text
);
@@ -955,7 +965,17 @@ CREATE TABLE public.medical_releases (
notes text,
signed_at timestamp without time zone,
created_at timestamp(6) without time zone NOT NULL,
- updated_at timestamp(6) without time zone NOT NULL
+ updated_at timestamp(6) without time zone NOT NULL,
+ question_1_answer text,
+ question_2_answer text,
+ question_3_answer text,
+ question_4_answer text,
+ question_5_answer text,
+ question_6_answer text,
+ question_7_answer text,
+ question_8_answer text,
+ question_9_answer text,
+ question_10_answer text
);
@@ -3595,6 +3615,8 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200512161738'),
('20200526113516'),
('20200603090419'),
-('20200606044747');
+('20200606044747'),
+('20200610085411'),
+('20200610140459');