Upstream sync

This commit is contained in:
Senad Uka
2020-06-12 16:38:59 +02:00
parent 5f5e6c18b5
commit fbf3173747
12 changed files with 121 additions and 21 deletions

View File

@@ -1,11 +1,16 @@
$(document).on("change", "[data-toggle=collapse-select]", function(event) {
const select = event.target;
const target = select.dataset.target;
const showValues = JSON.parse(select.dataset.showValues);
if (showValues.indexOf(select.value) > -1) {
$(target).show("fast");
} else {
$(target).hide("fast");
}
const mappings = JSON.parse(select.dataset.targetShowValuesMapping);
$.each(mappings, function( key, value ) {
if (value.indexOf(select.value) > -1) {
$(key).show("fast");
} else {
$(key).hide("fast");
}
});
});
$(document).on("turbolinks:load", function() {
$("[data-toggle=collapse-select]").trigger("change");
});

View File

@@ -61,7 +61,12 @@ class ContractTemplatesController < ApplicationController
:applicable_medium_id, :applicable_medium_text,
:territory_id, :territory_text,
:term_id, :term_text,
:restriction_id, :restriction_text)
:restriction_id, :restriction_text,
:question_1_text, :question_2_text,
:question_3_text, :question_4_text,
:question_5_text, :question_6_text,
:question_7_text, :question_8_text,
:question_9_text, :question_10_text)
end
def download_attributes

View File

@@ -48,6 +48,11 @@ class Public::MedicalReleasesController < Public::BaseController
:signature_base64,
:locale,
:contract_template,
:question_1_answer, :question_2_answer,
:question_3_answer, :question_4_answer,
:question_5_answer, :question_6_answer,
:question_7_answer, :question_8_answer,
:question_9_answer, :question_10_answer,
photos: [],
)
end

View File

@@ -2,20 +2,24 @@
<%= field_set_tag content_tag(:span, t(".release_info.heading"), class: "h6 text-muted text-uppercase") do %>
<div class="form-row">
<%= form.text_field :name, wrapper_class: "col-sm-6" %>
<%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target: "#guardian_clause", show_values: %w(appearance talent) }, class: "form-control custom-select" %>
<%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target_show_values_mapping: { "#guardian_clause": %w(appearance talent), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical) } }, class: "form-control custom-select" %>
</div>
<div class="form-row">
<div class="form-row" id="fee_field">
<%= 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" %>
</div>
<% end %>
<hr>
<%= 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 %>
<hr>
<% 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 %>
<hr>
<% end %>
<hr>
<%= field_set_tag content_tag(:span, t(".legal.heading"), class: "h6 text-muted text-uppercase") do %>
<%= form.form_group do %>

View File

@@ -39,6 +39,15 @@
<% end %>
</dl>
<% if releasable.model_name == "MedicalRelease" %>
<% (1..10).each do |n| %>
<% if contract_template.public_send("question_#{n}_text").present? %>
<p><strong><%= contract_template.public_send("question_#{n}_text") %></strong></p>
<p><%= releasable.public_send("question_#{n}_answer") %></p>
<% end %>
<% end %>
<% end %>
<% if releasable.minor? %>
<br/>
<p class="text-left"><strong>Guardian Information</strong></p>

View File

@@ -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" %>
<div id="other_client" style="<%='display: none' if selected_project_client_value(project) != 'other'%>">
<%= form.text_field :client_name, placeholder: true %>
<%= form.form_group do %>

View File

@@ -13,6 +13,19 @@
<% end %>
<hr>
<% 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? %>
<div class="form-row">
<%= form.text_area "question_#{n}_answer", wrapper_class: "col-sm-12", label: @contract_template.public_send("question_#{n}_text") %>
</div>
<% end %>
<% end %>
<% end %>
<hr>
<% end %>
<%= card_field_set_tag t(".personal_info.heading") do %>
<div class="alert alert-warning font-weight-bold"><%= t ".personal_info.instructions" %></div>

View File

@@ -0,0 +1,5 @@
<% (1..10).each do |n| %>
<div class="form-row">
<%= form.text_area "question_#{n}_text", wrapper_class: "col-sm-12" %>
</div>
<% end%>

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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');