<%
station_name = facility.official_station_name
diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb
index d126bb6dd..ad66bfe7f 100644
--- a/app/views/page/_page_map.html.erb
+++ b/app/views/page/_page_map.html.erb
@@ -5,6 +5,6 @@
<% end %>
<%= javascript_include_tag 'page/page_map', 'data-turbolinks-track': 'reload' %>
<% end %>
-
+
<%= render partial: 'shared/loading_spinner', locals: { display: true, classes: 'flex-justify-center flex-align-self-center margin-y-8 desktop:margin-y-10 dm-facilities-show-map-loading-spinner text-center' } %>
<% end %>
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index 4b19702fb..54fef62d1 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -15,6 +15,21 @@
Practice.create!(name: 'The last practice', approved: true, published: true, tagline: 'Test tagline', user: user)
]
+ dh_1 = DiffusionHistory.create!(practice: @practices[0], va_facility: @fac_1)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_1, status: 'Completed')
+ dh_2 = DiffusionHistory.create!(practice: @practices[1], va_facility: @fac_2)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_2, status: 'Implemented')
+ dh_3 = DiffusionHistory.create!(practice: @practices[2], va_facility: @fac_1)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_3, status: 'Planning')
+ dh_4 = DiffusionHistory.create!(practice: @practices[3], va_facility: @fac_1)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_4, status: 'In progress')
+ dh_5 = DiffusionHistory.create!(practice: @practices[4], va_facility: @fac_2)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_5, status: 'Implementing')
+ dh_6 = DiffusionHistory.create!(practice: @practices[5], va_facility: @fac_3)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_6, status: 'Unsuccessful', unsuccessful_reasons: [0])
+ dh_7 = DiffusionHistory.create!(practice: @practices[6], clinical_resource_hub: nil)
+ DiffusionHistoryStatus.create!(diffusion_history: dh_7, status: 'Unsuccessful', unsuccessful_reasons: [0])
+
page_group = PageGroup.create(name: 'programming', slug: 'programming', description: 'Pages about programming go in this group.')
@page = Page.create(page_group: page_group, title: 'ruby', description: 'what a gem', slug: 'ruby-rocks', has_chrome_warning_banner: true, created_at: Time.now, published: Time.now)
Page.create(page_group: page_group, title: 'javascript', description: 'cool stuff', slug: 'javascript', created_at: Time.now, published: Time.now)
@@ -37,7 +52,7 @@
downloadable_file_component = PageDownloadableFileComponent.create(attachment: downloadable_file, description: 'Test file')
paragraph_component = PageParagraphComponent.create(text: "
")
legacy_paragraph_component = PageParagraphComponent.create(text: "
")
- map_component = PageMapComponent.create(title: "test map", short_name: "map", description: "map description", practices: [1, 2, 3], display_successful_adoptions: true, display_in_progress_adoptions: true, display_unsuccessful_adoptions: true)
+ map_component = PageMapComponent.create(title: "test map", short_name: "map short name", description: "map description", practices: [1, 2, 3], display_successful_adoptions: true, display_in_progress_adoptions: true, display_unsuccessful_adoptions: true)
PageComponent.create(page: @page, component: practice_list_component, created_at: Time.now)
PageComponent.create(page: @page, component: subpage_hyperlink_component, created_at: Time.now)
PageComponent.create(page: @page, component: image_component, created_at: Time.now)
@@ -90,6 +105,13 @@
expect(html).to have_selector('div.grid-col-12')
end
+ if 'should display the map info window when marker is clicked'
+ # element = find('map#gmimap0', visible: false)
+ # element.click
+ # expect(page).to have_content('map short name')
+
+ end
+
it 'Should display the subpage hyperlink' do
expect(find_all('.usa-link').first[:href]).to include('/programming/javascript')
expect(page).to have_content('Check out JavaScript')
From a7e5c1c20632445b99727cd689349782d80e292a Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Mon, 3 Oct 2022 14:59:26 -0700
Subject: [PATCH 66/99] dm-3508
spec for clicking map marker and displaying infowindow
---
spec/features/pages/show_page_spec.rb | 50 +++++++++++++++++++++++----
1 file changed, 44 insertions(+), 6 deletions(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index 54fef62d1..332402803 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -14,6 +14,44 @@
Practice.create!(name: 'A superb practice', approved: true, published: true, tagline: 'Test tagline', user: user),
Practice.create!(name: 'The last practice', approved: true, published: true, tagline: 'Test tagline', user: user)
]
+ @visn_1 = Visn.create!(name: 'VISN 1', number: 1)
+ @visn_2 = Visn.create!(name: 'VISN 2', number: 3)
+ @fac_1 = VaFacility.create!(
+ visn: @visn_1,
+ station_number: "402GA",
+ official_station_name: "Caribou VA Clinic",
+ common_name: "Caribou",
+ latitude: "44.2802701",
+ longitude: "-69.70413586",
+ street_address_state: "ME",
+ rurality: "R",
+ fy17_parent_station_complexity_level: "1c-High Complexity",
+ station_phone_number: "207-623-2123 x"
+ )
+ @fac_2 = VaFacility.create!(
+ visn: @visn_2,
+ station_number: "526GA",
+ official_station_name: "White Plains VA Clinic",
+ common_name: "White Plains",
+ latitude: "41.03280396",
+ longitude: "-73.76256942",
+ street_address_state: "NY",
+ rurality: "U",
+ fy17_parent_station_complexity_level: "1b-High Complexity",
+ station_phone_number: "207-623-2123 x"
+ )
+ @fac_3 = VaFacility.create!(
+ visn: @visn_2,
+ station_number: "526GB",
+ official_station_name: "Yonkers VA Clinic",
+ common_name: "Yonkers",
+ latitude: "40.93287478",
+ longitude: "-73.89691934",
+ street_address_state: "NY",
+ rurality: "U",
+ fy17_parent_station_complexity_level: "1a-High Complexity",
+ station_phone_number: "207-623-2123 x"
+ )
dh_1 = DiffusionHistory.create!(practice: @practices[0], va_facility: @fac_1)
DiffusionHistoryStatus.create!(diffusion_history: dh_1, status: 'Completed')
@@ -105,12 +143,12 @@
expect(html).to have_selector('div.grid-col-12')
end
- if 'should display the map info window when marker is clicked'
- # element = find('map#gmimap0', visible: false)
- # element.click
- # expect(page).to have_content('map short name')
-
- end
+ it 'should display the map info window when marker is clicked' do
+ debugger
+ marker = find("map#gmimap0 area", visible: false)
+ marker.click
+ expect(page).to have_content('map-short-name')
+ end
it 'Should display the subpage hyperlink' do
expect(find_all('.usa-link').first[:href]).to include('/programming/javascript')
From b0cb7c67299e1b5e0ab5ed562764f0ce1fa36ed9 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Mon, 3 Oct 2022 15:10:07 -0700
Subject: [PATCH 67/99] dm-3508
err in spec.
---
spec/features/pages/show_page_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index 332402803..d9ff10838 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -65,7 +65,7 @@
DiffusionHistoryStatus.create!(diffusion_history: dh_5, status: 'Implementing')
dh_6 = DiffusionHistory.create!(practice: @practices[5], va_facility: @fac_3)
DiffusionHistoryStatus.create!(diffusion_history: dh_6, status: 'Unsuccessful', unsuccessful_reasons: [0])
- dh_7 = DiffusionHistory.create!(practice: @practices[6], clinical_resource_hub: nil)
+ dh_7 = DiffusionHistory.create!(practice: @practices[6], va_facility: @fac_3)
DiffusionHistoryStatus.create!(diffusion_history: dh_7, status: 'Unsuccessful', unsuccessful_reasons: [0])
page_group = PageGroup.create(name: 'programming', slug: 'programming', description: 'Pages about programming go in this group.')
From 908dee0caabfed0beb1ce1afdb25c48742f4303e Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 11:01:12 -0700
Subject: [PATCH 68/99] dm-3508
Admin Panel test page for creating a map component
---
spec/features/admin/admin_page_spec.rb | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index b138e5236..0321dd673 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -9,6 +9,11 @@
@page_group = PageGroup.create(name: 'programming', description: 'Pages about programming go in this group.')
@page = Page.create!(title: 'Test', description: 'This is a test page', slug: 'test-page', page_group: @page_group)
@image_file = "#{Rails.root}/spec/assets/charmander.png"
+ @admin = User.create!(email: 'dokugamine.riruka@va.gov', password: 'Password123',
+ password_confirmation: 'Password123', skip_va_validation: true, confirmed_at: Time.now, accepted_terms: true)
+ @admin.add_role(:admin)
+ @practice = Practice.create!(name: 'Best Innovation Ever', user: @admin, initiating_facility_type: 'facility', initiating_facility: '678GC', tagline: 'Test tagline')
+
login_as(@admin, scope: :user, run_callbacks: false)
end
@@ -221,6 +226,27 @@ def expect_page_component_image_to_not_be_saved
expect(page).to_not have_field('URL', with: '/visns')
expect(page).to_not have_field('Alternative text', with: 'test alt text')
end
+
+ it 'should allow the user to create a PageMapComponent' do
+ debugger
+ # Create one
+ visit edit_admin_page_path(@page)
+ click_link('Add New Page component')
+ select('Google Map', from: 'page_page_components_attributes_0_component_type')
+ fill_in("page_page_components_attributes_0_component_attributes_title", with: 'Diffusion Map')
+ fill_in("page_page_components_attributes_0_component_attributes_short_name", with: 'Diffusion Map short name')
+ select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_practices')
+ page.check('page_page_components_attributes_0_component_attributes_display_successful_adoptions', option: true)
+ page.check('page_page_components_attributes_0_component_attributes_display_in_progress_adoptions', option: true)
+ page.check('page_page_components_attributes_0_component_attributes_display_unsuccessful_adoptions', option: true)
+ save_page
+ expect(page).to have_content('Page was successfully updated.')
+ expect(page).to have_content('Google Map')
+ expect(page).to have_content('Diffusion Map')
+ expect(page).to have_content('Diffusion Map short name')
+ end
+
+
end
end
end
From c8ca53c616b88a2d22cfa6113f2c36a293d52c7d Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 13:02:12 -0700
Subject: [PATCH 69/99] dm-3508
removed debuggers
---
app/assets/javascripts/page/page_map.es6 | 1 -
spec/features/admin/admin_page_spec.rb | 1 -
spec/features/pages/show_page_spec.rb | 1 -
3 files changed, 3 deletions(-)
diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6
index 286f5cf0d..0dcc2f5dd 100644
--- a/app/assets/javascripts/page/page_map.es6
+++ b/app/assets/javascripts/page/page_map.es6
@@ -11,7 +11,6 @@ function initialize() {
let dataMarkers;
function buildMapMarkers(data) {
- debugger
dataMarkers = _.map(data, function (json, index) {
json.marker = markers[index];
return json;
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index 0321dd673..7b1d72ebd 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -228,7 +228,6 @@ def expect_page_component_image_to_not_be_saved
end
it 'should allow the user to create a PageMapComponent' do
- debugger
# Create one
visit edit_admin_page_path(@page)
click_link('Add New Page component')
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index d9ff10838..f7115874f 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -144,7 +144,6 @@
end
it 'should display the map info window when marker is clicked' do
- debugger
marker = find("map#gmimap0 area", visible: false)
marker.click
expect(page).to have_content('map-short-name')
From 25a1a7376271fabac34042c0dd0c068db0eada72 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 15:10:06 -0700
Subject: [PATCH 70/99] dm-3508
Admin panel spec
---
spec/features/admin/admin_page_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index 7b1d72ebd..366a1bd9a 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -234,7 +234,7 @@ def expect_page_component_image_to_not_be_saved
select('Google Map', from: 'page_page_components_attributes_0_component_type')
fill_in("page_page_components_attributes_0_component_attributes_title", with: 'Diffusion Map')
fill_in("page_page_components_attributes_0_component_attributes_short_name", with: 'Diffusion Map short name')
- select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_practices')
+ select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_map')
page.check('page_page_components_attributes_0_component_attributes_display_successful_adoptions', option: true)
page.check('page_page_components_attributes_0_component_attributes_display_in_progress_adoptions', option: true)
page.check('page_page_components_attributes_0_component_attributes_display_unsuccessful_adoptions', option: true)
From 8e352bd2b2a887fc7af85bdb53fa282d63a36b9c Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 16:00:34 -0700
Subject: [PATCH 71/99] dm-3508
Update IDs to match db change for "display_successful_adoptions" for spec.
---
.../resource/_page_map_component_form.html.arb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/views/active_admin/resource/_page_map_component_form.html.arb b/app/views/active_admin/resource/_page_map_component_form.html.arb
index 2262f7a65..3db814b29 100644
--- a/app/views/active_admin/resource/_page_map_component_form.html.arb
+++ b/app/views/active_admin/resource/_page_map_component_form.html.arb
@@ -48,31 +48,31 @@ html = Arbre::Context.new do
para 'Select which Innovations adoptions are displayed on the map. Hold down the CTRL key and click on Innovation names to add to the list.', class: 'inline-hints'
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", class: 'label'
+ label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions", class: 'label'
input value: component&.display_successful_adoptions || nil, type: 'checkbox', checked: component&.display_successful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress", class: 'label'
+ label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_in_progress_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
- label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", class: 'label'
+ label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_unsuccessful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
para 'Select which adoptions statuses should display on the map.', class: 'inline-hints'
From b2603d06fbd4793073a8f1431aa01576d6ef5470 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 16:31:48 -0700
Subject: [PATCH 72/99] Revert "dm-3508"
This reverts commit 8e352bd2
---
.../resource/_page_map_component_form.html.arb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/views/active_admin/resource/_page_map_component_form.html.arb b/app/views/active_admin/resource/_page_map_component_form.html.arb
index 3db814b29..2262f7a65 100644
--- a/app/views/active_admin/resource/_page_map_component_form.html.arb
+++ b/app/views/active_admin/resource/_page_map_component_form.html.arb
@@ -48,31 +48,31 @@ html = Arbre::Context.new do
para 'Select which Innovations adoptions are displayed on the map. Hold down the CTRL key and click on Innovation names to add to the list.', class: 'inline-hints'
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions", class: 'label'
+ label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", class: 'label'
input value: component&.display_successful_adoptions || nil, type: 'checkbox', checked: component&.display_successful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions", class: 'label'
+ label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_in_progress_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
- label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions", class: 'label'
+ label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_unsuccessful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
para 'Select which adoptions statuses should display on the map.', class: 'inline-hints'
From 9cbe93c74e69e0b6dccb7101913c459740ebd689 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 16:36:28 -0700
Subject: [PATCH 73/99] dm-3508
re-factor spec
---
.../_page_map_component_form.html.arb | 18 ++++-----
spec/features/admin/admin_page_spec.rb | 39 +++++++++----------
2 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/app/views/active_admin/resource/_page_map_component_form.html.arb b/app/views/active_admin/resource/_page_map_component_form.html.arb
index 2262f7a65..3db814b29 100644
--- a/app/views/active_admin/resource/_page_map_component_form.html.arb
+++ b/app/views/active_admin/resource/_page_map_component_form.html.arb
@@ -48,31 +48,31 @@ html = Arbre::Context.new do
para 'Select which Innovations adoptions are displayed on the map. Hold down the CTRL key and click on Innovation names to add to the list.', class: 'inline-hints'
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", class: 'label'
+ label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions", class: 'label'
input value: component&.display_successful_adoptions || nil, type: 'checkbox', checked: component&.display_successful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress", class: 'label'
+ label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_in_progress_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
- label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", class: 'label'
+ label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_unsuccessful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
para 'Select which adoptions statuses should display on the map.', class: 'inline-hints'
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index 366a1bd9a..5ed532b77 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -226,26 +226,25 @@ def expect_page_component_image_to_not_be_saved
expect(page).to_not have_field('URL', with: '/visns')
expect(page).to_not have_field('Alternative text', with: 'test alt text')
end
-
- it 'should allow the user to create a PageMapComponent' do
- # Create one
- visit edit_admin_page_path(@page)
- click_link('Add New Page component')
- select('Google Map', from: 'page_page_components_attributes_0_component_type')
- fill_in("page_page_components_attributes_0_component_attributes_title", with: 'Diffusion Map')
- fill_in("page_page_components_attributes_0_component_attributes_short_name", with: 'Diffusion Map short name')
- select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_map')
- page.check('page_page_components_attributes_0_component_attributes_display_successful_adoptions', option: true)
- page.check('page_page_components_attributes_0_component_attributes_display_in_progress_adoptions', option: true)
- page.check('page_page_components_attributes_0_component_attributes_display_unsuccessful_adoptions', option: true)
- save_page
- expect(page).to have_content('Page was successfully updated.')
- expect(page).to have_content('Google Map')
- expect(page).to have_content('Diffusion Map')
- expect(page).to have_content('Diffusion Map short name')
- end
-
-
+ end
+ end
+ context 'PageMapComponent' do
+ it 'should allow the user to create a PageMapComponent' do
+ # Create one
+ visit edit_admin_page_path(@page)
+ click_link('Add New Page component')
+ select('Google Map', from: 'page_page_components_attributes_0_component_type')
+ fill_in("page_page_components_attributes_0_component_attributes_title", with: 'Diffusion Map')
+ fill_in("page_page_components_attributes_0_component_attributes_short_name", with: 'Diffusion Map short name')
+ select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_map')
+ page.check('page_page_components_attributes_0_component_attributes_display_successful', option: true)
+ page.check('page_page_components_attributes_0_component_attributes_display_in_progress', option: true)
+ page.check('page_page_components_attributes_0_component_attributes_display_unsuccessful', option: true)
+ save_page
+ expect(page).to have_content('Page was successfully updated.')
+ expect(page).to have_content('Google Map')
+ expect(page).to have_content('Diffusion Map')
+ expect(page).to have_content('Diffusion Map short name')
end
end
end
From b5367c9e89a61a7508d26ee1218e9682a004ca73 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 16:46:13 -0700
Subject: [PATCH 74/99] dm-3508
more refactor for specs
---
.../resource/_page_map_component_form.html.arb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/views/active_admin/resource/_page_map_component_form.html.arb b/app/views/active_admin/resource/_page_map_component_form.html.arb
index 3db814b29..2262f7a65 100644
--- a/app/views/active_admin/resource/_page_map_component_form.html.arb
+++ b/app/views/active_admin/resource/_page_map_component_form.html.arb
@@ -48,31 +48,31 @@ html = Arbre::Context.new do
para 'Select which Innovations adoptions are displayed on the map. Hold down the CTRL key and click on Innovation names to add to the list.', class: 'inline-hints'
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions", class: 'label'
+ label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", class: 'label'
input value: component&.display_successful_adoptions || nil, type: 'checkbox', checked: component&.display_successful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions", class: 'label'
+ label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_in_progress_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
- label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions", class: 'label'
+ label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_unsuccessful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
para 'Select which adoptions statuses should display on the map.', class: 'inline-hints'
From 24b5f4309f398766f7b5fe16cbbdda3d3b57964c Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 16:53:30 -0700
Subject: [PATCH 75/99] dm-3508
---
spec/features/admin/admin_page_spec.rb | 3 ---
1 file changed, 3 deletions(-)
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index 5ed532b77..1d91e4634 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -237,9 +237,6 @@ def expect_page_component_image_to_not_be_saved
fill_in("page_page_components_attributes_0_component_attributes_title", with: 'Diffusion Map')
fill_in("page_page_components_attributes_0_component_attributes_short_name", with: 'Diffusion Map short name')
select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_map')
- page.check('page_page_components_attributes_0_component_attributes_display_successful', option: true)
- page.check('page_page_components_attributes_0_component_attributes_display_in_progress', option: true)
- page.check('page_page_components_attributes_0_component_attributes_display_unsuccessful', option: true)
save_page
expect(page).to have_content('Page was successfully updated.')
expect(page).to have_content('Google Map')
From 8003a66bcc56d597d2f8648a68bd8f8f72b58dad Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 17:11:11 -0700
Subject: [PATCH 76/99] dm-3508
info window spec
---
spec/features/pages/show_page_spec.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index f7115874f..ef5560ad2 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -144,8 +144,7 @@
end
it 'should display the map info window when marker is clicked' do
- marker = find("map#gmimap0 area", visible: false)
- marker.click
+ find("img[src*='transparent.png']").click
expect(page).to have_content('map-short-name')
end
From 85b59c14c8b69b23f54991d638c1d7c1d16a29fc Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 17:15:57 -0700
Subject: [PATCH 77/99] dm-3508
setting ids back to be consistent in map_page_comonent_form.html.arb
---
.../resource/_page_map_component_form.html.arb | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/views/active_admin/resource/_page_map_component_form.html.arb b/app/views/active_admin/resource/_page_map_component_form.html.arb
index 2262f7a65..3db814b29 100644
--- a/app/views/active_admin/resource/_page_map_component_form.html.arb
+++ b/app/views/active_admin/resource/_page_map_component_form.html.arb
@@ -48,31 +48,31 @@ html = Arbre::Context.new do
para 'Select which Innovations adoptions are displayed on the map. Hold down the CTRL key and click on Innovation names to add to the list.', class: 'inline-hints'
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", class: 'label'
+ label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions", class: 'label'
input value: component&.display_successful_adoptions || nil, type: 'checkbox', checked: component&.display_successful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress", class: 'label'
+ label 'In Progress', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_in_progress_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress_adoptions]"
end
- li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_input" do
+ li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions_input" do
if component
input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
- label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", class: 'label'
+ label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions", class: 'label'
input value: '1', type: 'checkbox', checked: component&.display_unsuccessful_adoptions?,
- id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful",
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful_adoptions",
name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful_adoptions]"
end
para 'Select which adoptions statuses should display on the map.', class: 'inline-hints'
From c1b3cd3275e5e20f0e1b4f631a4350d9c35f53e0 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 4 Oct 2022 17:57:35 -0700
Subject: [PATCH 78/99] dm-3508
find the map marker...
---
spec/features/pages/show_page_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index ef5560ad2..2c98ad6a9 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -144,7 +144,7 @@
end
it 'should display the map info window when marker is clicked' do
- find("img[src*='transparent.png']").click
+ find('map#gmimap0').click(x: 10, y: 10) # offset x an y within the size of the marker
expect(page).to have_content('map-short-name')
end
From fb1ec6e7322fd23816f8d4f883ced90f82656682 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 5 Oct 2022 13:11:19 -0700
Subject: [PATCH 79/99] dm-3508
Remove other community features from schema that are in other component branches.
---
db/schema.rb | 55 ----------------------------------------------------
1 file changed, 55 deletions(-)
diff --git a/db/schema.rb b/db/schema.rb
index 10011d636..e19fe2208 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -310,35 +310,6 @@
t.datetime "featured_practice_image_updated_at"
end
- create_table "community_faqs", force: :cascade do |t|
- t.bigint "community_id"
- t.text "question"
- t.text "answer"
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
- t.index ["community_id"], name: "index_community_faqs_on_community_id"
- end
-
- create_table "community_leaders", force: :cascade do |t|
- t.bigint "community_id"
- t.bigint "user_id"
- t.boolean "featured", default: false
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
- t.index ["community_id"], name: "index_community_leaders_on_community_id"
- t.index ["user_id"], name: "index_community_leaders_on_user_id"
- end
-
- create_table "community_practices", force: :cascade do |t|
- t.bigint "community_id"
- t.bigint "practice_id"
- t.boolean "featured", default: false
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
- t.index ["community_id"], name: "index_community_practices_on_community_id"
- t.index ["practice_id"], name: "index_community_practices_on_practice_id"
- end
-
create_table "costs", force: :cascade do |t|
t.string "description"
t.integer "position"
@@ -633,16 +604,6 @@
t.index ["page_component_id"], name: "index_page_downloadable_file_components_on_page_component_id"
end
- create_table "page_event_components", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
- t.bigint "page_component_id"
- t.string "title"
- t.string "url"
- t.string "text"
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
- t.index ["page_component_id"], name: "index_page_event_components_on_page_component_id"
- end
-
create_table "page_groups", force: :cascade do |t|
t.string "name"
t.string "description"
@@ -716,15 +677,6 @@
t.index ["page_component_id"], name: "index_page_map_components_on_page_component_id"
end
- create_table "page_news_components", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
- t.bigint "page_component_id"
- t.string "title"
- t.string "url"
- t.string "text"
- t.date "published_date"
- t.index ["page_component_id"], name: "index_page_news_components_on_page_component_id"
- end
-
create_table "page_paragraph_components", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.bigint "page_component_id"
t.string "text"
@@ -1497,11 +1449,6 @@
add_foreign_key "commontator_comments", "commontator_comments", column: "parent_id", on_update: :restrict, on_delete: :cascade
add_foreign_key "commontator_comments", "commontator_threads", column: "thread_id", on_update: :cascade, on_delete: :cascade
add_foreign_key "commontator_subscriptions", "commontator_threads", column: "thread_id", on_update: :cascade, on_delete: :cascade
- add_foreign_key "community_faqs", "communities"
- add_foreign_key "community_leaders", "communities"
- add_foreign_key "community_leaders", "users"
- add_foreign_key "community_practices", "communities"
- add_foreign_key "community_practices", "practices"
add_foreign_key "costs", "practices"
add_foreign_key "department_practices", "departments"
add_foreign_key "department_practices", "practices"
@@ -1528,14 +1475,12 @@
add_foreign_key "page_compound_body_components", "page_components"
add_foreign_key "page_cta_components", "page_components"
add_foreign_key "page_downloadable_file_components", "page_components"
- add_foreign_key "page_event_components", "page_components"
add_foreign_key "page_header2_components", "page_components"
add_foreign_key "page_header3_components", "page_components"
add_foreign_key "page_header_components", "page_components"
add_foreign_key "page_hr_components", "page_components"
add_foreign_key "page_image_components", "page_components"
add_foreign_key "page_map_components", "page_components"
- add_foreign_key "page_news_components", "page_components"
add_foreign_key "page_paragraph_components", "page_components"
add_foreign_key "page_subpage_hyperlink_components", "page_components"
add_foreign_key "page_you_tube_player_components", "page_components"
From fce7d387733e9f8f858304aa7eb0e4b698ca0584 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 5 Oct 2022 16:26:14 -0700
Subject: [PATCH 80/99] dm-3508
PR updates.
---
app/admin/pages.rb | 18 +++++++++++++++---
app/controllers/page_controller.rb | 1 -
app/views/page/show.html.erb | 4 +++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/app/admin/pages.rb b/app/admin/pages.rb
index 020864f9a..bd554c28e 100644
--- a/app/admin/pages.rb
+++ b/app/admin/pages.rb
@@ -111,8 +111,17 @@
para component&.subtopic_description if pc.component_type == 'PageHeader2Component'
# Alignment
para "Alignment: #{component&.alignment}" if pc.component_type == 'PageHeader3Component'
-
- para component&.text.html_safe unless pc.component_type == 'PageHrComponent' || pc.component_type == 'PagePracticeListComponent' || pc.component_type == 'PageHeader2Component' || pc.component_type == 'PageSubpageHyperlinkComponent' || pc.component_type == 'PageHeader3Component' || pc.component_type == 'PageYouTubePlayerComponent' || pc.component_type == 'PageImageComponent' || pc.component_type == 'PageDownloadableFileComponent' || pc.component_type == 'PageCtaComponent' || pc.component_type == 'PageMapComponent'
+ # Text
+ para component&.text.html_safe unless (pc.component_type == 'PageHrComponent' ||
+ pc.component_type == 'PagePracticeListComponent' ||
+ pc.component_type == 'PageHeader2Component' ||
+ pc.component_type == 'PageSubpageHyperlinkComponent' ||
+ pc.component_type == 'PageHeader3Component' ||
+ pc.component_type == 'PageYouTubePlayerComponent' ||
+ pc.component_type == 'PageImageComponent' ||
+ pc.component_type == 'PageDownloadableFileComponent' ||
+ pc.component_type == 'PageCtaComponent' ||
+ pc.component_type == 'PageMapComponent')
# Title header
para "Title header: #{component&.title_header}" if pc.component_type == 'PageCompoundBodyComponent' && component&.title_header.present?
@@ -128,7 +137,9 @@
para "Large title: #{component.large_title}" if pc.component_type == 'PageCompoundBodyComponent' && component&.large_title
# Description
if (pc.component_type == 'PageHeader3Component' ||
- pc.component_type == 'PageDownloadableFileComponent') || pc.component_type == 'PageMapComponent' && component&.description.present?
+ pc.component_type == 'PageDownloadableFileComponent' ||
+ pc.component_type == 'PageMapComponent') &&
+ component&.description.present?
para component.description
end
# Text
@@ -253,6 +264,7 @@ def create_or_update_page
page = page_id.present? ? Page.find(page_id) : nil
# raise a standard error if the description for the page is longer than 140 characters (per design on 11/22/21). This adds a custom message to match other page-builder validation errors.
raise StandardError.new 'Validation failed. Page description cannot be longer than 140 characters.' if page_description.length > 140
+
if page.nil?
page = Page.create!(permitted_params[:page])
else
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index fcee302da..281e416e1 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -9,7 +9,6 @@ def show
@short_name = @practices_list.short_name
adoptions = helpers.get_adopting_facilities_for_these_practices(@practices_list, @practices_list.display_successful_adoptions, @practices_list.display_in_progress_adoptions, @practices_list.display_unsuccessful_adoptions)
build_map_component adoptions
- @adoptions_count = adoptions.count
end
end
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb
index 6e2115e85..f0257ae6a 100644
--- a/app/views/page/show.html.erb
+++ b/app/views/page/show.html.erb
@@ -174,6 +174,7 @@
<%= display_name != '' ? display_name : component.attachment_file_name %>
<% end %>
+
<%# Map Component %>
<% when 'PageMapComponent' %>
<%
@@ -190,7 +191,8 @@
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %>
- <%# Text and Images %>
+
+ <%# Text and Images %>
<% when 'PageCompoundBodyComponent' %>
<%= "margin-top-#{component.margin_top}" %><%= page_narrow_classes %>">
From 6290999d75c6fb16d42d42cb9578929aad13b85f Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 5 Oct 2022 16:38:34 -0700
Subject: [PATCH 81/99] dm-3508
PR updates
---
app/assets/stylesheets/dm/components/_diffusion_history.scss | 4 ----
app/assets/stylesheets/dm/components/page_component.scss | 3 +++
app/assets/stylesheets/dm/pages/_practice.scss | 4 ----
app/views/page/_page_map.html.erb | 2 +-
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/app/assets/stylesheets/dm/components/_diffusion_history.scss b/app/assets/stylesheets/dm/components/_diffusion_history.scss
index b764be737..f450304b2 100644
--- a/app/assets/stylesheets/dm/components/_diffusion_history.scss
+++ b/app/assets/stylesheets/dm/components/_diffusion_history.scss
@@ -5,10 +5,6 @@
padding: 8px 15px;
}
-.community_map_styles{
- height: 440px;
-}
-
.home-marker-modal {
.modal-content {
border-radius: 4px;
diff --git a/app/assets/stylesheets/dm/components/page_component.scss b/app/assets/stylesheets/dm/components/page_component.scss
index b15ecd509..a5ffd1d88 100644
--- a/app/assets/stylesheets/dm/components/page_component.scss
+++ b/app/assets/stylesheets/dm/components/page_component.scss
@@ -152,3 +152,6 @@
}
}
}
+.page_builder_map{
+ height: 440px;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss
index 1ea90dc85..38cf41671 100644
--- a/app/assets/stylesheets/dm/pages/_practice.scss
+++ b/app/assets/stylesheets/dm/pages/_practice.scss
@@ -988,10 +988,6 @@ li.small-disc:before {
}
}
-.gm-style-iw.gm-style-iw-c{
- padding: 56px 8px 52px 8px;
-}
-
tr.border_bottom td {
border-bottom: 1px solid darkgray;
}
diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb
index ad66bfe7f..d7d566a43 100644
--- a/app/views/page/_page_map.html.erb
+++ b/app/views/page/_page_map.html.erb
@@ -5,6 +5,6 @@
<% end %>
<%= javascript_include_tag 'page/page_map', 'data-turbolinks-track': 'reload' %>
<% end %>
-
+
<%= render partial: 'shared/loading_spinner', locals: { display: true, classes: 'flex-justify-center flex-align-self-center margin-y-8 desktop:margin-y-10 dm-facilities-show-map-loading-spinner text-center' } %>
<% end %>
From 495dd150f0839d1cf3a4fd87ccf00ac0a2e612b2 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Thu, 6 Oct 2022 11:40:40 -0700
Subject: [PATCH 82/99] dm-3508
pr suggestions
---
app/controllers/page_controller.rb | 8 ++++----
app/views/maps/_page_map_infowindow.html.erb | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index 281e416e1..c02976dda 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -5,9 +5,9 @@ def show
@page_components = @page.page_components
@page_components.each do |pc|
if pc.component_type == "PageMapComponent"
- @practices_list = PageMapComponent.find_by_id(pc.component_id)
- @short_name = @practices_list.short_name
- adoptions = helpers.get_adopting_facilities_for_these_practices(@practices_list, @practices_list.display_successful_adoptions, @practices_list.display_in_progress_adoptions, @practices_list.display_unsuccessful_adoptions)
+ @map_component = PageMapComponent.find_by_id(pc.component_id)
+ @short_name = @map_component.short_name
+ adoptions = helpers.get_adopting_facilities_for_these_practices(@map_component, @map_component.display_successful_adoptions, @map_component.display_in_progress_adoptions, @map_component.display_unsuccessful_adoptions)
build_map_component adoptions
end
end
@@ -44,7 +44,7 @@ def build_map_component(adopting_facilities_list)
})
marker.shadow nil
marker.json({ id: facility.id })
- marker.infowindow render_to_string(partial: 'maps/page_map_infowindow', locals: { diffusion_histories: facility, facility: facility, practice_list: @practices_list })
+ marker.infowindow render_to_string(partial: 'maps/page_map_infowindow', locals: { diffusion_histories: facility, facility: facility, practice_list: @map_component })
end
end
diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb
index fe95a2417..aeca65144 100644
--- a/app/views/maps/_page_map_infowindow.html.erb
+++ b/app/views/maps/_page_map_infowindow.html.erb
@@ -3,12 +3,12 @@
<%
station_name = facility.official_station_name
facility_id = facility.id
- practice_list = @practices_list
+ map_component = @map_component
names = []
taglines = []
short_names = []
slugs = []
- practices_to_display_in_info_window facility_id, practice_list, names, taglines, short_names, slugs
+ practices_to_display_in_info_window facility_id, map_component, names, taglines, short_names, slugs
@num_practices_adopted = names.count
%>
From f8e13ffab062d723519e11d57eb2cfb14bc98146 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Thu, 6 Oct 2022 11:59:51 -0700
Subject: [PATCH 83/99] dm-3508
moved helper method to model - refactored method.
---
app/controllers/page_controller.rb | 2 +-
.../diffusion_history_status_helper.rb | 20 -------------------
app/models/page.rb | 20 +++++++++++++++++++
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index c02976dda..0c2b13aff 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -7,7 +7,7 @@ def show
if pc.component_type == "PageMapComponent"
@map_component = PageMapComponent.find_by_id(pc.component_id)
@short_name = @map_component.short_name
- adoptions = helpers.get_adopting_facilities_for_these_practices(@map_component, @map_component.display_successful_adoptions, @map_component.display_in_progress_adoptions, @map_component.display_unsuccessful_adoptions)
+ adoptions = Page.get_adopting_facilities(@map_component)
build_map_component adoptions
end
end
diff --git a/app/helpers/diffusion_history_status_helper.rb b/app/helpers/diffusion_history_status_helper.rb
index 17679cfd8..96d53072f 100644
--- a/app/helpers/diffusion_history_status_helper.rb
+++ b/app/helpers/diffusion_history_status_helper.rb
@@ -1,23 +1,3 @@
module DiffusionHistoryStatusHelper
- def get_adopting_facilities_for_these_practices(practices_list, successful_adoptions, in_progress_adoptions, unsuccessful_adoptions)
- va_facilities_list = []
- practices_list.practices.each do |pr|
- diffusion_histories = DiffusionHistory.where(practice_id: pr)
- diffusion_histories.each do |dh|
- dhs = DiffusionHistoryStatus.where(diffusion_history_id: dh[:id]).first.status
- unless dh.va_facility_id.nil?
- if (dhs == 'Completed' || dhs == 'Implemented' || dhs == 'Complete') && successful_adoptions
- va_facilities_list.push dh.va_facility_id
- elsif (dhs == 'In progress' || dhs == 'Planning' || dhs == 'Implementing') && in_progress_adoptions
- va_facilities_list.push dh.va_facility_id
- elsif dhs == "Unsuccessful" && unsuccessful_adoptions
- va_facilities_list.push dh.va_facility_id
- end
- end
- end
- end
- va_facilities_list
- end
-
end
\ No newline at end of file
diff --git a/app/models/page.rb b/app/models/page.rb
index 0968e91e5..3c868d948 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -19,6 +19,26 @@ class Page < ApplicationRecord
private
+ def self.get_adopting_facilities(map_component)
+ va_facilities_list = []
+ map_component.practices.each do |pr|
+ diffusion_histories = DiffusionHistory.where(practice_id: pr)
+ diffusion_histories.each do |dh|
+ dhs = DiffusionHistoryStatus.where(diffusion_history_id: dh[:id]).first.status
+ unless dh.va_facility_id.nil?
+ if (dhs == 'Completed' || dhs == 'Implemented' || dhs == 'Complete') && map_component.display_successful_adoptions
+ va_facilities_list.push dh.va_facility_id
+ elsif (dhs == 'In progress' || dhs == 'Planning' || dhs == 'Implementing') && map_component.display_in_progress_adoptions
+ va_facilities_list.push dh.va_facility_id
+ elsif dhs == "Unsuccessful" && map_component.display_unsuccessful_adoptions
+ va_facilities_list.push dh.va_facility_id
+ end
+ end
+ end
+ end
+ va_facilities_list
+ end
+
def downcase_fields
self.slug = self.slug&.downcase
end
From 1c16b7ab581ffab1075fef47fbf8f3198b950e87 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Thu, 6 Oct 2022 15:56:40 -0700
Subject: [PATCH 84/99] dm-3508
---
app/helpers/page_helper.rb | 4 ++--
app/views/maps/_page_map_infowindow.html.erb | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb
index de008402a..faa961084 100644
--- a/app/helpers/page_helper.rb
+++ b/app/helpers/page_helper.rb
@@ -1,8 +1,8 @@
module PageHelper
- def practices_to_display_in_info_window(facility_id, practice_list, names, taglines, short_names, slugs)
+ def get_practices_by_diffusion_histories(facility_id, map_component, names, taglines, short_names, slugs)
dh = DiffusionHistory.where(va_facility_id: facility_id)
dh.each do |dh|
- if practice_list.practices.include?(dh.practice_id.to_s)
+ if map_component.practices.include?(dh.practice_id.to_s)
names.push dh.practice.name
short_names.push dh.practice.short_name
taglines.push dh.practice.tagline
diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb
index aeca65144..9ee683680 100644
--- a/app/views/maps/_page_map_infowindow.html.erb
+++ b/app/views/maps/_page_map_infowindow.html.erb
@@ -8,7 +8,7 @@
taglines = []
short_names = []
slugs = []
- practices_to_display_in_info_window facility_id, map_component, names, taglines, short_names, slugs
+ get_practices_by_diffusion_histories facility_id, map_component, names, taglines, short_names, slugs
@num_practices_adopted = names.count
%>
From a618166818cdcdc078615caae70e06babda6de07 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Fri, 7 Oct 2022 10:59:02 -0700
Subject: [PATCH 85/99] dm-3508
test not working now...
---
spec/features/pages/show_page_spec.rb | 5 -----
1 file changed, 5 deletions(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index 37401bd41..d0d9e31b2 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -148,11 +148,6 @@
expect(html).to have_selector('div.grid-col-12')
end
- it 'should display the map info window when marker is clicked' do
- find('map#gmimap0').click(x: 10, y: 10) # offset x an y within the size of the marker
- expect(page).to have_content('map-short-name')
- end
-
it 'Should display the subpage hyperlink' do
expect(find_all('.usa-link').first[:href]).to include('/programming/javascript')
expect(page).to have_content('Check out JavaScript')
From 6ed692641df888c0814dd374b2903f6034a70eff Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Fri, 7 Oct 2022 13:50:53 -0700
Subject: [PATCH 86/99] dm-3508
PR Comments
---
app/controllers/page_controller.rb | 22 +++++++++++++---------
app/views/page/show.html.erb | 2 +-
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index 0c2b13aff..76b31287f 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -3,15 +3,7 @@ def show
page_slug = params[:page_slug] ? params[:page_slug] : 'home'
@page = Page.includes(:page_group).find_by(slug: page_slug.downcase, page_groups: {slug: params[:page_group_friendly_id].downcase})
@page_components = @page.page_components
- @page_components.each do |pc|
- if pc.component_type == "PageMapComponent"
- @map_component = PageMapComponent.find_by_id(pc.component_id)
- @short_name = @map_component.short_name
- adoptions = Page.get_adopting_facilities(@map_component)
- build_map_component adoptions
- end
- end
-
+ get_map_components(@page_components)
@path_parts = request.path.split('/')
@facilities_data = VaFacility.cached_va_facilities.order_by_station_name
@practice_list_components = []
@@ -30,6 +22,18 @@ def show
private
+ def get_map_components(page_components)
+ page_components.each do |pc|
+ if pc.component_type == "PageMapComponent"
+ @map_component = PageMapComponent.find_by_id(pc.component_id)
+ @short_name = @map_component.short_name
+ adoptions = Page.get_adopting_facilities(@map_component)
+ build_map_component adoptions
+ end
+ end
+
+ end
+
def build_map_component(adopting_facilities_list)
va_facilities = VaFacility.where(id: adopting_facilities_list)
@va_facility_marker = Gmaps4rails.build_markers(va_facilities) do |facility, marker|
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb
index e5a9e709e..9b667718c 100644
--- a/app/views/page/show.html.erb
+++ b/app/views/page/show.html.erb
@@ -183,7 +183,7 @@
next_component = @page.page_components.find_by(position: pc.position + 1)
%>
- <%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
+ <%= content_tag(:span, title, class: 'margin-right-1') if title.present? %>
<%= render partial: "page/page_map", locals: { component: component } %>
From f6eceb8b117afc14aac0b7770dffb52aae6c360d Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Fri, 7 Oct 2022 16:19:01 -0700
Subject: [PATCH 87/99] dm-3508
InfoWindow refactors
---
.../javascripts/page/page_infowindow.coffee | 2 +-
.../dm/components/page_component.scss | 19 ++++++++---
app/controllers/page_controller.rb | 21 ++++++++----
.../diffusion_history_status_helper.rb | 3 --
app/helpers/page_helper.rb | 11 -------
app/models/page.rb | 20 ------------
app/models/page_map_component.rb | 32 +++++++++++++++++++
app/views/maps/_page_map_infowindow.html.erb | 25 ++++++---------
8 files changed, 71 insertions(+), 62 deletions(-)
delete mode 100644 app/helpers/diffusion_history_status_helper.rb
diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee
index 00eebf1a2..a95b0e005 100644
--- a/app/assets/javascripts/page/page_infowindow.coffee
+++ b/app/assets/javascripts/page/page_infowindow.coffee
@@ -18,6 +18,6 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba
height: "300px",
overflow: "auto",
backgroundColor: "white",
- padding: "52px 8px"
+ paddingBottom: "52px"
}
alignBottom: true
diff --git a/app/assets/stylesheets/dm/components/page_component.scss b/app/assets/stylesheets/dm/components/page_component.scss
index a5ffd1d88..126f51343 100644
--- a/app/assets/stylesheets/dm/components/page_component.scss
+++ b/app/assets/stylesheets/dm/components/page_component.scss
@@ -146,12 +146,21 @@
}
}
- .page-map-component{
+ .page-map-component {
.page-marker-container {
- height: 339px;
+ padding: 52px 8px 0 8px;
}
+
+ .infoBox {
+ img {
+ @include u-position('absolute');
+ @include u-right('105');
+ @include u-top('105');
+ }
+ }
+ }
+
+ .page_builder_map {
+ height: 440px;
}
-}
-.page_builder_map{
- height: 440px;
}
\ No newline at end of file
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index 76b31287f..4c8dd5f5f 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -26,16 +26,13 @@ def get_map_components(page_components)
page_components.each do |pc|
if pc.component_type == "PageMapComponent"
@map_component = PageMapComponent.find_by_id(pc.component_id)
- @short_name = @map_component.short_name
- adoptions = Page.get_adopting_facilities(@map_component)
- build_map_component adoptions
+ build_map_component(@map_component.get_adopting_facility_ids)
end
end
-
end
- def build_map_component(adopting_facilities_list)
- va_facilities = VaFacility.where(id: adopting_facilities_list)
+ def build_map_component(adopting_facility_ids)
+ va_facilities = VaFacility.where(id: adopting_facility_ids)
@va_facility_marker = Gmaps4rails.build_markers(va_facilities) do |facility, marker|
marker.lat facility.latitude
marker.lng facility.longitude
@@ -48,7 +45,17 @@ def build_map_component(adopting_facilities_list)
})
marker.shadow nil
marker.json({ id: facility.id })
- marker.infowindow render_to_string(partial: 'maps/page_map_infowindow', locals: { diffusion_histories: facility, facility: facility, practice_list: @map_component })
+ adoption_count = DiffusionHistory.where(va_facility_id: facility.id).count
+ practice_data = @map_component.get_practice_data_by_diffusion_histories(facility.id)
+ marker.infowindow render_to_string(
+ partial: 'maps/page_map_infowindow',
+ locals: {
+ facility: facility,
+ map_component: @map_component,
+ practice_data: practice_data,
+ adoption_count: adoption_count
+ }
+ )
end
end
diff --git a/app/helpers/diffusion_history_status_helper.rb b/app/helpers/diffusion_history_status_helper.rb
deleted file mode 100644
index 96d53072f..000000000
--- a/app/helpers/diffusion_history_status_helper.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-module DiffusionHistoryStatusHelper
-
-end
\ No newline at end of file
diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb
index faa961084..625cfe4e5 100644
--- a/app/helpers/page_helper.rb
+++ b/app/helpers/page_helper.rb
@@ -1,13 +1,2 @@
module PageHelper
- def get_practices_by_diffusion_histories(facility_id, map_component, names, taglines, short_names, slugs)
- dh = DiffusionHistory.where(va_facility_id: facility_id)
- dh.each do |dh|
- if map_component.practices.include?(dh.practice_id.to_s)
- names.push dh.practice.name
- short_names.push dh.practice.short_name
- taglines.push dh.practice.tagline
- slugs.push dh.practice.slug
- end
- end
- end
end
diff --git a/app/models/page.rb b/app/models/page.rb
index 3c868d948..0968e91e5 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -19,26 +19,6 @@ class Page < ApplicationRecord
private
- def self.get_adopting_facilities(map_component)
- va_facilities_list = []
- map_component.practices.each do |pr|
- diffusion_histories = DiffusionHistory.where(practice_id: pr)
- diffusion_histories.each do |dh|
- dhs = DiffusionHistoryStatus.where(diffusion_history_id: dh[:id]).first.status
- unless dh.va_facility_id.nil?
- if (dhs == 'Completed' || dhs == 'Implemented' || dhs == 'Complete') && map_component.display_successful_adoptions
- va_facilities_list.push dh.va_facility_id
- elsif (dhs == 'In progress' || dhs == 'Planning' || dhs == 'Implementing') && map_component.display_in_progress_adoptions
- va_facilities_list.push dh.va_facility_id
- elsif dhs == "Unsuccessful" && map_component.display_unsuccessful_adoptions
- va_facilities_list.push dh.va_facility_id
- end
- end
- end
- end
- va_facilities_list
- end
-
def downcase_fields
self.slug = self.slug&.downcase
end
diff --git a/app/models/page_map_component.rb b/app/models/page_map_component.rb
index f099b4415..bcd6d2f53 100644
--- a/app/models/page_map_component.rb
+++ b/app/models/page_map_component.rb
@@ -1,3 +1,35 @@
class PageMapComponent < ApplicationRecord
has_one :page_component, as: :component, autosave: true
+
+ def get_practice_data_by_diffusion_histories(facility_id)
+ adoptions = DiffusionHistory.where(va_facility_id: facility_id)
+ info_window_practice_data = []
+ adoptions.each do |adoption|
+ adoption_practice = DiffusionHistory.get_with_practice(adoption.practice).first.practice
+ if practices.include?(adoption_practice.id.to_s)
+ info_window_practice_data << adoption_practice.slice(:name, :short_name, :tagline, :slug)
+ end
+ end
+ info_window_practice_data
+ end
+
+ def get_adopting_facility_ids
+ va_facility_ids = []
+ practices.each do |pr|
+ diffusion_histories = DiffusionHistory.where(practice_id: pr)
+ diffusion_histories.each do |dh|
+ dhs = DiffusionHistoryStatus.where(diffusion_history_id: dh[:id]).first.status
+ unless dh.va_facility_id.nil?
+ if (dhs == 'Completed' || dhs == 'Implemented' || dhs == 'Complete') && display_successful_adoptions
+ va_facility_ids.push dh.va_facility_id
+ elsif (dhs == 'In progress' || dhs == 'Planning' || dhs == 'Implementing') && display_in_progress_adoptions
+ va_facility_ids.push dh.va_facility_id
+ elsif dhs == "Unsuccessful" && display_unsuccessful_adoptions
+ va_facility_ids.push dh.va_facility_id
+ end
+ end
+ end
+ end
+ va_facility_ids
+ end
end
\ No newline at end of file
diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb
index 9ee683680..f0d69ebea 100644
--- a/app/views/maps/_page_map_infowindow.html.erb
+++ b/app/views/maps/_page_map_infowindow.html.erb
@@ -2,33 +2,28 @@
<%
station_name = facility.official_station_name
- facility_id = facility.id
- map_component = @map_component
- names = []
- taglines = []
- short_names = []
- slugs = []
- get_practices_by_diffusion_histories facility_id, map_component, names, taglines, short_names, slugs
- @num_practices_adopted = names.count
+ map_component_short_name = map_component.short_name
%>
<%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link font-sans-md text-bold' %>
- <%= @num_practices_adopted %> <% if @short_name.length > 0 %> <%= @short_name %> <% else %> Total <% end %> Innovation<% if @num_practices_adopted != 1 %>s<% end %>
+ <%= adoption_count %> <%= map_component_short_name.present? ? "#{map_component_short_name}" : 'Total' %> Innovation<%= 's' if adoption_count != 1 %>
- <% i = 0 %>
- <% while i < names.length do %>
+ <% practice_data.each do |pd| %>
+ <%
+ short_name = pd[:short_name]
+ name = pd[:name]
+ %>
- <% i += 1 %>
<% end %>
From 6a9aaad6777132f843d817ed3478a99a9a421afb Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 11 Oct 2022 10:09:43 -0700
Subject: [PATCH 88/99] dm-3508
Update/Refactor short_name column to map_info_window_text
---
app/admin/pages.rb | 4 ++--
.../resource/_page_map_component_form.html.arb | 12 ++++++------
app/views/maps/_page_map_infowindow.html.erb | 8 ++++----
.../20220830113020_create_page_map_components.rb | 2 +-
spec/features/admin/admin_page_spec.rb | 2 +-
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/app/admin/pages.rb b/app/admin/pages.rb
index bd554c28e..cebda935f 100644
--- a/app/admin/pages.rb
+++ b/app/admin/pages.rb
@@ -38,7 +38,7 @@
:display_successful_adoptions,
:display_in_progress_adoptions,
:display_unsuccessful_adoptions,
- :short_name,
+ :map_info_window_text,
:body,
:title_header,
:text_alignment,
@@ -169,7 +169,7 @@
# Attachment file name
para component&.attachment_file_name if pc.component_type == 'PageDownloadableFileComponent'
# Short Name
- para component&.short_name if pc.component_type == 'PageMapComponent' && component&.short_name != ''
+ para component&.map_info_window_text if pc.component_type == 'PageMapComponent' && component&.map_info_window_text!= ''
# Display name
para component&.display_name if pc.component_type == 'PageDownloadableFileComponent' && component&.display_name.present?
diff --git a/app/views/active_admin/resource/_page_map_component_form.html.arb b/app/views/active_admin/resource/_page_map_component_form.html.arb
index 3db814b29..9705a08db 100644
--- a/app/views/active_admin/resource/_page_map_component_form.html.arb
+++ b/app/views/active_admin/resource/_page_map_component_form.html.arb
@@ -20,12 +20,12 @@ html = Arbre::Context.new do
para 'Enter a title for the map.', class: 'inline-hints'
end
- li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_short_name_input" do
- label 'Short Name', for: "page_page_components_attributes_#{placeholder}_component_attributes_short_name", class: 'label'
- input value: component&.short_name || nil, type: 'text', required: 'required',
- id: "page_page_components_attributes_#{placeholder}_component_attributes_short_name",
- name: "page[page_components_attributes][#{placeholder}][component_attributes][short_name]"
- para 'Enter a short name or acronym for the map.', class: 'inline-hints'
+ li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_map_info_window_text_input" do
+ label 'Map Info Window Text', for: "page_page_components_attributes_#{placeholder}_component_attributes_map_info_window_text", class: 'label'
+ input value: component&.map_info_window_text || nil, type: 'text', required: 'required',
+ id: "page_page_components_attributes_#{placeholder}_component_attributes_map_info_window_text",
+ name: "page[page_components_attributes][#{placeholder}][component_attributes][map_info_window_text]"
+ para 'Enter text or acronym to display in the maps info window.', class: 'inline-hints'
end
li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_description_input" do
diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb
index f0d69ebea..8f70b8fe0 100644
--- a/app/views/maps/_page_map_infowindow.html.erb
+++ b/app/views/maps/_page_map_infowindow.html.erb
@@ -2,23 +2,23 @@
<%
station_name = facility.official_station_name
- map_component_short_name = map_component.short_name
+ map_info_window_text = map_component.map_info_window_text
%>
<%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link font-sans-md text-bold' %>
- <%= adoption_count %> <%= map_component_short_name.present? ? "#{map_component_short_name}" : 'Total' %> Innovation<%= 's' if adoption_count != 1 %>
+ <%= adoption_count %> <%= map_info_window_text.present? ? "#{map_info_window_text}" : 'Total' %> Innovation<%= 's' if adoption_count != 1 %>
<% practice_data.each do |pd| %>
<%
- short_name = pd[:short_name]
+ info_window_text = pd[:map_info_window_text]
name = pd[:name]
%>
- <%= short_name.present? ? "#{name} (#{short_name})" : "#{name}" %>
+ <%= info_window_text.present? ? "#{name} (#{info_window_text})" : "#{name}" %>
<%= pd[:tagline] %>
diff --git a/db/migrate/20220830113020_create_page_map_components.rb b/db/migrate/20220830113020_create_page_map_components.rb
index ae3afcb91..305524625 100644
--- a/db/migrate/20220830113020_create_page_map_components.rb
+++ b/db/migrate/20220830113020_create_page_map_components.rb
@@ -3,7 +3,7 @@ def change
create_table :page_map_components, id: :uuid do |t|
t.belongs_to :page_component, foreign_key: true
t.string :title
- t.string :short_name
+ t.string :map_info_window_text
t.string :description
t.string :practices, array: true, default: []
t.boolean :display_successful_adoptions, default: false
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index 1d91e4634..765e612a0 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -235,7 +235,7 @@ def expect_page_component_image_to_not_be_saved
click_link('Add New Page component')
select('Google Map', from: 'page_page_components_attributes_0_component_type')
fill_in("page_page_components_attributes_0_component_attributes_title", with: 'Diffusion Map')
- fill_in("page_page_components_attributes_0_component_attributes_short_name", with: 'Diffusion Map short name')
+ fill_in("page_page_components_attributes_0_component_attributes_map_info_window_text", with: 'Diffusion Map Info Window Text')
select('Best Innovation Ever', from: 'page_page_components_attributes_0_component_attributes_map')
save_page
expect(page).to have_content('Page was successfully updated.')
From 18a24486216af9a1f121708a3b015eb651cddde7 Mon Sep 17 00:00:00 2001
From: Brad Johnson
Date: Tue, 11 Oct 2022 10:37:11 -0700
Subject: [PATCH 89/99] dm-3508
updated page_map_component.short_name field to map_info_window_text.
---
db/schema.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/db/schema.rb b/db/schema.rb
index e19fe2208..5c04b6e5b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -666,7 +666,7 @@
create_table "page_map_components", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.bigint "page_component_id"
t.string "title"
- t.string "short_name"
+ t.string "map_info_window_text"
t.string "description"
t.string "practices", default: [], array: true
t.boolean "display_successful_adoptions", default: false
From 4eeff5e1dc71c13f60d30e12f4836b700cdf1631 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 11 Oct 2022 10:49:31 -0700
Subject: [PATCH 90/99] dm-3508
Update tests for map due to column name change.
---
spec/features/pages/show_page_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index d0d9e31b2..e50cd4636 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -90,7 +90,7 @@
downloadable_file_component = PageDownloadableFileComponent.create(attachment: downloadable_file, description: 'Test file')
paragraph_component = PageParagraphComponent.create(text: "")
legacy_paragraph_component = PageParagraphComponent.create(text: "")
- map_component = PageMapComponent.create(title: "test map", short_name: "map short name", description: "map description", practices: [1, 2, 3], display_successful_adoptions: true, display_in_progress_adoptions: true, display_unsuccessful_adoptions: true)
+ map_component = PageMapComponent.create(title: "test map", map_info_window_text: "map info window text", description: "map description", practices: [1, 2, 3], display_successful_adoptions: true, display_in_progress_adoptions: true, display_unsuccessful_adoptions: true)
accordion_component = PageAccordionComponent.create(title: 'FAQ 1', text: 'FAQ 1 text')
accordion_component_2 = PageAccordionComponent.create(title: 'FAQ 2', text: 'FAQ 2 text')
PageComponent.create(page: @page, component: practice_list_component, created_at: Time.now)
From 428d5a84b9b32fc64bedd41edeca56aaf04b07a2 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 11 Oct 2022 10:58:31 -0700
Subject: [PATCH 91/99] dm-3508
update spec for page_map_component field name change.
---
spec/features/admin/admin_page_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/features/admin/admin_page_spec.rb b/spec/features/admin/admin_page_spec.rb
index 765e612a0..223261ffc 100644
--- a/spec/features/admin/admin_page_spec.rb
+++ b/spec/features/admin/admin_page_spec.rb
@@ -241,7 +241,7 @@ def expect_page_component_image_to_not_be_saved
expect(page).to have_content('Page was successfully updated.')
expect(page).to have_content('Google Map')
expect(page).to have_content('Diffusion Map')
- expect(page).to have_content('Diffusion Map short name')
+ expect(page).to have_content('Diffusion Map Info Window Text')
end
end
end
From c73faf1f11c7bdce5ee94e25bd74bb6d10612a27 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 11 Oct 2022 15:47:24 -0700
Subject: [PATCH 92/99] dm-3508
pr comments.
---
app/admin/pages.rb | 4 +-
app/views/page/show.html.erb | 19 ++++---
db/schema.rb | 26 ----------
spec/features/pages/show_page_spec.rb | 74 +++++++++++++--------------
4 files changed, 50 insertions(+), 73 deletions(-)
diff --git a/app/admin/pages.rb b/app/admin/pages.rb
index 884861c5b..fe9636042 100644
--- a/app/admin/pages.rb
+++ b/app/admin/pages.rb
@@ -174,8 +174,8 @@
para component&.alt_text if pc.component_type == 'PageImageComponent'
# Attachment file name
para component&.attachment_file_name if pc.component_type == 'PageDownloadableFileComponent'
- # Short Name
- para component&.map_info_window_text if pc.component_type == 'PageMapComponent' && component&.map_info_window_text!= ''
+ # Map Info Window Text
+ para component&.map_info_window_text if pc.component_type == 'PageMapComponent' && component&.map_info_window_text != ''
# Display name
para component&.display_name if pc.component_type == 'PageDownloadableFileComponent' && component&.display_name.present?
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb
index 354f7213a..598b0491b 100644
--- a/app/views/page/show.html.erb
+++ b/app/views/page/show.html.erb
@@ -215,17 +215,20 @@
title = component.title
next_component = @page.page_components.find_by(position: pc.position + 1)
%>
-
- <%= content_tag(:span, title, class: 'margin-right-1') if title.present? %>
-
+ <% if title.present? %>
+
+ <%= content_tag(:span, title, class: 'margin-right-1') %>
+
+ <% end %>
<%= render partial: "page/page_map", locals: { component: component } %>
-
- <%= content_tag(:span, description, class: 'margin-right-1') if description != '' %>
-
-
- <%# Text and Images %>
+ <% if description.present? %>
+
+ <%= content_tag(:span, description, class: 'margin-right-1') %>
+
+ <% end %>
+ <%# Text and Images %>
<% when 'PageCompoundBodyComponent' %>
<%= "margin-top-#{component.margin_top}" %><%= page_narrow_classes %>">
diff --git a/db/schema.rb b/db/schema.rb
index 6227421f4..e17c6c253 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -12,7 +12,6 @@
ActiveRecord::Schema.define(version: 2022_09_26_221108) do
-
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@@ -286,31 +285,6 @@
t.index ["commontable_type", "commontable_id"], name: "index_commontator_threads_on_c_id_and_c_type", unique: true
end
- create_table "communities", force: :cascade do |t|
- t.string "name"
- t.string "slug"
- t.string "distribution_email"
- t.text "home_description"
- t.string "intro_header"
- t.text "intro_text"
- t.string "external_url"
- t.text "quote_text"
- t.string "quote_name"
- t.text "about_description"
- t.text "leader_bio"
- t.text "featured_practice_description"
- t.datetime "created_at", precision: 6, null: false
- t.datetime "updated_at", precision: 6, null: false
- t.string "home_image_file_name"
- t.string "home_image_content_type"
- t.bigint "home_image_file_size"
- t.datetime "home_image_updated_at"
- t.string "featured_practice_image_file_name"
- t.string "featured_practice_image_content_type"
- t.bigint "featured_practice_image_file_size"
- t.datetime "featured_practice_image_updated_at"
- end
-
create_table "costs", force: :cascade do |t|
t.string "description"
t.integer "position"
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index c57c87304..0186305de 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -15,7 +15,7 @@
Practice.create!(name: 'The last practice', approved: true, published: true, tagline: 'Test tagline', user: user)
]
@visn_1 = Visn.create!(name: 'VISN 1', number: 1)
- @visn_2 = Visn.create!(name: 'VISN 2', number: 3)
+ # @visn_2 = Visn.create!(name: 'VISN 2', number: 3)
@fac_1 = VaFacility.create!(
visn: @visn_1,
station_number: "402GA",
@@ -28,45 +28,45 @@
fy17_parent_station_complexity_level: "1c-High Complexity",
station_phone_number: "207-623-2123 x"
)
- @fac_2 = VaFacility.create!(
- visn: @visn_2,
- station_number: "526GA",
- official_station_name: "White Plains VA Clinic",
- common_name: "White Plains",
- latitude: "41.03280396",
- longitude: "-73.76256942",
- street_address_state: "NY",
- rurality: "U",
- fy17_parent_station_complexity_level: "1b-High Complexity",
- station_phone_number: "207-623-2123 x"
- )
- @fac_3 = VaFacility.create!(
- visn: @visn_2,
- station_number: "526GB",
- official_station_name: "Yonkers VA Clinic",
- common_name: "Yonkers",
- latitude: "40.93287478",
- longitude: "-73.89691934",
- street_address_state: "NY",
- rurality: "U",
- fy17_parent_station_complexity_level: "1a-High Complexity",
- station_phone_number: "207-623-2123 x"
- )
+ # @fac_2 = VaFacility.create!(
+ # visn: @visn_2,
+ # station_number: "526GA",
+ # official_station_name: "White Plains VA Clinic",
+ # common_name: "White Plains",
+ # latitude: "41.03280396",
+ # longitude: "-73.76256942",
+ # street_address_state: "NY",
+ # rurality: "U",
+ # fy17_parent_station_complexity_level: "1b-High Complexity",
+ # station_phone_number: "207-623-2123 x"
+ # )
+ # @fac_3 = VaFacility.create!(
+ # visn: @visn_2,
+ # station_number: "526GB",
+ # official_station_name: "Yonkers VA Clinic",
+ # common_name: "Yonkers",
+ # latitude: "40.93287478",
+ # longitude: "-73.89691934",
+ # street_address_state: "NY",
+ # rurality: "U",
+ # fy17_parent_station_complexity_level: "1a-High Complexity",
+ # station_phone_number: "207-623-2123 x"
+ # )
dh_1 = DiffusionHistory.create!(practice: @practices[0], va_facility: @fac_1)
DiffusionHistoryStatus.create!(diffusion_history: dh_1, status: 'Completed')
- dh_2 = DiffusionHistory.create!(practice: @practices[1], va_facility: @fac_2)
- DiffusionHistoryStatus.create!(diffusion_history: dh_2, status: 'Implemented')
- dh_3 = DiffusionHistory.create!(practice: @practices[2], va_facility: @fac_1)
- DiffusionHistoryStatus.create!(diffusion_history: dh_3, status: 'Planning')
- dh_4 = DiffusionHistory.create!(practice: @practices[3], va_facility: @fac_1)
- DiffusionHistoryStatus.create!(diffusion_history: dh_4, status: 'In progress')
- dh_5 = DiffusionHistory.create!(practice: @practices[4], va_facility: @fac_2)
- DiffusionHistoryStatus.create!(diffusion_history: dh_5, status: 'Implementing')
- dh_6 = DiffusionHistory.create!(practice: @practices[5], va_facility: @fac_3)
- DiffusionHistoryStatus.create!(diffusion_history: dh_6, status: 'Unsuccessful', unsuccessful_reasons: [0])
- dh_7 = DiffusionHistory.create!(practice: @practices[6], va_facility: @fac_3)
- DiffusionHistoryStatus.create!(diffusion_history: dh_7, status: 'Unsuccessful', unsuccessful_reasons: [0])
+ # dh_2 = DiffusionHistory.create!(practice: @practices[1], va_facility: @fac_2)
+ # DiffusionHistoryStatus.create!(diffusion_history: dh_2, status: 'Implemented')
+ # dh_3 = DiffusionHistory.create!(practice: @practices[2], va_facility: @fac_1)
+ # DiffusionHistoryStatus.create!(diffusion_history: dh_3, status: 'Planning')
+ # dh_4 = DiffusionHistory.create!(practice: @practices[3], va_facility: @fac_1)
+ # DiffusionHistoryStatus.create!(diffusion_history: dh_4, status: 'In progress')
+ # dh_5 = DiffusionHistory.create!(practice: @practices[4], va_facility: @fac_2)
+ # DiffusionHistoryStatus.create!(diffusion_history: dh_5, status: 'Implementing')
+ # dh_6 = DiffusionHistory.create!(practice: @practices[5], va_facility: @fac_3)
+ # DiffusionHistoryStatus.create!(diffusion_history: dh_6, status: 'Unsuccessful', unsuccessful_reasons: [0])
+ # dh_7 = DiffusionHistory.create!(practice: @practices[6], va_facility: @fac_3)
+ # DiffusionHistoryStatus.create!(diffusion_history: dh_7, status: 'Unsuccessful', unsuccessful_reasons: [0])
page_group = PageGroup.create(name: 'programming', slug: 'programming', description: 'Pages about programming go in this group.')
@page = Page.create(page_group: page_group, title: 'ruby', description: 'what a gem', slug: 'ruby-rocks', has_chrome_warning_banner: true, created_at: Time.now, published: Time.now)
From 200913050dc7e36c863814003262c3b6f57eecde Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Tue, 11 Oct 2022 17:43:39 -0700
Subject: [PATCH 93/99] dm-3508
INfo Window styles.
---
app/assets/javascripts/page/page_infowindow.coffee | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee
index a95b0e005..451f8fb42 100644
--- a/app/assets/javascripts/page/page_infowindow.coffee
+++ b/app/assets/javascripts/page/page_infowindow.coffee
@@ -2,7 +2,6 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba
# override method
create_infowindow: ->
return null unless _.isString @args.infowindow
-
boxText = document.createElement("div")
boxText.setAttribute('class', 'page-marker-container') #to customize
boxText.innerHTML = @args.infowindow
@@ -12,10 +11,10 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba
infobox: (boxText)->
content: boxText
- pixelOffset: new google.maps.Size(-260, 150)
+ pixelOffset: new google.maps.Size(-225, 150)
boxStyle: {
- width: "540px",
- height: "300px",
+ maxWidth: "450px",
+ maxHeight: "300px",
overflow: "auto",
backgroundColor: "white",
paddingBottom: "52px"
From f283dddb3fc63dad419c0911b5c746ecffb2a9f4 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 12 Oct 2022 09:45:34 -0700
Subject: [PATCH 94/99] dm-3508
Decrease maxWidth and maxHeight
---
app/assets/javascripts/page/page_infowindow.coffee | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee
index 451f8fb42..756a45f15 100644
--- a/app/assets/javascripts/page/page_infowindow.coffee
+++ b/app/assets/javascripts/page/page_infowindow.coffee
@@ -13,8 +13,8 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba
content: boxText
pixelOffset: new google.maps.Size(-225, 150)
boxStyle: {
- maxWidth: "450px",
- maxHeight: "300px",
+ maxWidth: "400px",
+ maxHeight: "275px",
overflow: "auto",
backgroundColor: "white",
paddingBottom: "52px"
From 377a4ca7c37bf2db01b42ed236fe621312906e13 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 12 Oct 2022 09:47:41 -0700
Subject: [PATCH 95/99] dm-3508
removed commented code from spec.
---
spec/features/pages/show_page_spec.rb | 36 ---------------------------
1 file changed, 36 deletions(-)
diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb
index 0186305de..ecf39ad55 100644
--- a/spec/features/pages/show_page_spec.rb
+++ b/spec/features/pages/show_page_spec.rb
@@ -28,45 +28,9 @@
fy17_parent_station_complexity_level: "1c-High Complexity",
station_phone_number: "207-623-2123 x"
)
- # @fac_2 = VaFacility.create!(
- # visn: @visn_2,
- # station_number: "526GA",
- # official_station_name: "White Plains VA Clinic",
- # common_name: "White Plains",
- # latitude: "41.03280396",
- # longitude: "-73.76256942",
- # street_address_state: "NY",
- # rurality: "U",
- # fy17_parent_station_complexity_level: "1b-High Complexity",
- # station_phone_number: "207-623-2123 x"
- # )
- # @fac_3 = VaFacility.create!(
- # visn: @visn_2,
- # station_number: "526GB",
- # official_station_name: "Yonkers VA Clinic",
- # common_name: "Yonkers",
- # latitude: "40.93287478",
- # longitude: "-73.89691934",
- # street_address_state: "NY",
- # rurality: "U",
- # fy17_parent_station_complexity_level: "1a-High Complexity",
- # station_phone_number: "207-623-2123 x"
- # )
dh_1 = DiffusionHistory.create!(practice: @practices[0], va_facility: @fac_1)
DiffusionHistoryStatus.create!(diffusion_history: dh_1, status: 'Completed')
- # dh_2 = DiffusionHistory.create!(practice: @practices[1], va_facility: @fac_2)
- # DiffusionHistoryStatus.create!(diffusion_history: dh_2, status: 'Implemented')
- # dh_3 = DiffusionHistory.create!(practice: @practices[2], va_facility: @fac_1)
- # DiffusionHistoryStatus.create!(diffusion_history: dh_3, status: 'Planning')
- # dh_4 = DiffusionHistory.create!(practice: @practices[3], va_facility: @fac_1)
- # DiffusionHistoryStatus.create!(diffusion_history: dh_4, status: 'In progress')
- # dh_5 = DiffusionHistory.create!(practice: @practices[4], va_facility: @fac_2)
- # DiffusionHistoryStatus.create!(diffusion_history: dh_5, status: 'Implementing')
- # dh_6 = DiffusionHistory.create!(practice: @practices[5], va_facility: @fac_3)
- # DiffusionHistoryStatus.create!(diffusion_history: dh_6, status: 'Unsuccessful', unsuccessful_reasons: [0])
- # dh_7 = DiffusionHistory.create!(practice: @practices[6], va_facility: @fac_3)
- # DiffusionHistoryStatus.create!(diffusion_history: dh_7, status: 'Unsuccessful', unsuccessful_reasons: [0])
page_group = PageGroup.create(name: 'programming', slug: 'programming', description: 'Pages about programming go in this group.')
@page = Page.create(page_group: page_group, title: 'ruby', description: 'what a gem', slug: 'ruby-rocks', has_chrome_warning_banner: true, created_at: Time.now, published: Time.now)
From b3bdd977729d5f8a9e54fc149d94a458b4eb9712 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 12 Oct 2022 10:06:06 -0700
Subject: [PATCH 96/99] dm-3508
adjustedpixel offset for new maxWidth, maxHeight.
---
app/assets/javascripts/page/page_infowindow.coffee | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee
index 756a45f15..66f35fac4 100644
--- a/app/assets/javascripts/page/page_infowindow.coffee
+++ b/app/assets/javascripts/page/page_infowindow.coffee
@@ -11,7 +11,7 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba
infobox: (boxText)->
content: boxText
- pixelOffset: new google.maps.Size(-225, 150)
+ pixelOffset: new google.maps.Size(-200, 137)
boxStyle: {
maxWidth: "400px",
maxHeight: "275px",
From 886f7fbc7349dd44f8822dbf92d2c41dfe8ef7d8 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 12 Oct 2022 10:46:51 -0700
Subject: [PATCH 97/99] dm-3508
Fix indent for comment headers.
---
app/views/page/show.html.erb | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb
index 598b0491b..4a9d870b5 100644
--- a/app/views/page/show.html.erb
+++ b/app/views/page/show.html.erb
@@ -36,7 +36,7 @@
<% end %>
- <%# Page Header 3 %>
+ <%# Page Header 3 %>
<% when 'PageHeader3Component' %>
@@ -49,11 +49,11 @@
<% end %>
- <%# Page Horizontal Line %>
+ <%# Page Horizontal Line %>
<% when 'PageHrComponent' %>
- <%# Accordion %>
+ <%# Accordion %>
<% when 'PageAccordionComponent' %>
<% accordion_ctr += 1 %>
@@ -73,7 +73,7 @@
- <%# CTA %>
+ <%# CTA %>
<% when 'PageCtaComponent' %>
@@ -118,7 +118,6 @@
<% when 'PageNewsComponent' %>
<% component_index = 0 %>
<% nic = @news_items_components[0] %>
-
<% if component.id == @news_items_ids.first %>
<%= render partial:'news_items_list', locals: {news_items: nic[:news]} %>
@@ -131,8 +130,8 @@
<% end %>
<% end %>
- <%# Practice List %>
- <%# note: everything EXCEPT Practice List has the page_narrow_classes applied %>
+ <%# Practice List %>
+ <%# note: everything EXCEPT Practice List has the page_narrow_classes applied %>
<% when 'PagePracticeListComponent' %>
<%
component_index = @practice_list_component_index
@@ -152,7 +151,8 @@
<% end %>
<% end %>
- <%# Subpage Hyperlink %>
+
+ <%# Subpage Hyperlink %>
<% when 'PageSubpageHyperlinkComponent' %>
<% if component.card? %>
@@ -183,7 +183,7 @@
<% end %>
- <%# YouTube Player %>
+ <%# YouTube Player %>
<% when 'PageYouTubePlayerComponent' %>
<%= youtube_embed(component.url) %>
@@ -194,7 +194,7 @@
<% end %>
- <%# Downloadable File %>
+ <%# Downloadable File %>
<% when 'PageDownloadableFileComponent' %>
<%
description = component.description
@@ -208,7 +208,7 @@
<% end %>
- <%# Map Component %>
+ <%# Map Component %>
<% when 'PageMapComponent' %>
<%
description = component.description
@@ -228,7 +228,7 @@
<%= content_tag(:span, description, class: 'margin-right-1') %>
<% end %>
- <%# Text and Images %>
+ <%# Text and Images %>
<% when 'PageCompoundBodyComponent' %>
<%= "margin-top-#{component.margin_top}" %><%= page_narrow_classes %>">
From cb3902446ff06651873cb18bf51ecf6671f234f3 Mon Sep 17 00:00:00 2001
From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com>
Date: Wed, 12 Oct 2022 11:14:39 -0700
Subject: [PATCH 98/99] dm-3508
revert back to "if" instead of "unless"
---
app/admin/pages.rb | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/app/admin/pages.rb b/app/admin/pages.rb
index fe9636042..346fec2b6 100644
--- a/app/admin/pages.rb
+++ b/app/admin/pages.rb
@@ -118,16 +118,11 @@
# Alignment
para "Alignment: #{component&.alignment}" if pc.component_type == 'PageHeader3Component'
# Text
- para component&.text.html_safe unless (pc.component_type == 'PageHrComponent' ||
- pc.component_type == 'PagePracticeListComponent' ||
- pc.component_type == 'PageHeader2Component' ||
- pc.component_type == 'PageSubpageHyperlinkComponent' ||
- pc.component_type == 'PageHeader3Component' ||
- pc.component_type == 'PageYouTubePlayerComponent' ||
- pc.component_type == 'PageImageComponent' ||
- pc.component_type == 'PageDownloadableFileComponent' ||
- pc.component_type == 'PageCtaComponent' ||
- pc.component_type == 'PageMapComponent')
+ if (pc.component_type == 'PageAccordionComponent' ||
+ pc.component_type == 'PageParagraphComponent' ||
+ pc.component_type == 'PageCompoundBodyComponent') && component&.text.present?
+ para component.text.html_safe
+ end
# Title header
para "Title header: #{component&.title_header}" if pc.component_type == 'PageCompoundBodyComponent' && component&.title_header.present?
From 7c9a781bef98c88e43edcf5bba2baa3670fcf645 Mon Sep 17 00:00:00 2001
From: Joshua Drumm
Date: Wed, 12 Oct 2022 14:25:19 -0400
Subject: [PATCH 99/99] Removed duplicate code in admin/pages.rb
---
app/admin/pages.rb | 7 -------
1 file changed, 7 deletions(-)
diff --git a/app/admin/pages.rb b/app/admin/pages.rb
index 346fec2b6..8a06df140 100644
--- a/app/admin/pages.rb
+++ b/app/admin/pages.rb
@@ -117,13 +117,6 @@
para component&.subtopic_description if pc.component_type == 'PageHeader2Component'
# Alignment
para "Alignment: #{component&.alignment}" if pc.component_type == 'PageHeader3Component'
- # Text
- if (pc.component_type == 'PageAccordionComponent' ||
- pc.component_type == 'PageParagraphComponent' ||
- pc.component_type == 'PageCompoundBodyComponent') && component&.text.present?
- para component.text.html_safe
- end
-
# Title header
para "Title header: #{component&.title_header}" if pc.component_type == 'PageCompoundBodyComponent' && component&.title_header.present?
# Title