Compare commits
1 Commits
destructur
...
import-arc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94b417d4c4 |
@@ -78,7 +78,7 @@ class AppearanceReleasesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def appearance_release_params
|
def appearance_release_params
|
||||||
params.require(:appearance_release).permit(:contract, :guardian_address_street1, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_photo, :guardian_email, :minor,
|
params.require(:appearance_release).permit(:contract, :guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_photo, :guardian_email, :minor,
|
||||||
:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
|
:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
|
||||||
:applicable_medium_id, :applicable_medium_text,
|
:applicable_medium_id, :applicable_medium_text,
|
||||||
:territory_id, :territory_text,
|
:territory_id, :territory_text,
|
||||||
|
|||||||
@@ -39,25 +39,9 @@ class Public::AppearanceReleasesController < Public::BaseController
|
|||||||
authorize appearance_releases.build(params)
|
authorize appearance_releases.build(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def guardian_params
|
|
||||||
%i[
|
|
||||||
guardian_first_name
|
|
||||||
guardian_last_name
|
|
||||||
guardian_phone
|
|
||||||
guardian_email
|
|
||||||
guardian_photo
|
|
||||||
guardian_address_street1
|
|
||||||
guardian_address_street2
|
|
||||||
guardian_address_city
|
|
||||||
guardian_address_state
|
|
||||||
guardian_address_zip
|
|
||||||
guardian_address_country
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
def appearance_release_params
|
def appearance_release_params
|
||||||
params.require(:appearance_release).permit(:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
|
params.require(:appearance_release).permit(:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
|
||||||
guardian_params, :minor,
|
:guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_email, :guardian_photo, :minor,
|
||||||
:signature_base64, :person_date_of_birth,
|
:signature_base64, :person_date_of_birth,
|
||||||
:locale, :contract_template,)
|
:locale, :contract_template,)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ class ReleaseTemplateImportsController < ApplicationController
|
|||||||
|
|
||||||
templates = []
|
templates = []
|
||||||
filtered_contract_templates.each do |contract_template|
|
filtered_contract_templates.each do |contract_template|
|
||||||
next if contract_template.duplicated? || contract_template.project == @project
|
next if contract_template.duplicated? ||
|
||||||
|
contract_template.archived? ||
|
||||||
|
contract_template.project == @project
|
||||||
|
|
||||||
already_imported = contract_template.duplicates.non_archived.pluck(:project_id).include?(@project.id)
|
already_imported = contract_template.duplicates.non_archived.pluck(:project_id).include?(@project.id)
|
||||||
templates << OpenStruct.new(template: contract_template, already_imported?: already_imported)
|
templates << OpenStruct.new(template: contract_template, already_imported?: already_imported)
|
||||||
|
|||||||
@@ -16,18 +16,6 @@ class AppearanceRelease < ApplicationRecord
|
|||||||
|
|
||||||
has_one_attached :person_photo
|
has_one_attached :person_photo
|
||||||
|
|
||||||
composed_of :guardian_address,
|
|
||||||
class_name: 'Address',
|
|
||||||
mapping: [
|
|
||||||
%w[guardian_address_street1 street1],
|
|
||||||
%w[guardian_address_street2 street2],
|
|
||||||
%w[guardian_address_city city],
|
|
||||||
%w[guardian_address_state state],
|
|
||||||
%w[guardian_address_zip zip],
|
|
||||||
%w[guardian_address_country country]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# These validations apply to all releases
|
# These validations apply to all releases
|
||||||
validates :person_email, email: true, allow_blank: true
|
validates :person_email, email: true, allow_blank: true
|
||||||
validates :person_first_name, :person_last_name, presence: true
|
validates :person_first_name, :person_last_name, presence: true
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ class ContractTemplate < ApplicationRecord
|
|||||||
parent.present?
|
parent.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def archived?
|
||||||
|
archived_at.present?
|
||||||
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
update(archived_at: Time.zone.now)
|
update(archived_at: Time.zone.now)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :guardian_address_street1, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :guardian_address, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -79,7 +79,9 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "shared/address_fields", form: form, subject: "guardian" %>
|
<div class="form-row">
|
||||||
|
<%= form.text_field :guardian_address, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -336,12 +336,6 @@ en:
|
|||||||
person_last_name: Last name
|
person_last_name: Last name
|
||||||
person_name: Name
|
person_name: Name
|
||||||
person_phone: Phone number
|
person_phone: Phone number
|
||||||
guardian_address_city: Guardian city
|
|
||||||
guardian_address_country: Guardian country
|
|
||||||
guardian_address_state: Guardian state
|
|
||||||
guardian_address_street1: Guardian address
|
|
||||||
guardian_address_street2: Guardian address (Line 2)
|
|
||||||
guardian_address_zip: Guardian zip code
|
|
||||||
location_release:
|
location_release:
|
||||||
address_city: City
|
address_city: City
|
||||||
address_country: Country
|
address_country: Country
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ es:
|
|||||||
helpers:
|
helpers:
|
||||||
label:
|
label:
|
||||||
appearance_release:
|
appearance_release:
|
||||||
|
guardian_address: Dirección del tutor legal
|
||||||
guardian_name: Nómbre del tutor legal
|
guardian_name: Nómbre del tutor legal
|
||||||
guardian_phone: Número de teléfono del tutor legal
|
guardian_phone: Número de teléfono del tutor legal
|
||||||
minor: El firmante es un menor
|
minor: El firmante es un menor
|
||||||
@@ -122,12 +123,6 @@ es:
|
|||||||
person_email: Dirección de correo electrónico
|
person_email: Dirección de correo electrónico
|
||||||
person_name: Nómbre
|
person_name: Nómbre
|
||||||
person_phone: Número de teléfono
|
person_phone: Número de teléfono
|
||||||
guardian_address_city: Guardian city (ES)
|
|
||||||
guardian_address_country: Guardian country (ES)
|
|
||||||
guardian_address_state: Guardian state (ES)
|
|
||||||
guardian_address_street1: Dirección del tutor legal
|
|
||||||
guardian_address_street2: Dirección del tutor legal (Línea 2)
|
|
||||||
guardian_address_zip: Guardian zip code (ES)
|
|
||||||
project:
|
project:
|
||||||
client_name: Nómbre del cliente del proyecto
|
client_name: Nómbre del cliente del proyecto
|
||||||
description: Descripción del proyecto
|
description: Descripción del proyecto
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
class DestructureGuardianAddressColumnInAppearanceReleases < ActiveRecord::Migration[6.0]
|
|
||||||
def change
|
|
||||||
rename_column :appearance_releases, :guardian_address, :guardian_address_street1
|
|
||||||
add_column :appearance_releases, :guardian_address_street2, :string
|
|
||||||
add_column :appearance_releases, :guardian_address_city, :string
|
|
||||||
add_column :appearance_releases, :guardian_address_state, :string
|
|
||||||
add_column :appearance_releases, :guardian_address_zip, :string
|
|
||||||
add_column :appearance_releases, :guardian_address_country, :string
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -296,7 +296,7 @@ CREATE TABLE public.appearance_releases (
|
|||||||
created_at timestamp without time zone NOT NULL,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone NOT NULL,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
minor boolean DEFAULT false,
|
minor boolean DEFAULT false,
|
||||||
guardian_address_street1 character varying,
|
guardian_address character varying,
|
||||||
guardian_name_old character varying,
|
guardian_name_old character varying,
|
||||||
guardian_phone character varying,
|
guardian_phone character varying,
|
||||||
person_email character varying,
|
person_email character varying,
|
||||||
@@ -318,12 +318,7 @@ CREATE TABLE public.appearance_releases (
|
|||||||
guardian_first_name character varying,
|
guardian_first_name character varying,
|
||||||
guardian_last_name character varying,
|
guardian_last_name character varying,
|
||||||
identifier character varying,
|
identifier character varying,
|
||||||
guardian_email character varying,
|
guardian_email character varying
|
||||||
guardian_address_street2 character varying,
|
|
||||||
guardian_address_city character varying,
|
|
||||||
guardian_address_state character varying,
|
|
||||||
guardian_address_zip character varying,
|
|
||||||
guardian_address_country character varying
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -3659,7 +3654,6 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||||||
('20200610085411'),
|
('20200610085411'),
|
||||||
('20200610140459'),
|
('20200610140459'),
|
||||||
('20200612121539'),
|
('20200612121539'),
|
||||||
('20200615131722'),
|
('20200615131722');
|
||||||
('20200616124214');
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -265,9 +265,6 @@ RSpec.describe AppearanceReleasesController, tye: :controller do
|
|||||||
def minor_appearance_release_params
|
def minor_appearance_release_params
|
||||||
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo)
|
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo)
|
||||||
.except(:contract)
|
.except(:contract)
|
||||||
.except(:guardian_address_street2).except(:guardian_address_city)
|
|
||||||
.except(:guardian_address_state).except(:guardian_address_zip)
|
|
||||||
.except(:guardian_address_country)
|
|
||||||
.merge(contract_param, exploitable_rights_params)
|
.merge(contract_param, exploitable_rights_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -120,19 +120,7 @@ describe Public::AppearanceReleasesController do
|
|||||||
|
|
||||||
def minor_appearance_release_params(with_guardian_photo = true)
|
def minor_appearance_release_params(with_guardian_photo = true)
|
||||||
minor_type = with_guardian_photo ? :minor_with_guardian_photo : :minor
|
minor_type = with_guardian_photo ? :minor_with_guardian_photo : :minor
|
||||||
attributes_for(:appearance_release, minor_type)
|
attributes_for(:appearance_release, minor_type).merge(signature_param)
|
||||||
.merge(signature_param, guardian_address_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
def guardian_address_params
|
|
||||||
{
|
|
||||||
guardian_address_street1: "St1",
|
|
||||||
guardian_address_street2: "St2",
|
|
||||||
guardian_address_city: "City",
|
|
||||||
guardian_address_state: "State",
|
|
||||||
guardian_address_zip: "ZIP",
|
|
||||||
guardian_address_country: "Country"
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def signature_param
|
def signature_param
|
||||||
|
|||||||
@@ -31,12 +31,7 @@ FactoryBot.define do
|
|||||||
minor true
|
minor true
|
||||||
guardian_first_name "Jamie"
|
guardian_first_name "Jamie"
|
||||||
guardian_last_name "Doe"
|
guardian_last_name "Doe"
|
||||||
guardian_address_street1 "St1"
|
guardian_address "100 Test Lane, New York, 10001"
|
||||||
guardian_address_street2 "St2"
|
|
||||||
guardian_address_city "City"
|
|
||||||
guardian_address_state "State"
|
|
||||||
guardian_address_zip "ZIP"
|
|
||||||
guardian_address_country "Country"
|
|
||||||
guardian_phone "123-555-1234"
|
guardian_phone "123-555-1234"
|
||||||
guardian_email "guardian@galaxy.all"
|
guardian_email "guardian@galaxy.all"
|
||||||
end
|
end
|
||||||
@@ -45,14 +40,9 @@ FactoryBot.define do
|
|||||||
minor true
|
minor true
|
||||||
guardian_first_name "Jamie"
|
guardian_first_name "Jamie"
|
||||||
guardian_last_name "Doe"
|
guardian_last_name "Doe"
|
||||||
|
guardian_address "100 Test Lane, New York, 10001"
|
||||||
guardian_phone "123-555-1234"
|
guardian_phone "123-555-1234"
|
||||||
guardian_email "guardian@galaxy.all"
|
guardian_email "guardian@galaxy.all"
|
||||||
guardian_address_street1 "St1"
|
|
||||||
guardian_address_street2 "St2"
|
|
||||||
guardian_address_city "City"
|
|
||||||
guardian_address_state "State"
|
|
||||||
guardian_address_zip "ZIP"
|
|
||||||
guardian_address_country "Country"
|
|
||||||
guardian_photo do
|
guardian_photo do
|
||||||
path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg")
|
path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg")
|
||||||
Rack::Test::UploadedFile.new(path, "image/jpeg")
|
Rack::Test::UploadedFile.new(path, "image/jpeg")
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ FactoryBot.define do
|
|||||||
guardian_clause "Is the signer a minor?"
|
guardian_clause "Is the signer a minor?"
|
||||||
fee "$0.00"
|
fee "$0.00"
|
||||||
|
|
||||||
|
trait :archived do
|
||||||
|
archived_at Time.zone.now
|
||||||
|
end
|
||||||
|
|
||||||
factory :appearance_release_contract_template do
|
factory :appearance_release_contract_template do
|
||||||
release_type "appearance"
|
release_type "appearance"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ require 'rails_helper'
|
|||||||
RSpec.feature 'User manages contract templates', type: :feature do
|
RSpec.feature 'User manages contract templates', type: :feature do
|
||||||
let(:current_user) { create(:user, :manager) }
|
let(:current_user) { create(:user, :manager) }
|
||||||
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||||
|
let(:project2) { create(:project, members: current_user, account: current_user.primary_account, name: 'New project') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in(current_user)
|
sign_in(current_user)
|
||||||
@@ -191,6 +192,21 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
expect(page).not_to have_content('Test template')
|
expect(page).not_to have_content('Test template')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario 'archived contract templates from other projects are not shown when importing contract templates' do
|
||||||
|
create(:contract_template, :archived, project: project2, name: 'Archived template')
|
||||||
|
create(:contract_template, project: project2, name: 'Active template')
|
||||||
|
create(:contract_template, project: project)
|
||||||
|
|
||||||
|
visit project_contract_templates_path(project)
|
||||||
|
expect(page).to have_content('Test template')
|
||||||
|
|
||||||
|
click_on import_template_button
|
||||||
|
|
||||||
|
expect(page).not_to have_content('Test template')
|
||||||
|
expect(page).not_to have_content('Archived template')
|
||||||
|
expect(page).to have_content('Active template')
|
||||||
|
end
|
||||||
|
|
||||||
context 'When the user is associate' do
|
context 'When the user is associate' do
|
||||||
let(:current_user) { create(:user, :associate) }
|
let(:current_user) { create(:user, :associate) }
|
||||||
|
|
||||||
@@ -198,7 +214,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
visit project_contract_templates_path(project)
|
visit project_contract_templates_path(project)
|
||||||
|
|
||||||
expect(page).not_to have_content('Create New Release Template')
|
expect(page).not_to have_content('Create New Release Template')
|
||||||
expect(page).not_to have_content('Import Release Template')
|
expect(page).not_to have_content(import_template_button)
|
||||||
expect(page).not_to have_content('Delete')
|
expect(page).not_to have_content('Delete')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -218,6 +234,14 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def import_template_button
|
||||||
|
t 'contract_templates.index.actions.import'
|
||||||
|
end
|
||||||
|
|
||||||
|
def import_selected_templates_button
|
||||||
|
t 'release_template_imports.new.actions.import'
|
||||||
|
end
|
||||||
|
|
||||||
def preview_heading
|
def preview_heading
|
||||||
t 'blank_contracts.new.preview_heading'
|
t 'blank_contracts.new.preview_heading'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -54,11 +54,7 @@ describe ContractTemplatePreview do
|
|||||||
'person_phone' => '00 111 222 333 4444',
|
'person_phone' => '00 111 222 333 4444',
|
||||||
'updated_at' => nil,
|
'updated_at' => nil,
|
||||||
'minor' => true,
|
'minor' => true,
|
||||||
'guardian_address_street1' => 'Street 3',
|
'guardian_address' => 'Street 3, Street 4, City-2, State-2 112233, Country-2',
|
||||||
'guardian_address_street2' => 'Street 4',
|
|
||||||
'guardian_address_city' => 'City-2',
|
|
||||||
'guardian_address_state' => 'State-2',
|
|
||||||
'guardian_address_zip' => '112233',
|
|
||||||
"guardian_first_name" => nil,
|
"guardian_first_name" => nil,
|
||||||
"guardian_last_name" => nil,
|
"guardian_last_name" => nil,
|
||||||
"guardian_name_old" => nil,
|
"guardian_name_old" => nil,
|
||||||
|
|||||||
Reference in New Issue
Block a user