Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def cx_collection_permissions?(cx_collection:)
return false if cx_collection.blank?
return true if performance_manager_permissions?

cx_collection.organization == current_user.organization
cx_collection.organization == current_user.organization ||
cx_collection.organization == (current_user.organization.parent ? current_user.organization.parent : nil)
end

helper_method :website_permissions?
Expand Down
4 changes: 3 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ def organization_abbreviation_dropdown_options
end

def us_timezones
us_timezones = ActiveSupport::TimeZone["Eastern Time (US & Canada)"],
[
ActiveSupport::TimeZone["Eastern Time (US & Canada)"],
ActiveSupport::TimeZone["Central Time (US & Canada)"],
ActiveSupport::TimeZone["Mountain Time (US & Canada)"],
ActiveSupport::TimeZone["Pacific Time (US & Canada)"],
ActiveSupport::TimeZone["Hawaii"]
]
end

def hisp_questions_key
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ en-US:
- Fri
- Sat
abbr_month_names:
-
- Jan
- Feb
- Mar
Expand All @@ -34,6 +35,7 @@ en-US:
long: "%B %d, %Y"
short: "%b %d"
month_names:
-
- January
- February
- March
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ en-US:
pm: pm
date:
abbr_month_names:
-
- Jan
- Feb
- Mar
Expand All @@ -69,6 +70,7 @@ en-US:
- Nov
- Dec
month_names:
-
- January
- February
- March
Expand Down
2 changes: 2 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ es:
- vie
- sáb
abbr_month_names:
-
- ene
- feb
- mar
Expand All @@ -93,6 +94,7 @@ es:
with_timezone: "%-d de %B de %Y (UTC%:z)"
short: "%-d de %b"
month_names:
-
- enero
- febrero
- marzo
Expand Down
2 changes: 2 additions & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ zh-CN:
- 周五
- 周六
abbr_month_names:
-
- 1月
- 2月
- 3月
Expand All @@ -113,6 +114,7 @@ zh-CN:
with_timezone: "%Y年%m月%d日 (%:z)"
short: "%m月%d日"
month_names:
-
- 一月
- 二月
- 三月
Expand Down
8 changes: 8 additions & 0 deletions spec/factories/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
url { 'https://example.gov' }
notes { 'Notes about this Organization' }

trait :parent do
name { 'Parent.gov' }
domain { 'parent.gov' }
abbreviation { 'PO' }
url { 'https://parent.gov' }
notes { 'Notes about parent Organization' }
end

trait :another do
name { 'Another.gov' }
domain { 'another.gov' }
Expand Down
16 changes: 12 additions & 4 deletions spec/features/admin/cx_collections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

feature 'CX Data Collections', js: true do
let(:organization) { FactoryBot.create(:organization) }
let(:another_organization) { FactoryBot.create(:organization, :another) }
let(:parent_organization) { FactoryBot.create(:organization, :parent ) }
let!(:parent_service_provider) { FactoryBot.create(:service_provider, organization: parent_organization, name: 'Parent HISP') }
let(:another_organization) { FactoryBot.create(:organization, :another, parent_id: parent_organization.id) }
let!(:another_service_provider) { FactoryBot.create(:service_provider, organization: another_organization, name: 'Another HISP') }
let(:admin) { FactoryBot.create(:user, :admin, organization:) }
let(:user) { FactoryBot.create(:user, organization: another_organization) }
let!(:service_provider) { FactoryBot.create(:service_provider, organization:) }
let!(:service) { FactoryBot.create(:service, organization:, service_provider: service_provider, hisp: true, service_owner_id: user.id) }

let!(:service_provider2) { FactoryBot.create(:service_provider, organization:, name: "Another service provider") }
let!(:service2) { FactoryBot.create(:service, organization:, service_provider: service_provider2, name: "Another public service", hisp: true, service_owner_id: user.id) }

Expand Down Expand Up @@ -169,11 +170,18 @@
end

describe 'GET /show' do
let(:collection) { FactoryBot.create(:collection, organization: another_organization, user:, service_provider: another_service_provider) }
let!(:parent_collection) { FactoryBot.create(:cx_collection, organization: parent_organization, user:, service_provider: parent_service_provider, service: service) }

it 'renders a successful response' do
it 'renders CX Collection for Another org' do
visit admin_cx_collection_path(cx_collection)
expect(page).to have_content('Data Collections')
expect(page).to have_content('Another.gov')
end

it 'renders CX Collection for Parent org' do
visit admin_cx_collection_path(parent_collection)
expect(page).to have_content('Data Collections')
expect(page).to have_content('Parent.gov')
end
end

Expand Down
10 changes: 8 additions & 2 deletions spec/features/admin/forms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@

describe 'editing form timezone' do
let!(:form_with_responses) { FactoryBot.create(:form, :single_question, :with_responses, organization:) }
let!(:additional_response) { FactoryBot.create(:submission, form: form_with_responses, answer_01: "hi", created_at: "2025-01-02") }
let!(:user_role) { FactoryBot.create(:user_role, :form_manager, user: admin, form: form_with_responses) }

before do
Expand All @@ -764,9 +765,14 @@
expect(page).to have_content('Form Manager forms options updated successfully')
end

it 'can view submissions with a form time_zone' do
it 'renders valid time' do
visit responses_admin_form_path(form_with_responses)
expect(page.all("#submissions_table .usa-table.submissions tbody tr").size).to eq(3)
expect(page.all("#submissions_table .usa-table.submissions tbody tr").size).to eq(4)
end

it 'ensure format_time translation is correct' do
visit responses_admin_form_path(form_with_responses)
expect(all("#submissions_table .usa-table.submissions tbody tr").last).to have_content("January 01, 2025")
end
end

Expand Down
Loading