From a7b7e1ecf961c718b5013e07423f058b4b4dd0e2 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 4 Aug 2020 13:14:42 +0200 Subject: [PATCH 01/15] show owner info in material release table --- .../_material_release.html.erb | 3 +++ app/views/material_releases/index.html.erb | 4 ++-- config/locales/en.yml | 1 + config/locales/es.yml | 1 + db/structure.sql | 17 +++----------- spec/factories/material_releases.rb | 10 +++++++++ .../user_managing_material_releases_spec.rb | 22 +++++++++++++++++++ 7 files changed, 42 insertions(+), 16 deletions(-) diff --git a/app/views/material_releases/_material_release.html.erb b/app/views/material_releases/_material_release.html.erb index 1db1c17..44c1b00 100644 --- a/app/views/material_releases/_material_release.html.erb +++ b/app/views/material_releases/_material_release.html.erb @@ -18,6 +18,9 @@ <%= material_release.name %> + + <%= contact_info_for(material_release.contact_person) %> + <%= notes_preview material_release.notes.order_by_recent %> diff --git a/app/views/material_releases/index.html.erb b/app/views/material_releases/index.html.erb index bca39db..eaf63df 100644 --- a/app/views/material_releases/index.html.erb +++ b/app/views/material_releases/index.html.erb @@ -29,10 +29,10 @@ <%= t '.table_headers.approved'%> <%= MaterialRelease.human_attribute_name(:name) %> + <%= t(".table_headers.owner_info") %> <%= t(".table_headers.notes") %> <%= t(".table_headers.tags") %> - <%= t(".table_headers.signed_at") %> - + <%= t(".table_headers.signed_at") %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 77285d3..81afc75 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -903,6 +903,7 @@ en: approved: Approved name: Name notes: Notes + owner_info: Owner Info signed_at: Date Signed tags: Tags material_release: diff --git a/config/locales/es.yml b/config/locales/es.yml index b87f3aa..157f51f 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -436,6 +436,7 @@ es: table_headers: name: Name (ES) notes: Notes (ES) + owner_info: Owner Info signed_at: Date Signed (ES) tags: Tags (ES) medical_releases: diff --git a/db/structure.sql b/db/structure.sql index 6a85008..e62fb76 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -9,20 +9,6 @@ SET xmloption = content; SET client_min_messages = warning; SET row_security = off; --- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; - - -- -- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: - -- @@ -1479,6 +1465,7 @@ CREATE TABLE public.settings ( -- CREATE SEQUENCE public.settings_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1514,6 +1501,7 @@ CREATE TABLE public.taggings ( -- CREATE SEQUENCE public.taggings_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1544,6 +1532,7 @@ CREATE TABLE public.tags ( -- CREATE SEQUENCE public.tags_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE diff --git a/spec/factories/material_releases.rb b/spec/factories/material_releases.rb index 164979f..c5ebb17 100644 --- a/spec/factories/material_releases.rb +++ b/spec/factories/material_releases.rb @@ -4,10 +4,20 @@ FactoryBot.define do name "Test Materials" + trait :with_address do + person_address_street1 "St1" + person_address_street2 "St2" + person_address_city "City" + person_address_state "State" + person_address_zip "123" + person_address_country "US" + end + trait :native do person_first_name "Jane" person_last_name "Doe" person_phone "100-555-1001" + person_email "owner@email.com" signature do path = Rails.root.join("spec", "fixtures", "files", "signature.png") diff --git a/spec/features/user_managing_material_releases_spec.rb b/spec/features/user_managing_material_releases_spec.rb index b98f5d6..594d20a 100644 --- a/spec/features/user_managing_material_releases_spec.rb +++ b/spec/features/user_managing_material_releases_spec.rb @@ -185,6 +185,24 @@ feature "User managing material releases" do sign_in current_user end + scenario "index table shows owner info" do + release = create(:material_release, :native, :with_address, project: project) + + visit project_material_releases_path(project) + + expect(page).to have_content owner_info_table_header + + expect(page).to have_content release.person_first_name + expect(page).to have_content release.person_last_name + expect(page).to have_content release.person_phone + expect(page).to have_content release.person_email + expect(page).to have_content release.person_address_street1 + expect(page).to have_content release.person_address_city + expect(page).to have_content release.person_address_state + expect(page).to have_content release.person_address_zip + expect(page).to have_content release.person_address_country + end + scenario "creating a release for and adult", js: true do visit new_project_material_release_path(project) @@ -813,4 +831,8 @@ feature "User managing material releases" do def signature_field 'material_release_signature_base64' end + + def owner_info_table_header + t 'material_releases.index.table_headers.owner_info' + end end -- 2.47.3 From 0294a480eed10d589a44e7822897b4cbbb418f99 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 4 Aug 2020 15:08:19 +0200 Subject: [PATCH 02/15] show owner info in acquired media release table --- .../_acquired_media_release.html.erb | 3 +++ .../acquired_media_releases/index.html.erb | 1 + config/locales/en.yml | 1 + config/locales/es.yml | 1 + spec/factories/acquired_media_releases.rb | 16 ++++++++++++++ ...r_managing_acquired_media_releases_spec.rb | 22 +++++++++++++++++++ 6 files changed, 44 insertions(+) diff --git a/app/views/acquired_media_releases/_acquired_media_release.html.erb b/app/views/acquired_media_releases/_acquired_media_release.html.erb index 2ebcc67..ab0f400 100644 --- a/app/views/acquired_media_releases/_acquired_media_release.html.erb +++ b/app/views/acquired_media_releases/_acquired_media_release.html.erb @@ -18,6 +18,9 @@ <%= fa_icon("warning", text: t(".no_media"), class: "text-danger") %> <% end %> + + <%= contact_info_for(acquired_media_release.contact_person) %> + <%= notes_preview acquired_media_release.notes.order_by_recent %> diff --git a/app/views/acquired_media_releases/index.html.erb b/app/views/acquired_media_releases/index.html.erb index 3bbc09c..38c41dd 100644 --- a/app/views/acquired_media_releases/index.html.erb +++ b/app/views/acquired_media_releases/index.html.erb @@ -29,6 +29,7 @@ <%= t '.table_headers.approved'%> <%= AcquiredMediaRelease.human_attribute_name(:name) %> <%= t(".table_headers.file_infos_count") %> + <%= t(".table_headers.owner_info") %> <%= t(".table_headers.notes") %> <%= t(".table_headers.tags") %> <%= t(".table_headers.signed_at") %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 81afc75..88ac5c4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -67,6 +67,7 @@ en: notes: Notes signed_at: Date Signed tags: Tags + owner_info: Owner Info new: heading: Import Acquired Media Release update: diff --git a/config/locales/es.yml b/config/locales/es.yml index 157f51f..b17bf1e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -21,6 +21,7 @@ es: notes: Notes (ES) signed_at: Date Signed (ES) tags: Tags (ES) + owner_info: Owner Info (ES) activerecord: attributes: appearance_release: diff --git a/spec/factories/acquired_media_releases.rb b/spec/factories/acquired_media_releases.rb index 952f049..b45c57e 100644 --- a/spec/factories/acquired_media_releases.rb +++ b/spec/factories/acquired_media_releases.rb @@ -4,6 +4,22 @@ FactoryBot.define do name "Test Acquired Media Release" + trait :with_address do + person_address_street1 "St1" + person_address_street2 "St2" + person_address_city "City" + person_address_state "State" + person_address_zip "123" + person_address_country "US" + end + + trait :with_owner_info do + person_first_name "Jane" + person_last_name "Doe" + person_phone "100-555-1001" + person_email "owner@email.com" + end + trait :native do signature do path = Rails.root.join("spec", "fixtures", "files", "signature.png") diff --git a/spec/features/user_managing_acquired_media_releases_spec.rb b/spec/features/user_managing_acquired_media_releases_spec.rb index 61ac8c8..e40554d 100644 --- a/spec/features/user_managing_acquired_media_releases_spec.rb +++ b/spec/features/user_managing_acquired_media_releases_spec.rb @@ -165,6 +165,24 @@ feature "User managing acquired_media releases" do sign_in current_user end + scenario "index table shows owner info" do + release = create(:acquired_media_release, :with_owner_info, :with_address, project: project) + + visit project_acquired_media_releases_path(project) + + expect(page).to have_content owner_info_table_header + + expect(page).to have_content release.person_first_name + expect(page).to have_content release.person_last_name + expect(page).to have_content release.person_phone + expect(page).to have_content release.person_email + expect(page).to have_content release.person_address_street1 + expect(page).to have_content release.person_address_city + expect(page).to have_content release.person_address_state + expect(page).to have_content release.person_address_zip + expect(page).to have_content release.person_address_country + end + scenario "creating a release for an adult", js: true do visit new_project_acquired_media_release_path(project) @@ -836,4 +854,8 @@ feature "User managing acquired_media releases" do def successful_import_message t 'acquired_media_releases.create.notice' end + + def owner_info_table_header + t 'acquired_media_releases.index.table_headers.owner_info' + end end -- 2.47.3 From 580312bc52282adf14211fdc779ed0bdd3b24c10 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 4 Aug 2020 15:24:45 +0200 Subject: [PATCH 03/15] fix spec --- ...r_managing_acquired_media_releases_spec.rb | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/spec/features/user_managing_acquired_media_releases_spec.rb b/spec/features/user_managing_acquired_media_releases_spec.rb index e40554d..0d4484d 100644 --- a/spec/features/user_managing_acquired_media_releases_spec.rb +++ b/spec/features/user_managing_acquired_media_releases_spec.rb @@ -280,62 +280,63 @@ feature "User managing acquired_media releases" do end scenario "creating, updating, destroying a release", js: true do - release_data = { - name: "Test Acquired Media Release", - applicable_media: ApplicableMedium.last.label, - territory: Territory.last.label, - term: Term.last.label, - restriction: Restriction.first.label, - restriction_text: "Not available in China", - } + resize_window_to(1_000, 1_000) do + release_data = { + name: "Test Acquired Media Release", + applicable_media: ApplicableMedium.last.label, + territory: Territory.last.label, + term: Term.last.label, + restriction: Restriction.first.label, + restriction_text: "Not available in China", + } - sign_in current_user - visit new_project_acquired_media_release_path(project) + sign_in current_user + visit new_project_acquired_media_release_path(project) - by "attaching only a contract" do - attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false - click_button create_release_button + by "attaching only a contract" do + attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false + click_button create_release_button - expect(page).to have_invalid_field(acquired_media_name_field) - end - - by "attaching files" do - drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone" - click_button create_release_button - - expect(page).to have_invalid_field(acquired_media_name_field) - end - - by "filling out the remaining information" do - fill_in_release_fields release_data - click_button create_release_button - - expect(page).to have_content(create_release_notice) - expect(page).to have_content("1") - - click_on "Manage" - expect(page).to have_link("Download") - end - - it_also "updates an existing release" do - click_link "Edit" - - within ".dropzone" do - expect(page).to have_filename("video_file.mp4") + expect(page).to have_invalid_field(acquired_media_name_field) end - expect(page).to have_filled_in_data(release_data) + by "attaching files" do + drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone" + click_button create_release_button - fill_in_release_fields name: "New name" - drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone" - click_button update_release_button + expect(page).to have_invalid_field(acquired_media_name_field) + end - expect(page).to have_content(update_release_notice) - expect(page).to have_content("New name") - expect(page).to have_content("2") - end + by "filling out the remaining information" do + fill_in_release_fields release_data + click_button create_release_button - it_also "deletes an existing release" do + expect(page).to have_content(create_release_notice) + expect(page).to have_content("1") + + click_on "Manage" + expect(page).to have_link("Download") + end + + it_also "updates an existing release" do + click_link "Edit" + + within ".dropzone" do + expect(page).to have_filename("video_file.mp4") + end + + expect(page).to have_filled_in_data(release_data) + + fill_in_release_fields name: "New name" + drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone" + click_button update_release_button + + expect(page).to have_content(update_release_notice) + expect(page).to have_content("New name") + expect(page).to have_content("2") + end + + it_also "deletes an existing release" do click_button "Manage" accept_alert do click_link "Delete" @@ -343,6 +344,7 @@ feature "User managing acquired_media releases" do expect(page).not_to have_content("New name") end + end end scenario "viewing the contract PDF for an adult" do -- 2.47.3 From 56d73d98446ed3c36064b47723725a68ab875c00 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 12:58:30 +0200 Subject: [PATCH 04/15] improve spec --- spec/jobs/generate_contracts_zip_job_spec.rb | 116 +++++++++++++------ 1 file changed, 80 insertions(+), 36 deletions(-) diff --git a/spec/jobs/generate_contracts_zip_job_spec.rb b/spec/jobs/generate_contracts_zip_job_spec.rb index 3d3ee5f..68bf43e 100644 --- a/spec/jobs/generate_contracts_zip_job_spec.rb +++ b/spec/jobs/generate_contracts_zip_job_spec.rb @@ -25,6 +25,31 @@ describe GenerateContractsZipJob do end describe ".perform_now" do + shared_examples "generates ZIP containig CSV file with all releases data" do + it "generates ZIP containing CSV file with all releases data for all release types" do + lowercase_plural = subject.constantize.model_name.plural + GenerateContractsZipJob.perform_now(project, download, subject, project.public_send(lowercase_plural).ids) + + generated_zip = download.file.blob.download + csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv" + Zip::InputStream.open(StringIO.new(generated_zip)) do |io| + while entry = io.get_next_entry + next unless entry.name == csv_file_name + + csv_file = entry.get_input_stream.read + + release_class = Object.const_get subject + release_headers = release_class.csv_headers + + release_headers.each do |header| + expect(csv_file).to match header + expect(csv_file).not_to match translation_missing + end + end + end + end + end + it "updates a download record and creates attachment for it" do GenerateContractsZipJob.perform_now(project, download, "AppearanceRelease", project.appearance_releases.ids) @@ -35,36 +60,60 @@ describe GenerateContractsZipJob do expect(download.file).to be_attached end - it "generates ZIP containing CSV file with all releases data for all release types" do - release_types = %w[AcquiredMediaRelease AppearanceRelease LocationRelease MaterialRelease MedicalRelease MiscRelease MusicRelease TalentRelease] - create_releases_for_all_types + context "generates ZIP for acquired media releases" do + let(:release) { create(:acquired_media_release_with_contract_template, :native, project: project) } + subject { 'AcquiredMediaRelease' } - release_types.each do |type| - lowercase_plural = type.constantize.model_name.plural - GenerateContractsZipJob.perform_now(project, download, type, project.public_send(lowercase_plural).ids) + it_behaves_like "generates ZIP containig CSV file with all releases data" + end - generated_zip = download.file.blob.download - csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv" - Zip::InputStream.open(StringIO.new(generated_zip)) do |io| - while entry = io.get_next_entry - next unless entry.name == csv_file_name + context "generates ZIP for appearance releases" do + let(:release) { create(:appearance_release_with_contract_template, :native, project: project, person_name: "John Doe") } + subject { 'AppearanceRelease' } - csv_file = entry.get_input_stream.read + it_behaves_like "generates ZIP containig CSV file with all releases data" + end - release_class = Object.const_get type - release_headers = release_class.csv_headers + context "generates ZIP for location releases" do + let(:release) { create(:location_release_with_contract_template, :native, project: project) } + subject { 'LocationRelease' } - release_headers.each do |header| - expect(csv_file).to match header - end - end + it_behaves_like "generates ZIP containig CSV file with all releases data" + end - dummy_zip_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.zip" - if File.exist?(file_fixture(dummy_zip_file_name)) - File.delete(file_fixture(dummy_zip_file_name)) - end - end - end + context "generates ZIP for material releases" do + let(:release) { create(:material_release_with_contract_template, :native, project: project) } + subject { 'MaterialRelease' } + + it_behaves_like "generates ZIP containig CSV file with all releases data" + end + + context "generates ZIP for medical releases" do + let(:release) { create(:medical_release_with_contract_template, :native, project: project) } + subject { 'MedicalRelease' } + + it_behaves_like "generates ZIP containig CSV file with all releases data" + end + + context "generates ZIP for misc releases" do + let(:release) { create(:misc_release_with_contract_template, :native, project: project) } + subject { 'MiscRelease' } + + it_behaves_like "generates ZIP containig CSV file with all releases data" + end + + context "generates ZIP for music releases" do + let(:release) { create(:music_release_with_contract_template, project: project) } + subject { 'MusicRelease' } + + it_behaves_like "generates ZIP containig CSV file with all releases data" + end + + context "generates ZIP for talent releases" do + let(:release) { create(:talent_release_with_contract_template, :native, project: project) } + subject { 'TalentRelease' } + + it_behaves_like "generates ZIP containig CSV file with all releases data" end context "When there are errors" do @@ -88,21 +137,16 @@ describe GenerateContractsZipJob do # Delete the file created in fixture. # Or the tests will fail on next run due to already existing files in existing zip. path = Rails.root.join("spec", "fixtures", "files") - if File.exists? "#{path}/my-video-project_appearance-releases.zip" - File.delete("#{path}/my-video-project_appearance-releases.zip") + releases = %w[acquired-media appearance location material medical misc music talent] + releases.each do |release| + if File.exists? "#{path}/my-video-project_#{release}-releases.zip" + File.delete("#{path}/my-video-project_#{release}-releases.zip") + end end end private - - def create_releases_for_all_types - create(:acquired_media_release_with_contract_template, :native, project: project) - create(:appearance_release_with_contract_template, :native, project: project, person_name: "John Doe") - create(:location_release_with_contract_template, :native, project: project) - create(:material_release_with_contract_template, :native, project: project) - create(:medical_release_with_contract_template, :native, project: project) - create(:misc_release_with_contract_template, :native, project: project) - create(:music_release_with_contract_template, project: project) - create(:talent_release_with_contract_template, :native, project: project) + def translation_missing + /translation missing/ end end -- 2.47.3 From 708cc5e0a8d35c986a43578dd9e78bc61d54a5dd Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 14:32:53 +0200 Subject: [PATCH 05/15] fix location release CSV export --- app/models/concerns/csv_exportable.rb | 11 ++++++----- app/models/location_release.rb | 18 +++++++++++++++++- config/locales/en.yml | 4 ++++ config/locales/es.yml | 5 +++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/app/models/concerns/csv_exportable.rb b/app/models/concerns/csv_exportable.rb index 3b03f59..4936842 100644 --- a/app/models/concerns/csv_exportable.rb +++ b/app/models/concerns/csv_exportable.rb @@ -3,7 +3,7 @@ module CsvExportable extend ActiveSupport::Concern - COMMON_HEADERS = %i[approved? notes tags signed_at].freeze + COMMON_HEADERS = %i[notes tags signed_at].freeze COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze included do @@ -29,11 +29,12 @@ module CsvExportable private - def contact_info + def contact_info(name: nil, address: nil, phone: nil, email: nil) contact_info = '' - contact_info += "#{person_address}; " if person_address.present? - contact_info += "P: #{person_phone}; " if person_phone.present? - contact_info += "E: #{person_email}" if person_email.present? + contact_info += "#{name}; " if name.present? + contact_info += "#{address}; " if address.present? + contact_info += "P: #{phone}; " if phone.present? + contact_info += "E: #{email}" if email.present? contact_info.delete_suffix '; ' end diff --git a/app/models/location_release.rb b/app/models/location_release.rb index 266ea07..3340fd5 100644 --- a/app/models/location_release.rb +++ b/app/models/location_release.rb @@ -16,7 +16,7 @@ class LocationRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name address] + %i[approved? location_info owner_info amendment_signed_column] end end @@ -67,6 +67,22 @@ class LocationRelease < ApplicationRecord true end + def location_info + contact_info(name: name, address: address) + end + + def owner_info + contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email) + end + + def amendment_signed_column + if amendment_signable? + amendment_signed? + else + I18n.t('location_releases.csv.no_amendment_clause') + end + end + private def end_date_after_start_date diff --git a/config/locales/en.yml b/config/locales/en.yml index 88ac5c4..b8724cb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -850,7 +850,9 @@ en: empty: Location Releases will appear here table_headers: amendment_signed: Amendment + amendment_signed_column: Amendment approved: Approved + approved?: Approved location_info: Location Info notes: Notes owner_info: Owner Info @@ -870,6 +872,8 @@ en: heading: Import Location Release update: notice: The location release has been updated + csv: + no_amendment_clause: No amendment clause material_releases: create: notice: The material release has been created diff --git a/config/locales/es.yml b/config/locales/es.yml index b17bf1e..5f71cfc 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -410,15 +410,20 @@ es: table_headers: address: Address (ES) amendment_signed: Amendment (ES) + amendment_signed_column: Amendment signed (ES) notes: Notes (ES) signed_at: Date Signed (ES) tags: Tags (ES) + approved: Approved (ES) + approved?: Approved (ES) location_release: actions: sign_amendment: Sign Amendment (ES) messages: amendment_not_signed_tooltip: Amendment not yet signed (ES) amendment_signed_tooltip: Amendment Signed (ES) + csv: + no_amendment_clause: No amendment clause (ES) material_releases: create: notice: The acquired media release has been created (ES) -- 2.47.3 From 6378d45274ccaa0a55c1867e522304cf245aa99a Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 14:50:58 +0200 Subject: [PATCH 06/15] fix acq.media release CSV export --- app/models/acquired_media_release.rb | 2 +- app/models/concerns/csv_exportable.rb | 3 +++ app/models/location_release.rb | 4 ---- config/locales/en.yml | 1 + config/locales/es.yml | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/acquired_media_release.rb b/app/models/acquired_media_release.rb index 0c6d2cf..5593c03 100644 --- a/app/models/acquired_media_release.rb +++ b/app/models/acquired_media_release.rb @@ -18,7 +18,7 @@ class AcquiredMediaRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name file_infos_count] + %i[approved? name file_infos_count owner_info] end end diff --git a/app/models/concerns/csv_exportable.rb b/app/models/concerns/csv_exportable.rb index 4936842..7709d8f 100644 --- a/app/models/concerns/csv_exportable.rb +++ b/app/models/concerns/csv_exportable.rb @@ -28,6 +28,9 @@ module CsvExportable end private + def owner_info + contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email) + end def contact_info(name: nil, address: nil, phone: nil, email: nil) contact_info = '' diff --git a/app/models/location_release.rb b/app/models/location_release.rb index 3340fd5..ea83ddb 100644 --- a/app/models/location_release.rb +++ b/app/models/location_release.rb @@ -71,10 +71,6 @@ class LocationRelease < ApplicationRecord contact_info(name: name, address: address) end - def owner_info - contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email) - end - def amendment_signed_column if amendment_signable? amendment_signed? diff --git a/config/locales/en.yml b/config/locales/en.yml index b8724cb..21c983a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -62,6 +62,7 @@ en: empty: Acquired Media Releases will appear here table_headers: approved: Approved + approved?: Approved file_infos_count: No. Files name: Name notes: Notes diff --git a/config/locales/es.yml b/config/locales/es.yml index 5f71cfc..483a5d8 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -22,6 +22,7 @@ es: signed_at: Date Signed (ES) tags: Tags (ES) owner_info: Owner Info (ES) + approved: Appproved? activerecord: attributes: appearance_release: -- 2.47.3 From fd7357045c09d681c0580f4c36dd3adc1734db9b Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:04:47 +0200 Subject: [PATCH 07/15] fix location release CSV export --- app/models/location_release.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/location_release.rb b/app/models/location_release.rb index ea83ddb..b3825c1 100644 --- a/app/models/location_release.rb +++ b/app/models/location_release.rb @@ -68,7 +68,7 @@ class LocationRelease < ApplicationRecord end def location_info - contact_info(name: name, address: address) + compact_contact_info(name: name, address: address) end def amendment_signed_column -- 2.47.3 From 088994b90ccd2a9414f06a2c6a5fc7f279aff489 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:12:39 +0200 Subject: [PATCH 08/15] fix appearance release CSV export --- app/models/appearance_release.rb | 2 +- app/models/concerns/csv_exportable.rb | 9 +++++++-- config/locales/en.yml | 1 + config/locales/es.yml | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/models/appearance_release.rb b/app/models/appearance_release.rb index 00576e1..324296e 100644 --- a/app/models/appearance_release.rb +++ b/app/models/appearance_release.rb @@ -20,7 +20,7 @@ class AppearanceRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name contact_info] + %i[approved? name contact_info] end end diff --git a/app/models/concerns/csv_exportable.rb b/app/models/concerns/csv_exportable.rb index 7709d8f..4bf3704 100644 --- a/app/models/concerns/csv_exportable.rb +++ b/app/models/concerns/csv_exportable.rb @@ -28,11 +28,16 @@ module CsvExportable end private + def owner_info - contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email) + compact_contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email) end - def contact_info(name: nil, address: nil, phone: nil, email: nil) + def contact_info + owner_info + end + + def compact_contact_info(name: nil, address: nil, phone: nil, email: nil) contact_info = '' contact_info += "#{name}; " if name.present? contact_info += "#{address}; " if address.present? diff --git a/config/locales/en.yml b/config/locales/en.yml index 21c983a..13a9701 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -176,6 +176,7 @@ en: imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release table_headers: approved: Approved + approved?: Approved contact_info: Contact info name: Name notes: Notes diff --git a/config/locales/es.yml b/config/locales/es.yml index 483a5d8..3486cb5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -71,6 +71,8 @@ es: notes: "" signed_at: "" tags: "" + approved: Approved (ES) + approved?: Approved (ES) shared: imported_appearance_release_contract_name: Contrato Importado imported_appearance_release_headshot_name: Retrato Importado -- 2.47.3 From 78d182624d091b6a7454fb4be8b03c3f316a160d Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:16:00 +0200 Subject: [PATCH 09/15] fix material release CSV export --- app/models/material_release.rb | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/material_release.rb b/app/models/material_release.rb index 258a33a..d72a299 100644 --- a/app/models/material_release.rb +++ b/app/models/material_release.rb @@ -20,7 +20,7 @@ class MaterialRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name] + %i[approved? name owner_info] end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 13a9701..355a5cd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -908,6 +908,7 @@ en: empty: Material Releases will appear here table_headers: approved: Approved + approved?: Approved name: Name notes: Notes owner_info: Owner Info diff --git a/config/locales/es.yml b/config/locales/es.yml index 3486cb5..94c9256 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -448,6 +448,8 @@ es: owner_info: Owner Info signed_at: Date Signed (ES) tags: Tags (ES) + approved: Approved (ES) + approved?: Approved (ES) medical_releases: custom_validation_errors: question_answer_is_required: answer is required (ES) -- 2.47.3 From 6267f12cc48415ede620e0a0719491d43c764cae Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:19:01 +0200 Subject: [PATCH 10/15] fix medical release CSV export --- app/models/medical_release.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/medical_release.rb b/app/models/medical_release.rb index 6e12549..0a1206b 100644 --- a/app/models/medical_release.rb +++ b/app/models/medical_release.rb @@ -16,7 +16,7 @@ class MedicalRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name contact_info] + %i[approved? name contact_info] end end -- 2.47.3 From 3242bebd6accebc57ea783f3d79442b6b47abec3 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:22:04 +0200 Subject: [PATCH 11/15] fix misc release CSV export --- app/models/misc_release.rb | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/misc_release.rb b/app/models/misc_release.rb index f59dbec..d7a3d46 100644 --- a/app/models/misc_release.rb +++ b/app/models/misc_release.rb @@ -14,7 +14,7 @@ class MiscRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name contact_info] + %i[approved? name contact_info] end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 355a5cd..81d1c36 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -957,6 +957,7 @@ en: empty: Misc Releases will appear here table_headers: approved: Approved + approved?: Approved contact_info: Contact info name: Person name notes: Notes diff --git a/config/locales/es.yml b/config/locales/es.yml index 94c9256..5902dab 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -475,6 +475,8 @@ es: notes: Notes (ES) signed_at: Date Signed (ES) tags: Tags (ES) + approved: Approved (ES) + approved?: Approved (ES) music_releases: index: table_headers: -- 2.47.3 From d1aa103d9c4eacaf38edbc8eb96d4e52604d0730 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:24:57 +0200 Subject: [PATCH 12/15] fix music release CSV export --- app/models/music_release.rb | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/music_release.rb b/app/models/music_release.rb index 9c8454e..8965fc0 100644 --- a/app/models/music_release.rb +++ b/app/models/music_release.rb @@ -12,7 +12,7 @@ class MusicRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name file_infos_count composers_count publishers_count] + %i[approved? name file_infos_count composers_count publishers_count] end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 81d1c36..09d7b95 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -996,6 +996,7 @@ en: empty: Music Releases will appear here table_headers: approved: Approved + approved?: Approved composers_count: No. Composers file_infos_count: No. Files name: Name diff --git a/config/locales/es.yml b/config/locales/es.yml index 5902dab..fc94150 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -487,6 +487,8 @@ es: publishers_count: No. Publishers (ES) signed_at: Date Signed (ES) tags: Tags (ES) + approved: Approved (ES) + approved?: Approved (ES) public: acquired_media_releases: new: -- 2.47.3 From 7e571845d8f426f6f44d20ac9a3dfe42b7c1f2b8 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:35:19 +0200 Subject: [PATCH 13/15] fix talent release CSV export --- app/models/talent_release.rb | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/talent_release.rb b/app/models/talent_release.rb index ddf4246..5580c68 100644 --- a/app/models/talent_release.rb +++ b/app/models/talent_release.rb @@ -19,7 +19,7 @@ class TalentRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[name phone email] + %i[approved? name phone email] end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 09d7b95..33c9bdf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1456,6 +1456,7 @@ en: empty: Talent Releases will appear here table_headers: approved: Approved + approved?: Approved email: Email name: Name notes: Notes diff --git a/config/locales/es.yml b/config/locales/es.yml index fc94150..e889dc3 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -649,6 +649,8 @@ es: phone: Phone (ES) signed_at: Date Signed (ES) tags: Tags (ES) + approved: Approved (ES) + approved?: Approved (ES) task_requests: create: success_message: Your task request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds. (ES) -- 2.47.3 From a8944c6c4a91f3743c57ab321e6802c7eb676fe9 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:37:58 +0200 Subject: [PATCH 14/15] fix localizations --- config/locales/en.yml | 6 +++--- config/locales/es.yml | 33 +++++++++++++++++---------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 33c9bdf..480a5ce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -66,9 +66,9 @@ en: file_infos_count: No. Files name: Name notes: Notes + owner_info: Owner Info signed_at: Date Signed tags: Tags - owner_info: Owner Info new: heading: Import Acquired Media Release update: @@ -829,6 +829,8 @@ en: location_releases: create: notice: The location release has been created + csv: + no_amendment_clause: No amendment clause destroy: alert: The location release has been deleted edit: @@ -874,8 +876,6 @@ en: heading: Import Location Release update: notice: The location release has been updated - csv: - no_amendment_clause: No amendment clause material_releases: create: notice: The material release has been created diff --git a/config/locales/es.yml b/config/locales/es.yml index e889dc3..3ee1982 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -16,13 +16,14 @@ es: heading: Guardian Photo index: table_headers: + approved: Appproved (ES) + approved?: Appproved (ES) file_infos_count: No. Files (ES) name: Name (ES) notes: Notes (ES) + owner_info: Owner Info (ES) signed_at: Date Signed (ES) tags: Tags (ES) - owner_info: Owner Info (ES) - approved: Appproved? activerecord: attributes: appearance_release: @@ -66,13 +67,13 @@ es: index: imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release (ES) table_headers: + approved: Approved (ES) + approved?: Approved (ES) contact_info: "" name: "" notes: "" signed_at: "" tags: "" - approved: Approved (ES) - approved?: Approved (ES) shared: imported_appearance_release_contract_name: Contrato Importado imported_appearance_release_headshot_name: Retrato Importado @@ -406,6 +407,8 @@ es: update: Approve (ES) update: 'Actualizar %{model}' location_releases: + csv: + no_amendment_clause: No amendment clause (ES) form: photos: dropzone_label: Tap to take a photo of the Property (optional) (ES) @@ -414,19 +417,17 @@ es: address: Address (ES) amendment_signed: Amendment (ES) amendment_signed_column: Amendment signed (ES) + approved: Approved (ES) + approved?: Approved (ES) notes: Notes (ES) signed_at: Date Signed (ES) tags: Tags (ES) - approved: Approved (ES) - approved?: Approved (ES) location_release: actions: sign_amendment: Sign Amendment (ES) messages: amendment_not_signed_tooltip: Amendment not yet signed (ES) amendment_signed_tooltip: Amendment Signed (ES) - csv: - no_amendment_clause: No amendment clause (ES) material_releases: create: notice: The acquired media release has been created (ES) @@ -443,13 +444,13 @@ es: heading: Guardian Photo index: table_headers: + approved: Approved (ES) + approved?: Approved (ES) name: Name (ES) notes: Notes (ES) owner_info: Owner Info signed_at: Date Signed (ES) tags: Tags (ES) - approved: Approved (ES) - approved?: Approved (ES) medical_releases: custom_validation_errors: question_answer_is_required: answer is required (ES) @@ -470,16 +471,18 @@ es: misc_releases: index: table_headers: + approved: Approved (ES) + approved?: Approved (ES) contact_info: Contact info (ES) name: Person name (ES) notes: Notes (ES) signed_at: Date Signed (ES) tags: Tags (ES) - approved: Approved (ES) - approved?: Approved (ES) music_releases: index: table_headers: + approved: Approved (ES) + approved?: Approved (ES) composers_count: No. Composers (ES) file_infos_count: No. Files (ES) name: Name (ES) @@ -487,8 +490,6 @@ es: publishers_count: No. Publishers (ES) signed_at: Date Signed (ES) tags: Tags (ES) - approved: Approved (ES) - approved?: Approved (ES) public: acquired_media_releases: new: @@ -643,14 +644,14 @@ es: heading: Guardian Photo (ES) index: table_headers: + approved: Approved (ES) + approved?: Approved (ES) email: Email (ES) name: Name (ES) notes: Notes (ES) phone: Phone (ES) signed_at: Date Signed (ES) tags: Tags (ES) - approved: Approved (ES) - approved?: Approved (ES) task_requests: create: success_message: Your task request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds. (ES) -- 2.47.3 From 4d83cff8d2c8c378c51324ab01e6b76ea24818c3 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 5 Aug 2020 15:43:45 +0200 Subject: [PATCH 15/15] move approved column to common headers --- app/models/acquired_media_release.rb | 2 +- app/models/appearance_release.rb | 2 +- app/models/concerns/csv_exportable.rb | 4 ++-- app/models/location_release.rb | 2 +- app/models/material_release.rb | 2 +- app/models/medical_release.rb | 2 +- app/models/misc_release.rb | 2 +- app/models/music_release.rb | 2 +- app/models/talent_release.rb | 2 +- config/locales/en.yml | 8 -------- config/locales/es.yml | 8 -------- 11 files changed, 10 insertions(+), 26 deletions(-) diff --git a/app/models/acquired_media_release.rb b/app/models/acquired_media_release.rb index 5593c03..d7519fc 100644 --- a/app/models/acquired_media_release.rb +++ b/app/models/acquired_media_release.rb @@ -18,7 +18,7 @@ class AcquiredMediaRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name file_infos_count owner_info] + %i[name file_infos_count owner_info] end end diff --git a/app/models/appearance_release.rb b/app/models/appearance_release.rb index 324296e..00576e1 100644 --- a/app/models/appearance_release.rb +++ b/app/models/appearance_release.rb @@ -20,7 +20,7 @@ class AppearanceRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name contact_info] + %i[name contact_info] end end diff --git a/app/models/concerns/csv_exportable.rb b/app/models/concerns/csv_exportable.rb index 4bf3704..69ac758 100644 --- a/app/models/concerns/csv_exportable.rb +++ b/app/models/concerns/csv_exportable.rb @@ -3,8 +3,8 @@ module CsvExportable extend ActiveSupport::Concern - COMMON_HEADERS = %i[notes tags signed_at].freeze - COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze + COMMON_HEADERS = %i[approved notes tags signed_at].freeze + COMMON_VALUES = %w[approved? clean_notes clean_tags signed_on].freeze included do class << self diff --git a/app/models/location_release.rb b/app/models/location_release.rb index b3825c1..fa17056 100644 --- a/app/models/location_release.rb +++ b/app/models/location_release.rb @@ -16,7 +16,7 @@ class LocationRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? location_info owner_info amendment_signed_column] + %i[location_info owner_info amendment_signed_column] end end diff --git a/app/models/material_release.rb b/app/models/material_release.rb index d72a299..4e41649 100644 --- a/app/models/material_release.rb +++ b/app/models/material_release.rb @@ -20,7 +20,7 @@ class MaterialRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name owner_info] + %i[name owner_info] end end diff --git a/app/models/medical_release.rb b/app/models/medical_release.rb index 0a1206b..6e12549 100644 --- a/app/models/medical_release.rb +++ b/app/models/medical_release.rb @@ -16,7 +16,7 @@ class MedicalRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name contact_info] + %i[name contact_info] end end diff --git a/app/models/misc_release.rb b/app/models/misc_release.rb index d7a3d46..f59dbec 100644 --- a/app/models/misc_release.rb +++ b/app/models/misc_release.rb @@ -14,7 +14,7 @@ class MiscRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name contact_info] + %i[name contact_info] end end diff --git a/app/models/music_release.rb b/app/models/music_release.rb index 8965fc0..9c8454e 100644 --- a/app/models/music_release.rb +++ b/app/models/music_release.rb @@ -12,7 +12,7 @@ class MusicRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name file_infos_count composers_count publishers_count] + %i[name file_infos_count composers_count publishers_count] end end diff --git a/app/models/talent_release.rb b/app/models/talent_release.rb index 5580c68..ddf4246 100644 --- a/app/models/talent_release.rb +++ b/app/models/talent_release.rb @@ -19,7 +19,7 @@ class TalentRelease < ApplicationRecord class << self def custom_csv_exportable_headers - %i[approved? name phone email] + %i[name phone email] end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 480a5ce..955a672 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -62,7 +62,6 @@ en: empty: Acquired Media Releases will appear here table_headers: approved: Approved - approved?: Approved file_infos_count: No. Files name: Name notes: Notes @@ -176,7 +175,6 @@ en: imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release table_headers: approved: Approved - approved?: Approved contact_info: Contact info name: Name notes: Notes @@ -856,7 +854,6 @@ en: amendment_signed: Amendment amendment_signed_column: Amendment approved: Approved - approved?: Approved location_info: Location Info notes: Notes owner_info: Owner Info @@ -908,7 +905,6 @@ en: empty: Material Releases will appear here table_headers: approved: Approved - approved?: Approved name: Name notes: Notes owner_info: Owner Info @@ -936,7 +932,6 @@ en: empty: Medical releases will appear here table_headers: approved: Approved - approved?: Approved contact_info: Contact info name: Person name notes: Notes @@ -957,7 +952,6 @@ en: empty: Misc Releases will appear here table_headers: approved: Approved - approved?: Approved contact_info: Contact info name: Person name notes: Notes @@ -996,7 +990,6 @@ en: empty: Music Releases will appear here table_headers: approved: Approved - approved?: Approved composers_count: No. Composers file_infos_count: No. Files name: Name @@ -1456,7 +1449,6 @@ en: empty: Talent Releases will appear here table_headers: approved: Approved - approved?: Approved email: Email name: Name notes: Notes diff --git a/config/locales/es.yml b/config/locales/es.yml index 3ee1982..2df8430 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -17,7 +17,6 @@ es: index: table_headers: approved: Appproved (ES) - approved?: Appproved (ES) file_infos_count: No. Files (ES) name: Name (ES) notes: Notes (ES) @@ -68,7 +67,6 @@ es: imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release (ES) table_headers: approved: Approved (ES) - approved?: Approved (ES) contact_info: "" name: "" notes: "" @@ -418,7 +416,6 @@ es: amendment_signed: Amendment (ES) amendment_signed_column: Amendment signed (ES) approved: Approved (ES) - approved?: Approved (ES) notes: Notes (ES) signed_at: Date Signed (ES) tags: Tags (ES) @@ -445,7 +442,6 @@ es: index: table_headers: approved: Approved (ES) - approved?: Approved (ES) name: Name (ES) notes: Notes (ES) owner_info: Owner Info @@ -457,7 +453,6 @@ es: index: table_headers: approved: Approved (ES) - approved?: Approved (ES) contact_info: Contact info (ES) name: Person name (ES) notes: Notes (ES) @@ -472,7 +467,6 @@ es: index: table_headers: approved: Approved (ES) - approved?: Approved (ES) contact_info: Contact info (ES) name: Person name (ES) notes: Notes (ES) @@ -482,7 +476,6 @@ es: index: table_headers: approved: Approved (ES) - approved?: Approved (ES) composers_count: No. Composers (ES) file_infos_count: No. Files (ES) name: Name (ES) @@ -645,7 +638,6 @@ es: index: table_headers: approved: Approved (ES) - approved?: Approved (ES) email: Email (ES) name: Name (ES) notes: Notes (ES) -- 2.47.3