From a7b7e1ecf961c718b5013e07423f058b4b4dd0e2 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 4 Aug 2020 13:14:42 +0200 Subject: [PATCH] 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