From 81bbc5ae231ecc317536d3e5419eb02ded89296e Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:20:44 -0700 Subject: [PATCH 01/99] dm-3508 Adding support/dependencies for map component. --- app/admin/pages.rb | 3 ++ app/models/page_component.rb | 3 +- app/models/page_map_component.rb | 3 ++ .../resource/_page_components_form.html.arb | 1 + .../_page_map_component_form.html.arb | 54 +++++++++++++++++++ app/views/page/show.html.erb | 13 +++++ 6 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 app/models/page_map_component.rb create mode 100644 app/views/active_admin/resource/_page_map_component_form.html.arb diff --git a/app/admin/pages.rb b/app/admin/pages.rb index 92af5f133..0316a00fc 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -41,6 +41,7 @@ end show do + debugger attributes_table do row('Complete URL') { |page| page_link = page.slug == 'home' ? "/#{page.page_group.friendly_id}" : "/#{page.page_group.friendly_id}/#{page.slug}" @@ -78,6 +79,7 @@ para component&.attachment_file_name if pc.component_type == 'PageDownloadableFileComponent' para component&.display_name if pc.component_type == 'PageDownloadableFileComponent' && component&.display_name != '' para component&.description if pc.component_type == 'PageDownloadableFileComponent' && component&.description != '' + para component&.description if pc.component_type == 'PageMapComponent' && component&.description != '' end }.join('').html_safe end @@ -126,6 +128,7 @@ end f.inputs "Page Components" do + debugger render partial: 'page_components_form', locals: {f: f, page_components: :page_components} end f.actions # adds the 'Submit' and 'Cancel' buttons diff --git a/app/models/page_component.rb b/app/models/page_component.rb index 665f32463..9b89c43f5 100644 --- a/app/models/page_component.rb +++ b/app/models/page_component.rb @@ -25,7 +25,8 @@ def destroy_component 'Practices': 'PagePracticeListComponent', 'Subpage Hyperlink': 'PageSubpageHyperlinkComponent', 'YouTube Player': 'PageYouTubePlayerComponent', - 'Horizontal Separator': 'PageHrComponent' + 'Horizontal Separator': 'PageHrComponent', + 'Google Map': 'PageMapComponent' } def build_component(params) diff --git a/app/models/page_map_component.rb b/app/models/page_map_component.rb new file mode 100644 index 000000000..f099b4415 --- /dev/null +++ b/app/models/page_map_component.rb @@ -0,0 +1,3 @@ +class PageMapComponent < ApplicationRecord + has_one :page_component, as: :component, autosave: true +end \ No newline at end of file diff --git a/app/views/active_admin/resource/_page_components_form.html.arb b/app/views/active_admin/resource/_page_components_form.html.arb index 5b328d30e..2cf8d656e 100644 --- a/app/views/active_admin/resource/_page_components_form.html.arb +++ b/app/views/active_admin/resource/_page_components_form.html.arb @@ -14,4 +14,5 @@ f.has_many page_components, heading: nil, sortable: :position, sortable_start: 1 pc.template.concat(render partial: 'page_hr_component_form', locals: {component: component.class == PageHrComponent ? component : nil, placeholder: placeholder}) pc.template.concat(render partial: 'page_downloadable_file_component_form', locals: {component: component.class == PageDownloadableFileComponent ? component : nil, placeholder: placeholder}) pc.template.concat(render partial: 'page_cta_component_form', locals: {component: component.class == PageCtaComponent ? component : nil, placeholder: placeholder}) + pc.template.concat(render partial: 'page_map_component_form', locals: {component: component.class == PageMapComponent ? component : nil, placeholder: placeholder}) end 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 new file mode 100644 index 000000000..641113ffa --- /dev/null +++ b/app/views/active_admin/resource/_page_map_component_form.html.arb @@ -0,0 +1,54 @@ +# TODO: get the placeholder how active admin does "NEW_#{association_human_name.upcase.split(' ').join('_')}_RECORD" +placeholder ||= 'NEW_PAGE_COMPONENT_RECORD' # = "NEW_#{association_human_name.upcase.split(' ').join('_')}_RECORD" +component ||= nil +debugger +html = Arbre::Context.new do + li "", id: "PageMapComponent_poly_#{placeholder}", class: "input polyform component-#{placeholder}" do + fieldset class: "inputs" do + legend do + span 'Map' + end + ol do + if component + input type: 'hidden', value: component.id, name: "page[page_components_attributes][#{placeholder}][component_attributes][id]" + end + + li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_url_input" do + label 'Subpage URL suffix', for: "page_page_components_attributes_#{placeholder}_component_attributes_url", class: 'label' + input value: component&.url || nil, type: 'text', required: 'required', + id: "page_page_components_attributes_#{placeholder}_component_attributes_url", + name: "page[page_components_attributes][#{placeholder}][component_attributes][url]" + para 'Enter a brief and descriptive URL suffix to any internal page of the marketplace (Ex: "/innovations/vione", "/partners", "/covid-19/telehealth"', class: 'inline-hints' + end + + li class: 'string input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_title_input" do + input value: component&.title || nil, type: 'text', required: 'required', + id: "page_page_components_attributes_#{placeholder}_component_attributes_title", + name: "page[page_components_attributes][#{placeholder}][component_attributes][title]" + label 'Subpage title', for: "page_page_components_attributes_#{placeholder}_component_attributes_title" + para 'Title of subpage styled as secondary heading/"H2"', class: 'inline-hints' + end + + li class: 'string input optional stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_description_input" do + label 'Subpage description', for: "page_page_components_attributes_#{placeholder}_component_attributes_description", class: 'label' + input value: component&.description || nil, type: 'text', + id: "page_page_components_attributes_#{placeholder}_component_attributes_description", + name: "page[page_components_attributes][#{placeholder}][component_attributes][description]" + end + + li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_card_input" do + if component + input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][card]" + end + label 'Add card styling', for: "page_page_components_attributes_#{placeholder}_component_attributes_card", class: 'label' + input value: '1', type: 'checkbox', checked: component&.card?, + id: "page_page_components_attributes_#{placeholder}_component_attributes_card", + name: "page[page_components_attributes][#{placeholder}][component_attributes][card]", + class: "toggle-card-styling" + end + end + end + end +end + +return html.to_s \ No newline at end of file diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index e9f63f587..6e7a3780b 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -174,6 +174,19 @@ <%= display_name != '' ? display_name : component.attachment_file_name %> <% end %> + <% when 'PageMapComponent' %> + <% + debugger + description = component.description + display_name = component.display_name + next_component = @page.page_components.find_by(position: pc.position + 1) + %> +
+ <%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> + <%= link_to component.attachment_s3_presigned_url, class: 'usa-link usa-link--external', target: '_blank', download: display_name != '' ? display_name : component.attachment_file_name do %> + <%= display_name != '' ? display_name : component.attachment_file_name %> + <% end %> +
<% end %> <% end %> From 379497bdae83fded50d63e724e624f91effff06a Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:29:40 -0700 Subject: [PATCH 02/99] dm-3508 Page Builder UI --- .../_page_map_component_form.html.arb | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 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 641113ffa..0d9ff7156 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 @@ -12,13 +12,25 @@ html = Arbre::Context.new do if component input type: 'hidden', value: component.id, name: "page[page_components_attributes][#{placeholder}][component_attributes][id]" end + 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' + li class: 'select input optional', id: "page_page_components_attributes_#{placeholder}_practices_attributes_input" do + label 'Practice List', for: "page_page_components_attributes_#{placeholder}_component_attributes_practice_list", class: 'label' + select required: 'required', multiple: 'multiple', size: '20', + id: "page_page_components_attributes_#{placeholder}_component_attributes_practice_list", + name: "page[page_components_attributes][#{placeholder}][component_attributes][practices][]" do + Practice.order(name: :asc).each do |p| + option p.name, value: p.id, selected: component&.practices&.include?(p.id.to_s) ? 'selected' : nil + end + end + end + - li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_url_input" do - label 'Subpage URL suffix', for: "page_page_components_attributes_#{placeholder}_component_attributes_url", class: 'label' - input value: component&.url || nil, type: 'text', required: 'required', - id: "page_page_components_attributes_#{placeholder}_component_attributes_url", - name: "page[page_components_attributes][#{placeholder}][component_attributes][url]" - para 'Enter a brief and descriptive URL suffix to any internal page of the marketplace (Ex: "/innovations/vione", "/partners", "/covid-19/telehealth"', class: 'inline-hints' + li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_description_input" do + label 'Description', for: "page_page_components_attributes_#{placeholder}_component_attributes_description", class: 'label' + input value: component&.description || nil, type: 'text', required: 'required', + id: "page_page_components_attributes_#{placeholder}_component_attributes_description", + name: "page[page_components_attributes][#{placeholder}][component_attributes][description]" + para 'Enter a brief description of the map.', class: 'inline-hints' end li class: 'string input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_title_input" do @@ -28,24 +40,6 @@ html = Arbre::Context.new do label 'Subpage title', for: "page_page_components_attributes_#{placeholder}_component_attributes_title" para 'Title of subpage styled as secondary heading/"H2"', class: 'inline-hints' end - - li class: 'string input optional stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_description_input" do - label 'Subpage description', for: "page_page_components_attributes_#{placeholder}_component_attributes_description", class: 'label' - input value: component&.description || nil, type: 'text', - id: "page_page_components_attributes_#{placeholder}_component_attributes_description", - name: "page[page_components_attributes][#{placeholder}][component_attributes][description]" - end - - li class: 'checkbox input optional', id: "page_page_components_attributes_#{placeholder}_component_attributes_card_input" do - if component - input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][card]" - end - label 'Add card styling', for: "page_page_components_attributes_#{placeholder}_component_attributes_card", class: 'label' - input value: '1', type: 'checkbox', checked: component&.card?, - id: "page_page_components_attributes_#{placeholder}_component_attributes_card", - name: "page[page_components_attributes][#{placeholder}][component_attributes][card]", - class: "toggle-card-styling" - end end end end From 789e7d52b11a3d7ca55af5098a2a6dc98e4e50e9 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:42:36 -0700 Subject: [PATCH 03/99] dm-3508 --- .../_page_map_component_form.html.arb | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 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 0d9ff7156..9f59a15a0 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 @@ -1,7 +1,6 @@ # TODO: get the placeholder how active admin does "NEW_#{association_human_name.upcase.split(' ').join('_')}_RECORD" placeholder ||= 'NEW_PAGE_COMPONENT_RECORD' # = "NEW_#{association_human_name.upcase.split(' ').join('_')}_RECORD" component ||= nil -debugger html = Arbre::Context.new do li "", id: "PageMapComponent_poly_#{placeholder}", class: "input polyform component-#{placeholder}" do fieldset class: "inputs" do @@ -12,18 +11,14 @@ html = Arbre::Context.new do if component input type: 'hidden', value: component.id, name: "page[page_components_attributes][#{placeholder}][component_attributes][id]" end - 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' - li class: 'select input optional', id: "page_page_components_attributes_#{placeholder}_practices_attributes_input" do - label 'Practice List', for: "page_page_components_attributes_#{placeholder}_component_attributes_practice_list", class: 'label' - select required: 'required', multiple: 'multiple', size: '20', - id: "page_page_components_attributes_#{placeholder}_component_attributes_practice_list", - name: "page[page_components_attributes][#{placeholder}][component_attributes][practices][]" do - Practice.order(name: :asc).each do |p| - option p.name, value: p.id, selected: component&.practices&.include?(p.id.to_s) ? 'selected' : nil - end - end - end + li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_title_input" do + label 'Title', for: "page_page_components_attributes_#{placeholder}_component_attributes_title", class: 'label' + input value: component&.description || nil, type: 'text', required: 'required', + id: "page_page_components_attributes_#{placeholder}_component_attributes_title", + name: "page[page_components_attributes][#{placeholder}][component_attributes][title]" + 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_description_input" do label 'Description', for: "page_page_components_attributes_#{placeholder}_component_attributes_description", class: 'label' @@ -33,13 +28,25 @@ html = Arbre::Context.new do para 'Enter a brief description of the map.', class: 'inline-hints' end - li class: 'string input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_title_input" do + li class: 'select input optional', id: "page_page_components_attributes_#{placeholder}_practices_attributes_input" do + label 'Innovation List', for: "page_page_components_attributes_#{placeholder}_component_attributes_map", class: 'label' + select required: 'required', multiple: 'multiple', size: '20', + id: "page_page_components_attributes_#{placeholder}_component_attributes_map", + name: "page[page_components_attributes][#{placeholder}][component_attributes][practices][]" do + Practice.order(name: :asc).each do |p| + option p.name, value: p.id, selected: component&.practices&.include?(p.id.to_s) ? 'selected' : nil + end + end + 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: 'string input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_adoption_status_input" do input value: component&.title || nil, type: 'text', required: 'required', - id: "page_page_components_attributes_#{placeholder}_component_attributes_title", - name: "page[page_components_attributes][#{placeholder}][component_attributes][title]" - label 'Subpage title', for: "page_page_components_attributes_#{placeholder}_component_attributes_title" - para 'Title of subpage styled as secondary heading/"H2"', class: 'inline-hints' + id: "page_page_components_attributes_#{placeholder}_component_attributes_adoption_status", + name: "page[page_components_attributes][#{placeholder}][component_attributes][adoption_status]" + label 'Adoption Statuses to Display', for: "page_page_components_attributes_#{placeholder}_component_attributes_adoption_status" end + para 'Adoption Statuses (S, U, P)', class: 'inline-hints' end end end From f3c71d5f553f3a4b416c2a03f6d52c4f9ec43b57 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:47:30 -0700 Subject: [PATCH 04/99] dm-3508 documenting page_map_components schema --- app/models/page_map_component.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/page_map_component.rb b/app/models/page_map_component.rb index f099b4415..97a2b3c17 100644 --- a/app/models/page_map_component.rb +++ b/app/models/page_map_component.rb @@ -1,3 +1,10 @@ class PageMapComponent < ApplicationRecord has_one :page_component, as: :component, autosave: true + # DB schema for Map Component... + # Table: page_map_components + # title string + # description: string + # practices: string array[] + # adoption_status: string SUP - if empty all adoptions display with no status. + # If any specified S, U or P - only the specified adoptions display on the map and their status is displayed as well. end \ No newline at end of file From 59c35ae20ea9eb41eae5435b6076135f71bd6713 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:01:10 -0700 Subject: [PATCH 05/99] dm-3508 backend and infrastructure for front end. --- app/admin/pages.rb | 10 +++--- app/controllers/page_controller.rb | 15 ++++++++ .../_page_map_component_form.html.arb | 35 +++++++++++++++---- app/views/page/_page_map.html.erb | 13 +++++++ app/views/page/_page_map_data.js.erb | 1 + app/views/page/show.html.erb | 16 +++++---- ...220830113020_create_page_map_components.rb | 14 ++++++++ 7 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 app/views/page/_page_map.html.erb create mode 100644 app/views/page/_page_map_data.js.erb create mode 100644 db/migrate/20220830113020_create_page_map_components.rb diff --git a/app/admin/pages.rb b/app/admin/pages.rb index 0316a00fc..3d2d15d05 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -7,7 +7,8 @@ page_components_attributes: [ :id, :component_type, :position, :_destroy, component_attributes: [ :url, :description, :title, :text, :heading_type, :subtopic_title, :subtopic_description, :alignment, - :page_image, :caption, :alt_text, :html_tag, :display_name, :attachment, :cta_text, :button_text, :card, practices: [] + :page_image, :caption, :alt_text, :html_tag, :display_name, :attachment, :cta_text, :button_text, :card, + :display_successful, :display_in_progress, :display_unsuccessful, practices: [] ] ] @@ -41,7 +42,6 @@ end show do - debugger attributes_table do row('Complete URL') { |page| page_link = page.slug == 'home' ? "/#{page.page_group.friendly_id}" : "/#{page.page_group.friendly_id}/#{page.slug}" @@ -70,7 +70,7 @@ para "Alignment: #{component&.alignment}" if pc.component_type == 'PageHeader3Component' para component&.title if pc.component_type == 'PageHeader3Component' || pc.component_type == 'PageSubpageHyperlinkComponent' || pc.component_type == 'PageAccordionComponent' para component&.description 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' + 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' para "#{component&.practices.length} Practice#{component&.practices.length == 1 ? '' : 's'}" if pc.component_type == 'PagePracticeListComponent' para component&.practices.map {|pid| Practice.find(pid).name }.join("\n") if pc.component_type == 'PagePracticeListComponent' para component&.url if pc.component_type == 'PageSubpageHyperlinkComponent' || pc.component_type == 'PageYouTubePlayerComponent' @@ -128,7 +128,6 @@ end f.inputs "Page Components" do - debugger render partial: 'page_components_form', locals: {f: f, page_components: :page_components} end f.actions # adds the 'Submit' and 'Cancel' buttons @@ -148,13 +147,14 @@ def update def create_or_update_page begin + debugger page_params = params[:page] page_description = page_params[:description] page_id = params[:id] 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 - + debugger 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 7c00bd573..c161c525d 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -1,5 +1,20 @@ class PageController < ApplicationController def show + @va_facility = VaFacility.where(id: [1639, 1640, 1419, 1583]) + @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| + marker.lat facility.latitude + marker.lng facility.longitude + marker.picture({ + url: view_context.image_path('visn-va-facility-map-marker-default.svg'), + width: 34, + height: 46, + scaledWidth: 34, + scaledHeight: 46 + }) + marker.shadow nil + marker.json({ id: facility.id }) + end + debugger 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 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 9f59a15a0..0a7824f97 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 @@ -14,7 +14,7 @@ html = Arbre::Context.new do li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_title_input" do label 'Title', for: "page_page_components_attributes_#{placeholder}_component_attributes_title", class: 'label' - input value: component&.description || nil, type: 'text', required: 'required', + input value: component&.title || nil, type: 'text', required: 'required', id: "page_page_components_attributes_#{placeholder}_component_attributes_title", name: "page[page_components_attributes][#{placeholder}][component_attributes][title]" para 'Enter a title for the map.', class: 'inline-hints' @@ -40,13 +40,34 @@ 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: 'string input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_adoption_status_input" do - input value: component&.title || nil, type: 'text', required: 'required', - id: "page_page_components_attributes_#{placeholder}_component_attributes_adoption_status", - name: "page[page_components_attributes][#{placeholder}][component_attributes][adoption_status]" - label 'Adoption Statuses to Display', for: "page_page_components_attributes_#{placeholder}_component_attributes_adoption_status" + 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]" + end + label 'Successful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", class: 'label' + input value: component&.display_successful || nil, type: 'checkbox', checked: component&.display_successful?, + id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", + name: "page[page_components_attributes][#{placeholder}][component_attributes][display_successful]" + end + 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]" + end + 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?, + id: "page_page_components_attributes_#{placeholder}_component_attributes_display_in_progress", + name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress]" + end + 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]" + end + label 'Unsuccessful', for: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", class: 'label' + input value: '1', type: 'checkbox', checked: component&.display_unsuccessful?, + id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", + name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful]" end - para 'Adoption Statuses (S, U, P)', class: 'inline-hints' + para 'Select which adoptions statuses should display on the map.', class: 'inline-hints' end end end diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb new file mode 100644 index 000000000..acfa1aa3f --- /dev/null +++ b/app/views/page/_page_map.html.erb @@ -0,0 +1,13 @@ +
+ <% if ENV['GOOGLE_API_KEY'].present? %> + <% provide :head_tags do %> + <%= javascript_tag 'data-turbolinks-track': 'reload' do %> + var mapData = <%= raw @va_facility_marker.to_json %>; + var defaultVisnVaFacilityMarkerIcon = '<%= image_path('visn-va-facility-map-marker-default.svg') %>' + <% end %> + <%= javascript_include_tag 'va_facilities/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 %> +
\ No newline at end of file diff --git a/app/views/page/_page_map_data.js.erb b/app/views/page/_page_map_data.js.erb new file mode 100644 index 000000000..7638ba5c2 --- /dev/null +++ b/app/views/page/_page_map_data.js.erb @@ -0,0 +1 @@ +var mapData = <%= raw @va_facility_marker.to_json %>; \ No newline at end of file diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 6e7a3780b..c2c7bd27e 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -176,17 +176,21 @@ <% when 'PageMapComponent' %> <% - debugger description = component.description - display_name = component.display_name + title = component.title + display_successful = component&.display_successful? + display_in_progress = component&.display_in_progress? + display_unsuccessful = component&.display_unsuccessful? + debugger next_component = @page.page_components.find_by(position: pc.position + 1) %> -
+
+ <%= content_tag(:span, title, class: 'margin-right-1') if title != '' %> +
+
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> - <%= link_to component.attachment_s3_presigned_url, class: 'usa-link usa-link--external', target: '_blank', download: display_name != '' ? display_name : component.attachment_file_name do %> - <%= display_name != '' ? display_name : component.attachment_file_name %> - <% end %>
+ <%= render partial: "page/page_map", locals: { component: component } %> <% end %> <% end %>
diff --git a/db/migrate/20220830113020_create_page_map_components.rb b/db/migrate/20220830113020_create_page_map_components.rb new file mode 100644 index 000000000..bfe9188f9 --- /dev/null +++ b/db/migrate/20220830113020_create_page_map_components.rb @@ -0,0 +1,14 @@ +class CreatePageMapComponents < ActiveRecord::Migration[5.2] + def change + create_table :page_map_components, id: :uuid do |t| + t.belongs_to :page_component, foreign_key: true + t.string :title + t.string :description + t.string :practices, array: true, default: [] + t.boolean :display_successful, default: false + t.boolean :display_in_progress, default: false + t.boolean :display_unsuccessful, default: false + t.timestamps + end + end +end \ No newline at end of file From 93c0ea969497539c78f23ec84ad8c28c8fd4bd64 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 30 Aug 2022 18:19:23 -0700 Subject: [PATCH 06/99] dm-3508 --- app/assets/javascripts/page/page_map.es6 | 48 ++++++++++++++++++++++++ app/views/page/_page_map.html.erb | 2 +- config/initializers/assets.rb | 1 + 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/page/page_map.es6 diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 new file mode 100644 index 000000000..94d45a142 --- /dev/null +++ b/app/assets/javascripts/page/page_map.es6 @@ -0,0 +1,48 @@ +function initialize() { + const handler = Gmaps.build('Google', { + markers: { + clusterer: null + } + }); + let markers; + let dataMarkers; + + function buildMapMarkers(data) { + dataMarkers = _.map(data, function (json, index) { + json.marker = markers[index]; + return json; + }); + } + + handler.buildMap({ + provider: { + center: {lat: Number(mapData[0].lat), lng: Number(mapData[0].lng)}, + zoom: 4, + zoomControlOptions: { + position: google.maps.ControlPosition.TOP_RIGHT + }, + fullscreenControl: false, + mapTypeControl: false, + streetViewControl: false + }, + internal: {id: 'va_facility_map'}, + markers: { + options: { + rich_marker: true + } + } + }, + function () { + markers = handler.addMarkers(mapData); + buildMapMarkers(mapData); + }); + + google.maps.event.addListener(handler.getMap(), "idle", function () { + $("#va_facility_map").removeClass("display-none"); + $(".dm-facilities-show-map-loading-spinner").addClass("display-none"); + }); +} + +$(document).on("turbolinks:load", function () { + google.maps.event.addDomListener(window, "load", initialize); +}); \ No newline at end of file diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index acfa1aa3f..8e33ea39f 100644 --- a/app/views/page/_page_map.html.erb +++ b/app/views/page/_page_map.html.erb @@ -5,7 +5,7 @@ var mapData = <%= raw @va_facility_marker.to_json %>; var defaultVisnVaFacilityMarkerIcon = '<%= image_path('visn-va-facility-map-marker-default.svg') %>' <% end %> - <%= javascript_include_tag 'va_facilities/map', 'data-turbolinks-track': 'reload' %> + <%= 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' } %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d1336f768..f07ce374f 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -54,6 +54,7 @@ facility_status_definitions_modal.js clinical_resource_hubs/crh_show.js practices/publication_validation.js + page/page_map.js ) # Precompile additional assets. From 676ce5373d234075d46f55de738c61c4ecdd5a45 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 31 Aug 2022 17:13:21 -0700 Subject: [PATCH 07/99] dm-3508 bus logic: fetching diffusion histories for selected practices. --- app/assets/javascripts/page/page_map.es6 | 5 ++- app/controllers/page_controller.rb | 57 +++++++++++++++++------- app/views/page/_page_map.html.erb | 20 ++++----- app/views/page/show.html.erb | 6 ++- 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 94d45a142..043129b31 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -16,6 +16,7 @@ function initialize() { handler.buildMap({ provider: { + // center: {lat: 95, lng: 37}, center: {lat: Number(mapData[0].lat), lng: Number(mapData[0].lng)}, zoom: 4, zoomControlOptions: { @@ -25,7 +26,7 @@ function initialize() { mapTypeControl: false, streetViewControl: false }, - internal: {id: 'va_facility_map'}, + internal: {id: 'page_builder_map'}, markers: { options: { rich_marker: true @@ -38,7 +39,7 @@ function initialize() { }); google.maps.event.addListener(handler.getMap(), "idle", function () { - $("#va_facility_map").removeClass("display-none"); + $("#page_builder_map").removeClass("display-none"); $(".dm-facilities-show-map-loading-spinner").addClass("display-none"); }); } diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index c161c525d..0c9f446c0 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -1,23 +1,17 @@ class PageController < ApplicationController def show - @va_facility = VaFacility.where(id: [1639, 1640, 1419, 1583]) - @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| - marker.lat facility.latitude - marker.lng facility.longitude - marker.picture({ - url: view_context.image_path('visn-va-facility-map-marker-default.svg'), - width: 34, - height: 46, - scaledWidth: 34, - scaledHeight: 46 - }) - marker.shadow nil - marker.json({ id: facility.id }) - end - debugger 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" + practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a + adopting_facilities = get_adopting_facilities_for_these_practices practices_list + debugger + build_map_component adopting_facilities + end + end + @path_parts = request.path.split('/') @facilities_data = VaFacility.cached_va_facilities.order_by_station_name @practice_list_components = [] @@ -33,6 +27,26 @@ def show end end + + def build_map_component adopting_facilities_list + debugger + @va_facility = VaFacility.where(id: [adopting_facilities_list.to_i]) + #@va_facility = VaFacility.where(id: [2137,2137,2405,1523,2024]) + @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| + marker.lat facility.latitude + marker.lng facility.longitude + marker.picture({ + url: view_context.image_path('visn-va-facility-map-marker-default.svg'), + width: 34, + height: 46, + scaledWidth: 34, + scaledHeight: 46 + }) + marker.shadow nil + marker.json({ id: facility.id }) + end + end + private def set_pagy_practice_list_array(page_components) @@ -65,4 +79,17 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) link_extra: "data-remote='true' class='dm-paginated-#{page_practice_list_index}-link dm-paginated-#{page_practice_list_index}-practices-#{params_index.nil? ? 2 : params_index.to_i + 1}-link dm-button--outline-secondary margin-top-105 width-auto'" ) end + + def get_adopting_facilities_for_these_practices practices_list + va_facilities_list = "" + practices_list[0]["practices"].each do |pr| + diffusion_histories = DiffusionHistory.where(practice_id: pr) + diffusion_histories.each do |dh| + unless dh.va_facility_id.nil? + va_facilities_list += dh.va_facility_id.to_s + "," + end + end + end + va_facilities_list.chop + end end diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index 8e33ea39f..20ab530d1 100644 --- a/app/views/page/_page_map.html.erb +++ b/app/views/page/_page_map.html.erb @@ -1,13 +1,11 @@ -
- <% if ENV['GOOGLE_API_KEY'].present? %> - <% provide :head_tags do %> - <%= javascript_tag 'data-turbolinks-track': 'reload' do %> - var mapData = <%= raw @va_facility_marker.to_json %>; - var defaultVisnVaFacilityMarkerIcon = '<%= image_path('visn-va-facility-map-marker-default.svg') %>' - <% end %> - <%= javascript_include_tag 'page/page_map', 'data-turbolinks-track': 'reload' %> +<% if ENV['GOOGLE_API_KEY'].present? %> + <% provide :head_tags do %> + <%= javascript_tag 'data-turbolinks-track': 'reload' do %> + var mapData = <%= raw @va_facility_marker.to_json %>; + var defaultVisnVaFacilityMarkerIcon = '<%= image_path('visn-va-facility-map-marker-default.svg') %>' <% 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' } %> + <%= javascript_include_tag 'page/page_map', 'data-turbolinks-track': 'reload' %> <% end %> -
\ No newline at end of file + + <%#= 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/app/views/page/show.html.erb b/app/views/page/show.html.erb index c2c7bd27e..2da60d0e4 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -184,13 +184,15 @@ debugger next_component = @page.page_components.find_by(position: pc.position + 1) %> -
+
<%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %>
- <%= render partial: "page/page_map", locals: { component: component } %> +
+ <%= render partial: "page/page_map", locals: { component: component } %> +
<% end %> <% end %>
From f897e8633d749bf74ba225fbd5dd916137a962a0 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 31 Aug 2022 19:21:05 -0700 Subject: [PATCH 08/99] dm-3508 --- app/controllers/page_controller.rb | 3 ++- app/views/page/show.html.erb | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 0c9f446c0..c81d519a3 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -3,12 +3,13 @@ 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 + @adoptions_count = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a adopting_facilities = get_adopting_facilities_for_these_practices practices_list - debugger build_map_component adopting_facilities + @adoptions_count = adopting_facilities.split(",").length end end diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 2da60d0e4..dedc0b7f6 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -187,12 +187,13 @@
<%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
-
- <%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> -
-
+
<%= render partial: "page/page_map", locals: { component: component } %>
+
+ <%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> + There are currently <%= @adoptions_count %> successful adoptions. +
<% end %> <% end %>
From cbc8d0e7c56b2aeb3b91480aaf34eb7726a30dff Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 1 Sep 2022 10:03:19 -0700 Subject: [PATCH 09/99] dm-3508 center map and zoom --- app/assets/javascripts/page/page_map.es6 | 5 ++--- app/controllers/page_controller.rb | 6 +++--- app/views/page/_page_map.html.erb | 2 +- app/views/page/show.html.erb | 10 +++++----- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 043129b31..135955e6b 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -16,9 +16,8 @@ function initialize() { handler.buildMap({ provider: { - // center: {lat: 95, lng: 37}, - center: {lat: Number(mapData[0].lat), lng: Number(mapData[0].lng)}, - zoom: 4, + center: {lat: 39.8097343, lng: -98.5556199}, + zoom: 3.7, zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index c81d519a3..d8526ed80 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -8,6 +8,7 @@ def show if pc.component_type == "PageMapComponent" practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a adopting_facilities = get_adopting_facilities_for_these_practices practices_list + debugger build_map_component adopting_facilities @adoptions_count = adopting_facilities.split(",").length end @@ -30,9 +31,8 @@ def show def build_map_component adopting_facilities_list - debugger - @va_facility = VaFacility.where(id: [adopting_facilities_list.to_i]) - #@va_facility = VaFacility.where(id: [2137,2137,2405,1523,2024]) + #@va_facility = VaFacility.where(id: [adopting_facilities_list.to_i]) + @va_facility = VaFacility.where(id: [2137,2137,2405,1523,2024]) @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| marker.lat facility.latitude marker.lng facility.longitude diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index 20ab530d1..afaac1623 100644 --- a/app/views/page/_page_map.html.erb +++ b/app/views/page/_page_map.html.erb @@ -7,5 +7,5 @@ <%= 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' } %> + <%= 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/app/views/page/show.html.erb b/app/views/page/show.html.erb index dedc0b7f6..0af6472ae 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -184,16 +184,16 @@ debugger next_component = @page.page_components.find_by(position: pc.position + 1) %> -
+
<%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
-
- <%= render partial: "page/page_map", locals: { component: component } %> -
-
+
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> There are currently <%= @adoptions_count %> successful adoptions.
+
+ <%= render partial: "page/page_map", locals: { component: component } %> +
<% end %> <% end %>
From 01075e5f25fc166087a1a3cbbc3b3a8e05ffadda Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 1 Sep 2022 10:21:05 -0700 Subject: [PATCH 10/99] dm-3508 styles, zoom level --- app/assets/javascripts/page/page_map.es6 | 2 +- app/views/page/_page_map.html.erb | 2 +- app/views/page/show.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 135955e6b..c9c4361b1 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -17,7 +17,7 @@ function initialize() { handler.buildMap({ provider: { center: {lat: 39.8097343, lng: -98.5556199}, - zoom: 3.7, + zoom: 4.7, zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index afaac1623..01c5300e4 100644 --- a/app/views/page/_page_map.html.erb +++ b/app/views/page/_page_map.html.erb @@ -6,6 +6,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/app/views/page/show.html.erb b/app/views/page/show.html.erb index 0af6472ae..f6949b316 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -184,7 +184,7 @@ debugger next_component = @page.page_components.find_by(position: pc.position + 1) %> -
+
<%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
From 27170ca606ce7ba7b74e7d9cd782910e1e3e00c5 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 1 Sep 2022 10:35:07 -0700 Subject: [PATCH 11/99] dm-3508 Fix query for adopting facilities --- app/controllers/page_controller.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index d8526ed80..8cafe637d 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -10,7 +10,7 @@ def show adopting_facilities = get_adopting_facilities_for_these_practices practices_list debugger build_map_component adopting_facilities - @adoptions_count = adopting_facilities.split(",").length + @adoptions_count = adopting_facilities.count end end @@ -31,8 +31,8 @@ def show def build_map_component adopting_facilities_list - #@va_facility = VaFacility.where(id: [adopting_facilities_list.to_i]) - @va_facility = VaFacility.where(id: [2137,2137,2405,1523,2024]) + @va_facility = VaFacility.where(id: adopting_facilities_list) + #@va_facility = VaFacility.where(id: [2137,2137,2405,1523,2024]) @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| marker.lat facility.latitude marker.lng facility.longitude @@ -82,15 +82,16 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) end def get_adopting_facilities_for_these_practices practices_list - va_facilities_list = "" + va_facilities_list = [] practices_list[0]["practices"].each do |pr| diffusion_histories = DiffusionHistory.where(practice_id: pr) diffusion_histories.each do |dh| unless dh.va_facility_id.nil? - va_facilities_list += dh.va_facility_id.to_s + "," + va_facilities_list.push dh.va_facility_id end end end - va_facilities_list.chop + debugger + va_facilities_list end end From d2d8c52ce82e74a03ff95ed29dea534a8091a12f Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 1 Sep 2022 10:36:49 -0700 Subject: [PATCH 12/99] dm-3508 removed dbg --- app/admin/pages.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/admin/pages.rb b/app/admin/pages.rb index 3d2d15d05..43f9f4cfe 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -147,7 +147,6 @@ def update def create_or_update_page begin - debugger page_params = params[:page] page_description = page_params[:description] page_id = params[:id] From 90e43863a504bfdc6d4de68ffae19da3ffd95c94 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 1 Sep 2022 10:48:05 -0700 Subject: [PATCH 13/99] dm-3508 removed dbgs --- app/admin/pages.rb | 1 - app/controllers/page_controller.rb | 3 --- app/views/page/show.html.erb | 1 - 3 files changed, 5 deletions(-) diff --git a/app/admin/pages.rb b/app/admin/pages.rb index 43f9f4cfe..ca7e0a331 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -153,7 +153,6 @@ 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 - debugger 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 8cafe637d..674d26c25 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -8,7 +8,6 @@ def show if pc.component_type == "PageMapComponent" practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a adopting_facilities = get_adopting_facilities_for_these_practices practices_list - debugger build_map_component adopting_facilities @adoptions_count = adopting_facilities.count end @@ -32,7 +31,6 @@ def show def build_map_component adopting_facilities_list @va_facility = VaFacility.where(id: adopting_facilities_list) - #@va_facility = VaFacility.where(id: [2137,2137,2405,1523,2024]) @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| marker.lat facility.latitude marker.lng facility.longitude @@ -91,7 +89,6 @@ def get_adopting_facilities_for_these_practices practices_list end end end - debugger va_facilities_list end end diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index f6949b316..b984b4342 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -181,7 +181,6 @@ display_successful = component&.display_successful? display_in_progress = component&.display_in_progress? display_unsuccessful = component&.display_unsuccessful? - debugger next_component = @page.page_components.find_by(position: pc.position + 1) %>
From e55db8cc319ceeca5588ff51c86610de96571795 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:58:58 -0700 Subject: [PATCH 14/99] dm-3508 marker infowindow --- .../dm/components/_diffusion_history.scss | 5 +++++ app/controllers/page_controller.rb | 2 ++ .../maps/_community_map_infowindow.html.erb | 21 +++++++++++++++++++ app/views/page/_page_map.html.erb | 4 ++-- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 app/views/maps/_community_map_infowindow.html.erb diff --git a/app/assets/stylesheets/dm/components/_diffusion_history.scss b/app/assets/stylesheets/dm/components/_diffusion_history.scss index f450304b2..3e97342a6 100644 --- a/app/assets/stylesheets/dm/components/_diffusion_history.scss +++ b/app/assets/stylesheets/dm/components/_diffusion_history.scss @@ -5,6 +5,11 @@ padding: 8px 15px; } +.community_map_styles{ + height: 658px; + width: 987px; +} + .home-marker-modal { .modal-content { border-radius: 4px; diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 674d26c25..9dafea950 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -6,6 +6,7 @@ def show @adoptions_count = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" + debugger practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a adopting_facilities = get_adopting_facilities_for_these_practices practices_list build_map_component adopting_facilities @@ -43,6 +44,7 @@ def build_map_component adopting_facilities_list }) marker.shadow nil marker.json({ id: facility.id }) + marker.infowindow render_to_string(partial: 'maps/community_map_infowindow', locals: { diffusion_histories: facility, facility: facility }) end end diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb new file mode 100644 index 000000000..1fa19ece8 --- /dev/null +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -0,0 +1,21 @@ +
+

+ <% + station_name = facility.official_station_name + station_number = facility.station_number + %> + <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link' %> +

+ <%# if home_page ||= false %> + + + + + + + + + + + <%# end %> +
\ No newline at end of file diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index 01c5300e4..a481785aa 100644 --- a/app/views/page/_page_map.html.erb +++ b/app/views/page/_page_map.html.erb @@ -1,11 +1,11 @@ <% if ENV['GOOGLE_API_KEY'].present? %> <% provide :head_tags do %> <%= javascript_tag 'data-turbolinks-track': 'reload' do %> - var mapData = <%= raw @va_facility_marker.to_json %>; + var mapData = <%= raw @va_facility_marker.to_json %> var defaultVisnVaFacilityMarkerIcon = '<%= image_path('visn-va-facility-map-marker-default.svg') %>' <% 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 4b3ed39af3c6fdcc4dd70994541671e19bebe6c2 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Fri, 2 Sep 2022 14:12:37 -0700 Subject: [PATCH 15/99] dm-3508 info window --- app/controllers/page_controller.rb | 12 ++++----- app/helpers/page_helper.rb | 10 +++++++ .../maps/_community_map_infowindow.html.erb | 27 ++++++++----------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 9dafea950..cad8c62ac 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -6,9 +6,8 @@ def show @adoptions_count = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" - debugger - practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a - adopting_facilities = get_adopting_facilities_for_these_practices practices_list + @practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a + adopting_facilities = get_adopting_facilities_for_these_practices @practices_list build_map_component adopting_facilities @adoptions_count = adopting_facilities.count end @@ -29,8 +28,7 @@ def show end end - - def build_map_component adopting_facilities_list + def build_map_component(adopting_facilities_list) @va_facility = VaFacility.where(id: adopting_facilities_list) @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| marker.lat facility.latitude @@ -44,7 +42,7 @@ def build_map_component adopting_facilities_list }) marker.shadow nil marker.json({ id: facility.id }) - marker.infowindow render_to_string(partial: 'maps/community_map_infowindow', locals: { diffusion_histories: facility, facility: facility }) + marker.infowindow render_to_string(partial: 'maps/community_map_infowindow', locals: { diffusion_histories: facility, facility: facility, practice_list: @practices_list }) end end @@ -81,7 +79,7 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) ) end - def get_adopting_facilities_for_these_practices practices_list + def get_adopting_facilities_for_these_practices(practices_list) va_facilities_list = [] practices_list[0]["practices"].each do |pr| diffusion_histories = DiffusionHistory.where(practice_id: pr) diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index 625cfe4e5..f61a5e03b 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -1,2 +1,12 @@ module PageHelper + def practices_to_display_in_info_window(facility_id, practice_list) + practices_for_facility = "" + dh = DiffusionHistory.where(va_facility_id: facility_id) + dh.each do |dh| + if practice_list[0][0][:practices].include?(dh.practice_id.to_s) + practices_for_facility += Practice.find_by_id(dh.practice_id).name + "," + end + end + practices_for_facility.chop + end end diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index 1fa19ece8..da2a3bd25 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -1,21 +1,16 @@ -
-

+

+
<% station_name = facility.official_station_name station_number = facility.station_number + facility_name = facility.official_station_name + facility_id = facility.id + practice_list = @practices_list + practice_names = practices_to_display_in_info_window facility_id, practice_list.split(",") %> - <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link' %> -

- <%# if home_page ||= false %> - - - - - - - - - - - <%# end %> + <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link font-sans-md text-bold' %> +
+ <%= practice_names %> +
+
\ No newline at end of file From 4b616b18c82a4abdf6b3ce2ba8a44b2fb9a66c6a Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 6 Sep 2022 15:40:54 -0700 Subject: [PATCH 16/99] dm-3508 logic for statuses --- .../stylesheets/dm/pages/_practice.scss | 5 +++++ app/controllers/page_controller.rb | 21 ++++++++++++++----- app/helpers/page_helper.rb | 8 +++---- .../maps/_community_map_infowindow.html.erb | 18 +++++++++++++--- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 56d178211..46fd07476 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -987,6 +987,11 @@ li.small-disc:before { font-weight: 800 !important; } } +.map-infowindow-border{ + border-width: 0.05rem !important; + border-color: lightgray !important; + border-style: solid !important; +} tr.border_bottom td { border-bottom: 1px solid darkgray; diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index cad8c62ac..4d0239c19 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -6,10 +6,14 @@ def show @adoptions_count = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" - @practices_list = PageMapComponent.select(:practices).where(id: pc.component_id).to_a - adopting_facilities = get_adopting_facilities_for_these_practices @practices_list - build_map_component adopting_facilities - @adoptions_count = adopting_facilities.count + @practices_list = PageMapComponent.select(:practices, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a + @display_successful = @practices_list[0][:display_successful] + @display_in_progress = @practices_list[0][:display_in_progress] + @display_unsuccessful = @practices_list[0][:display_unsuccessful] + + adoptions = get_adopting_facilities_for_these_practices @practices_list + build_map_component adoptions + @adoptions_count = adoptions.count end end @@ -84,8 +88,15 @@ def get_adopting_facilities_for_these_practices(practices_list) practices_list[0]["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? - va_facilities_list.push dh.va_facility_id + if dhs == "Completed" && @display_successful + va_facilities_list.push dh.va_facility_id + elsif dhs == "In progress" && @display_in_progress + va_facilities_list.push dh.va_facility_id + elsif dhs == "Unsuccessful" && @display_unsuccessful + va_facilities_list.push dh.va_facility_id + end end end end diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index f61a5e03b..afb0b9c10 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -1,12 +1,12 @@ module PageHelper - def practices_to_display_in_info_window(facility_id, practice_list) - practices_for_facility = "" + def practices_to_display_in_info_window(facility_id, practice_list, names, taglines, short_names) dh = DiffusionHistory.where(va_facility_id: facility_id) dh.each do |dh| if practice_list[0][0][:practices].include?(dh.practice_id.to_s) - practices_for_facility += Practice.find_by_id(dh.practice_id).name + "," + names.push Practice.find_by_id(dh.practice_id).name + short_names.push Practice.find_by_id(dh.practice_id).short_name + taglines.push Practice.find_by_id(dh.practice_id).tagline end end - practices_for_facility.chop end end diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index da2a3bd25..6a3cff7ae 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -6,11 +6,23 @@ facility_name = facility.official_station_name facility_id = facility.id practice_list = @practices_list - practice_names = practices_to_display_in_info_window facility_id, practice_list.split(",") + names = [] + taglines = [] + short_names = [] + practices_to_display_in_info_window facility_id, practice_list.split(","), names, taglines, short_names %> <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link font-sans-md text-bold' %> -
- <%= practice_names %> +
+ <% i = 0 %> + <% while i < names.length do %> +
+ <%= names[i] %> <%= "(" + short_names[i] + ")" %> +
+ <%= taglines[i] %> +
+
+ <% i = i + 1 %> + <% end %>
\ No newline at end of file From 55f9daccf55f656db95c7e9b56e3536cc94cb028 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:30:06 -0700 Subject: [PATCH 17/99] dm-3508 front end stuff --- app/controllers/page_controller.rb | 6 ++++-- app/views/maps/_community_map_infowindow.html.erb | 2 ++ app/views/page/show.html.erb | 3 --- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 4d0239c19..54063abf9 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -6,6 +6,7 @@ def show @adoptions_count = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" + @num_facilities = 0 @practices_list = PageMapComponent.select(:practices, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a @display_successful = @practices_list[0][:display_successful] @display_in_progress = @practices_list[0][:display_in_progress] @@ -33,8 +34,9 @@ def show end def build_map_component(adopting_facilities_list) - @va_facility = VaFacility.where(id: adopting_facilities_list) - @va_facility_marker = Gmaps4rails.build_markers(@va_facility) do |facility, marker| + va_facilities = VaFacility.where(id: adopting_facilities_list) + @num_facilities = va_facilities.count + @va_facility_marker = Gmaps4rails.build_markers(va_facilities) do |facility, marker| marker.lat facility.latitude marker.lng facility.longitude marker.picture({ diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index 6a3cff7ae..493405aed 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -10,9 +10,11 @@ taglines = [] short_names = [] practices_to_display_in_info_window facility_id, practice_list.split(","), names, taglines, short_names + @num_practices_adopted = names.count %> <%= 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 %> Total Adoption<% if @num_practices_adopted != 1 %>s<% end %>.

<% i = 0 %> <% while i < names.length do %>
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index b984b4342..7e4768bf5 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -178,9 +178,6 @@ <% description = component.description title = component.title - display_successful = component&.display_successful? - display_in_progress = component&.display_in_progress? - display_unsuccessful = component&.display_unsuccessful? next_component = @page.page_components.find_by(position: pc.position + 1) %>
From 200b5e3fc07efdfbdbec33d36026b0aab3d8a8c3 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 12:55:13 -0700 Subject: [PATCH 18/99] dm-3508 info window styling text changes. --- .../stylesheets/dm/components/_diffusion_history.scss | 4 ++-- app/assets/stylesheets/dm/pages/_practice.scss | 2 +- app/controllers/page_controller.rb | 1 - app/views/maps/_community_map_infowindow.html.erb | 6 ++++-- app/views/page/show.html.erb | 10 +++++----- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/dm/components/_diffusion_history.scss b/app/assets/stylesheets/dm/components/_diffusion_history.scss index 3e97342a6..aa9ac2cc8 100644 --- a/app/assets/stylesheets/dm/components/_diffusion_history.scss +++ b/app/assets/stylesheets/dm/components/_diffusion_history.scss @@ -6,8 +6,8 @@ } .community_map_styles{ - height: 658px; - width: 987px; + height: 540px; + width: 726px; } .home-marker-modal { diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 46fd07476..733e07e00 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -988,7 +988,7 @@ li.small-disc:before { } } .map-infowindow-border{ - border-width: 0.05rem !important; + border-width: 0.01rem !important; border-color: lightgray !important; border-style: solid !important; } diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 54063abf9..d85e52469 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -11,7 +11,6 @@ def show @display_successful = @practices_list[0][:display_successful] @display_in_progress = @practices_list[0][:display_in_progress] @display_unsuccessful = @practices_list[0][:display_unsuccessful] - adoptions = get_adopting_facilities_for_these_practices @practices_list build_map_component adoptions @adoptions_count = adoptions.count diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index 493405aed..ea098dd18 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -13,12 +13,14 @@ @num_practices_adopted = names.count %> <%= 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 %> XR Innovation<% if @num_practices_adopted != 1 %>s<% end %> +
-

<%= @num_practices_adopted %> Total Adoption<% if @num_practices_adopted != 1 %>s<% end %>.

<% i = 0 %> <% while i < names.length do %>
- <%= names[i] %> <%= "(" + short_names[i] + ")" %> + <%= names[i] %> <% if short_names[i].to_s.length > 0 %> <%= "(" + short_names[i] + ")" %> <% end %>
<%= taglines[i] %>
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 7e4768bf5..68b3e678b 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -180,16 +180,16 @@ title = component.title next_component = @page.page_components.find_by(position: pc.position + 1) %> -
+
<%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
-
- <%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> - There are currently <%= @adoptions_count %> successful adoptions. -
<%= render partial: "page/page_map", locals: { component: component } %>
+
+ <%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> + +
<% end %> <% end %>
From 19e6bbfba2e3d71c3902ffaec45383489538e868 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 13:44:26 -0700 Subject: [PATCH 19/99] dm-3508 border radius.. --- app/assets/stylesheets/dm/pages/_practice.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 733e07e00..3301b253e 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -991,6 +991,7 @@ li.small-disc:before { border-width: 0.01rem !important; border-color: lightgray !important; border-style: solid !important; + border-radius: 25px !important; } tr.border_bottom td { From aa974ed185b8202d2729b11761519c4e84d902d7 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 13:59:51 -0700 Subject: [PATCH 20/99] dm-3508 map zoom --- app/assets/javascripts/page/page_map.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index c9c4361b1..271685969 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -17,7 +17,7 @@ function initialize() { handler.buildMap({ provider: { center: {lat: 39.8097343, lng: -98.5556199}, - zoom: 4.7, + zoom: 4.1, zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, From f08f43d0469a23e554fcd19c7a0193dc8787b321 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:31:36 -0700 Subject: [PATCH 21/99] dm-3508 border padding for info window card style --- app/assets/stylesheets/dm/pages/_practice.scss | 11 +++++++++-- app/views/maps/_community_map_infowindow.html.erb | 10 +++++----- app/views/page/show.html.erb | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 3301b253e..1d5230685 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -990,8 +990,15 @@ li.small-disc:before { .map-infowindow-border{ border-width: 0.01rem !important; border-color: lightgray !important; - border-style: solid !important; - border-radius: 25px !important; + border-style: dotted !important; + border-radius: 10px !important; + padding-left: 5% !important; + padding-top: 3% !important; + padding-right: 3% !important; + padding-bottom: 2% !important; +} +.padding-for-map-component-infowindow-text{ + padding-left: 5%; } tr.border_bottom td { diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index ea098dd18..c26001778 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -12,16 +12,16 @@ practices_to_display_in_info_window facility_id, practice_list.split(","), names, taglines, short_names @num_practices_adopted = names.count %> - <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'usa-link font-sans-md text-bold' %> + <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'padding-for-map-component-infowindow-text usa-link font-sans-md text-bold' %>
- <%= @num_practices_adopted %> XR Innovation<% if @num_practices_adopted != 1 %>s<% end %> + <%= @num_practices_adopted %> XR Innovation<% if @num_practices_adopted != 1 %>s<% end %>
-
+
<% i = 0 %> <% while i < names.length do %> -
+
<%= names[i] %> <% if short_names[i].to_s.length > 0 %> <%= "(" + short_names[i] + ")" %> <% end %> -
+
<%= taglines[i] %>
diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 68b3e678b..dd30c90c5 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -188,7 +188,7 @@
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> - + There are currently <%= @adoptions_count %> successful adoptions.
<% end %> <% end %> From 146efe05bfad8ec0fa601050214aac361ac341f6 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:33:23 -0700 Subject: [PATCH 22/99] dm-3508 use padding shorthand --- app/assets/stylesheets/dm/pages/_practice.scss | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 1d5230685..3544cd18a 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -992,10 +992,7 @@ li.small-disc:before { border-color: lightgray !important; border-style: dotted !important; border-radius: 10px !important; - padding-left: 5% !important; - padding-top: 3% !important; - padding-right: 3% !important; - padding-bottom: 2% !important; + padding: 3% 3% 2% 5% !important; } .padding-for-map-component-infowindow-text{ padding-left: 5%; From ba851a1f3de1cc75acf8307337a91d7d44f309b3 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:36:59 -0700 Subject: [PATCH 23/99] dm-3508 add margin between description and map bottom. --- app/views/page/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index dd30c90c5..0adcb9786 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -186,7 +186,7 @@
<%= render partial: "page/page_map", locals: { component: component } %>
-
+
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> There are currently <%= @adoptions_count %> successful adoptions.
From b4c0f74fcc43a51bb6acc1067c7920742b4059d9 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:48:13 -0700 Subject: [PATCH 24/99] dm-3508 info window static size. --- app/assets/stylesheets/dm/pages/_practice.scss | 5 +++++ app/views/maps/_community_map_infowindow.html.erb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 3544cd18a..703f70ea3 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -987,6 +987,11 @@ li.small-disc:before { font-weight: 800 !important; } } + +.map-infowindow-size{ + width: 670px !important; + height: 339px !important; +} .map-infowindow-border{ border-width: 0.01rem !important; border-color: lightgray !important; diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index c26001778..76d6dba2b 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -1,4 +1,4 @@ -
+
<% station_name = facility.official_station_name From 49db804cee1b000ced04f87faf7cb3488a9b2cbb Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 7 Sep 2022 15:34:57 -0700 Subject: [PATCH 25/99] dm-3508 infowindow styles... --- app/assets/stylesheets/dm/pages/_practice.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 703f70ea3..90baf3572 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -993,14 +993,15 @@ li.small-disc:before { height: 339px !important; } .map-infowindow-border{ + width: 550px !important; border-width: 0.01rem !important; border-color: lightgray !important; border-style: dotted !important; - border-radius: 10px !important; - padding: 3% 3% 2% 5% !important; + border-radius: 4px !important; + padding: 2% 3% 2% 4% !important; } .padding-for-map-component-infowindow-text{ - padding-left: 5%; + padding-left: 4%; } tr.border_bottom td { From 81e0043422ddcc3be984febfe945dc271d6c5feb Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 8 Sep 2022 15:01:20 -0700 Subject: [PATCH 26/99] dm-3508 Added in Abbr Short_name for info window content.. i.e., 23 "XR" innovations.. for a specific Facility. --- app/admin/pages.rb | 2 +- app/controllers/page_controller.rb | 3 ++- app/models/page_map_component.rb | 1 + .../resource/_page_map_component_form.html.arb | 8 ++++++++ app/views/maps/_community_map_infowindow.html.erb | 4 ++-- app/views/page/show.html.erb | 2 +- db/migrate/20220830113020_create_page_map_components.rb | 1 + 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/admin/pages.rb b/app/admin/pages.rb index ca7e0a331..1eb3af56d 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -8,7 +8,7 @@ :id, :component_type, :position, :_destroy, component_attributes: [ :url, :description, :title, :text, :heading_type, :subtopic_title, :subtopic_description, :alignment, :page_image, :caption, :alt_text, :html_tag, :display_name, :attachment, :cta_text, :button_text, :card, - :display_successful, :display_in_progress, :display_unsuccessful, practices: [] + :display_successful, :display_in_progress, :display_unsuccessful, :short_name, practices: [] ] ] diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index d85e52469..4c330e31a 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -7,7 +7,8 @@ def show @page_components.each do |pc| if pc.component_type == "PageMapComponent" @num_facilities = 0 - @practices_list = PageMapComponent.select(:practices, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a + @practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a + @short_name = @practices_list[0][:short_name] @display_successful = @practices_list[0][:display_successful] @display_in_progress = @practices_list[0][:display_in_progress] @display_unsuccessful = @practices_list[0][:display_unsuccessful] diff --git a/app/models/page_map_component.rb b/app/models/page_map_component.rb index 97a2b3c17..dcbf3ed36 100644 --- a/app/models/page_map_component.rb +++ b/app/models/page_map_component.rb @@ -3,6 +3,7 @@ class PageMapComponent < ApplicationRecord # DB schema for Map Component... # Table: page_map_components # title string + # short_name string # description: string # practices: string array[] # adoption_status: string SUP - if empty all adoptions display with no status. 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 0a7824f97..d4af9934c 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,6 +20,14 @@ 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' + end + li class: 'url input required stringish', id: "page_page_components_attributes_#{placeholder}_component_attributes_description_input" do label 'Description', for: "page_page_components_attributes_#{placeholder}_component_attributes_description", class: 'label' input value: component&.description || nil, type: 'text', required: 'required', diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index 76d6dba2b..9a0b62653 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -13,8 +13,8 @@ @num_practices_adopted = names.count %> <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'padding-for-map-component-infowindow-text usa-link font-sans-md text-bold' %> -
- <%= @num_practices_adopted %> XR Innovation<% if @num_practices_adopted != 1 %>s<% end %> +
+ <%= @num_practices_adopted %> <% if @short_name.length > 0 %> <%= @short_name %> <% else %> Total <% end %> Innovation<% if @num_practices_adopted != 1 %>s<% end %>
<% i = 0 %> diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 0adcb9786..20c73f4b0 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -188,7 +188,7 @@
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> - There are currently <%= @adoptions_count %> successful adoptions. +
<% end %> <% end %> diff --git a/db/migrate/20220830113020_create_page_map_components.rb b/db/migrate/20220830113020_create_page_map_components.rb index bfe9188f9..0a45e53e4 100644 --- a/db/migrate/20220830113020_create_page_map_components.rb +++ b/db/migrate/20220830113020_create_page_map_components.rb @@ -3,6 +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 :description t.string :practices, array: true, default: [] t.boolean :display_successful, default: false From 77edd43fda47c605eea2e84c5f5cb36020c1e338 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 8 Sep 2022 15:06:20 -0700 Subject: [PATCH 27/99] dm-3508 margin above num innovations in infowindow --- app/views/maps/_community_map_infowindow.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index 9a0b62653..a8ad7f411 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -13,7 +13,7 @@ @num_practices_adopted = names.count %> <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'padding-for-map-component-infowindow-text 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 %>
From 0614009ea14e4a93d28052c0ad096e1ed3bf3f29 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 8 Sep 2022 16:06:02 -0700 Subject: [PATCH 28/99] dm-3508 schema change --- db/schema.rb | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index dac2a1b37..8ae62fa1c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_05_16_103608) do +ActiveRecord::Schema.define(version: 2022_08_30_113020) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -285,6 +285,60 @@ 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 "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" @@ -608,6 +662,20 @@ t.index ["page_component_id"], name: "index_page_image_components_on_page_component_id" end + 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 "description" + t.string "practices", default: [], array: true + t.boolean "display_successful", default: false + t.boolean "display_in_progress", default: false + t.boolean "display_unsuccessful", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["page_component_id"], name: "index_page_map_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" @@ -1380,6 +1448,11 @@ 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" @@ -1409,6 +1482,7 @@ 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_paragraph_components", "page_components" add_foreign_key "page_subpage_hyperlink_components", "page_components" add_foreign_key "page_you_tube_player_components", "page_components" From a168783465e68cf01239e4e031d7ad8b5dbef7d3 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 12 Sep 2022 17:28:35 -0700 Subject: [PATCH 29/99] dm-3508 added test. --- spec/features/pages/show_page_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 6c8ec27bc..dffc43cb8 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -37,6 +37,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: true, display_in_progress: true, display_unsuccessful: 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) @@ -48,6 +49,7 @@ PageComponent.create(page: @page, component: downloadable_file_component, created_at: Time.now) PageComponent.create(page: @page, component: paragraph_component, created_at: Time.now) PageComponent.create(page: @page, component: legacy_paragraph_component, created_at: Time.now) + PageComponent.create(page: @page, component: map_component, created_at: Time.now) # must be logged in to view pages login_as(user, scope: :user, run_callbacks: false) visit '/programming/ruby-rocks' @@ -82,6 +84,11 @@ expect(page).to have_content('The last practice') end + it 'should display the map' do + expect(page).to have_content('test map') + expect(page).to have_content('map description') + 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 fa3b669a1d90ea930b99ec0f3f13210801d590e1 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 14 Sep 2022 10:50:36 -0700 Subject: [PATCH 30/99] dm-3508 --- app/assets/stylesheets/dm/pages/_practice.scss | 2 +- app/controllers/page_controller.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 90baf3572..776700134 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -1001,7 +1001,7 @@ li.small-disc:before { padding: 2% 3% 2% 4% !important; } .padding-for-map-component-infowindow-text{ - padding-left: 4%; + padding-left: 4% !important; } tr.border_bottom td { diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 4c330e31a..be1db4903 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -4,8 +4,10 @@ def show @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 @adoptions_count = 0 + @num_map_components = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" + @num_map_components += 1 @num_facilities = 0 @practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a @short_name = @practices_list[0][:short_name] From 26fedd97b141fee54d8dfbe2c8ea9df12d0eff2d Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 14 Sep 2022 11:17:03 -0700 Subject: [PATCH 31/99] dm-3508 fixed issue with text wrapping and ignoring padding. --- app/assets/stylesheets/dm/pages/_practice.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 776700134..479170381 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -1002,6 +1002,7 @@ li.small-disc:before { } .padding-for-map-component-infowindow-text{ padding-left: 4% !important; + display:block !important; } tr.border_bottom td { From eb1c3e022092aad5ad3f3d64fabc56761c6de38e Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 14 Sep 2022 11:56:32 -0700 Subject: [PATCH 32/99] dm-3508 info window styles --- app/assets/stylesheets/dm/pages/_practice.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 479170381..f15477065 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -989,11 +989,11 @@ li.small-disc:before { } .map-infowindow-size{ - width: 670px !important; + width: 575px !important; height: 339px !important; } .map-infowindow-border{ - width: 550px !important; + width: 560px !important; border-width: 0.01rem !important; border-color: lightgray !important; border-style: dotted !important; From 1f97b992389d83a66447b097cc1ed4127865a44a Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 14 Sep 2022 13:08:55 -0700 Subject: [PATCH 33/99] dm-3508 make map component mobile friendly. --- app/assets/stylesheets/dm/components/_diffusion_history.scss | 3 ++- app/controllers/page_controller.rb | 2 +- app/views/page/_page_map.html.erb | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/dm/components/_diffusion_history.scss b/app/assets/stylesheets/dm/components/_diffusion_history.scss index aa9ac2cc8..b08010528 100644 --- a/app/assets/stylesheets/dm/components/_diffusion_history.scss +++ b/app/assets/stylesheets/dm/components/_diffusion_history.scss @@ -7,7 +7,8 @@ .community_map_styles{ height: 540px; - width: 726px; + width: 100%; + max-width: 726px; } .home-marker-modal { diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index be1db4903..a15699fe2 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -42,7 +42,7 @@ def build_map_component(adopting_facilities_list) marker.lat facility.latitude marker.lng facility.longitude marker.picture({ - url: view_context.image_path('visn-va-facility-map-marker-default.svg'), + url: view_context.image_path('map-marker-default.svg'), width: 34, height: 46, scaledWidth: 34, diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index a481785aa..cc1d93e77 100644 --- a/app/views/page/_page_map.html.erb +++ b/app/views/page/_page_map.html.erb @@ -2,7 +2,6 @@ <% provide :head_tags do %> <%= javascript_tag 'data-turbolinks-track': 'reload' do %> var mapData = <%= raw @va_facility_marker.to_json %> - var defaultVisnVaFacilityMarkerIcon = '<%= image_path('visn-va-facility-map-marker-default.svg') %>' <% end %> <%= javascript_include_tag 'page/page_map', 'data-turbolinks-track': 'reload' %> <% end %> From 4a1c91b10a29da5e47cb4a1aa974e4ce4d824014 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 14 Sep 2022 13:41:46 -0700 Subject: [PATCH 34/99] dm-3508 more info window and border styles for map component info window. --- app/assets/stylesheets/dm/pages/_practice.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index f15477065..e8c2f5a6c 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -989,11 +989,13 @@ li.small-disc:before { } .map-infowindow-size{ - width: 575px !important; + width: 100% !important; + max-width: 575px !important; height: 339px !important; } .map-infowindow-border{ - width: 560px !important; + width: 100% !important; + max-width: 560px !important; border-width: 0.01rem !important; border-color: lightgray !important; border-style: dotted !important; From 32f5dc2e82ccbd672216548af10a63573097b4f2 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 15 Sep 2022 11:43:54 -0700 Subject: [PATCH 35/99] dm-3508 --- app/views/maps/_community_map_infowindow.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index a8ad7f411..d92cac10c 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -25,7 +25,7 @@ <%= taglines[i] %>
- <% i = i + 1 %> + <% i += 1 %> <% end %>
From fae4ff43650b1ec9d7c92ca4d55790649718618e Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 15 Sep 2022 16:14:10 -0700 Subject: [PATCH 36/99] dm-3508 --- app/controllers/page_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index a15699fe2..2a2662e8a 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -7,7 +7,6 @@ def show @num_map_components = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" - @num_map_components += 1 @num_facilities = 0 @practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a @short_name = @practices_list[0][:short_name] @@ -16,6 +15,7 @@ def show @display_unsuccessful = @practices_list[0][:display_unsuccessful] adoptions = get_adopting_facilities_for_these_practices @practices_list build_map_component adoptions + @num_map_components += 1 @adoptions_count = adoptions.count end end From b35be6856dbaa5891dd07ae24a629b2a19f67388 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 19 Sep 2022 09:54:27 -0700 Subject: [PATCH 37/99] dm-3508 info window styles --- app/assets/stylesheets/dm/pages/_practice.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index e8c2f5a6c..1332e62d3 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -989,13 +989,13 @@ li.small-disc:before { } .map-infowindow-size{ - width: 100% !important; - max-width: 575px !important; + width: 575px !important; + min-width: 200px !important; height: 339px !important; } .map-infowindow-border{ - width: 100% !important; - max-width: 560px !important; + width: 560px !important; + min-width: 200px !important; border-width: 0.01rem !important; border-color: lightgray !important; border-style: dotted !important; From eb7aad5a0160d1cf3d45f90a1bf12206d51a95e5 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 22 Sep 2022 11:26:13 -0700 Subject: [PATCH 38/99] dm-3508 addressing testing and PR comments. --- app/admin/pages.rb | 3 ++- app/controllers/page_controller.rb | 9 +++------ app/models/page_map_component.rb | 8 -------- app/views/page/show.html.erb | 3 +-- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/app/admin/pages.rb b/app/admin/pages.rb index 1eb3af56d..a6879e39d 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -68,7 +68,7 @@ para component&.subtopic_title if pc.component_type == 'PageHeader2Component' para component&.subtopic_description if pc.component_type == 'PageHeader2Component' para "Alignment: #{component&.alignment}" if pc.component_type == 'PageHeader3Component' - para component&.title if pc.component_type == 'PageHeader3Component' || pc.component_type == 'PageSubpageHyperlinkComponent' || pc.component_type == 'PageAccordionComponent' + para component&.title if pc.component_type == 'PageHeader3Component' || pc.component_type == 'PageSubpageHyperlinkComponent' || pc.component_type == 'PageAccordionComponent' || pc.component_type == 'PageMapComponent' para component&.description 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' para "#{component&.practices.length} Practice#{component&.practices.length == 1 ? '' : 's'}" if pc.component_type == 'PagePracticeListComponent' @@ -80,6 +80,7 @@ para component&.display_name if pc.component_type == 'PageDownloadableFileComponent' && component&.display_name != '' para component&.description if pc.component_type == 'PageDownloadableFileComponent' && component&.description != '' para component&.description if pc.component_type == 'PageMapComponent' && component&.description != '' + para component&.short_name if pc.component_type == 'PageMapComponent' && component&.short_name != '' end }.join('').html_safe end diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 2a2662e8a..75590d24f 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -3,11 +3,8 @@ 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 - @adoptions_count = 0 - @num_map_components = 0 @page_components.each do |pc| if pc.component_type == "PageMapComponent" - @num_facilities = 0 @practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a @short_name = @practices_list[0][:short_name] @display_successful = @practices_list[0][:display_successful] @@ -15,7 +12,6 @@ def show @display_unsuccessful = @practices_list[0][:display_unsuccessful] adoptions = get_adopting_facilities_for_these_practices @practices_list build_map_component adoptions - @num_map_components += 1 @adoptions_count = adoptions.count end end @@ -35,9 +31,11 @@ def show end end + + private + def build_map_component(adopting_facilities_list) va_facilities = VaFacility.where(id: adopting_facilities_list) - @num_facilities = va_facilities.count @va_facility_marker = Gmaps4rails.build_markers(va_facilities) do |facility, marker| marker.lat facility.latitude marker.lng facility.longitude @@ -54,7 +52,6 @@ def build_map_component(adopting_facilities_list) end end - private def set_pagy_practice_list_array(page_components) page_practice_list_index = 0 diff --git a/app/models/page_map_component.rb b/app/models/page_map_component.rb index dcbf3ed36..f099b4415 100644 --- a/app/models/page_map_component.rb +++ b/app/models/page_map_component.rb @@ -1,11 +1,3 @@ class PageMapComponent < ApplicationRecord has_one :page_component, as: :component, autosave: true - # DB schema for Map Component... - # Table: page_map_components - # title string - # short_name string - # description: string - # practices: string array[] - # adoption_status: string SUP - if empty all adoptions display with no status. - # If any specified S, U or P - only the specified adoptions display on the map and their status is displayed as well. end \ No newline at end of file diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 20c73f4b0..b25866a03 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -186,9 +186,8 @@
<%= render partial: "page/page_map", locals: { component: component } %>
-
+
<%= content_tag(:span, description, class: 'margin-right-1') if description != '' %> -
<% end %> <% end %> From 9beed3066e4935d6cca93a3efa6a95f2c9cef1ad Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 22 Sep 2022 12:42:20 -0700 Subject: [PATCH 39/99] dm-3508 refactored some code to use ActiveRecord vs arrays. --- app/controllers/page_controller.rb | 13 +++++++------ app/helpers/page_helper.rb | 2 +- app/views/maps/_community_map_infowindow.html.erb | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 75590d24f..439199268 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -5,11 +5,12 @@ def show @page_components = @page.page_components @page_components.each do |pc| if pc.component_type == "PageMapComponent" - @practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a - @short_name = @practices_list[0][:short_name] - @display_successful = @practices_list[0][:display_successful] - @display_in_progress = @practices_list[0][:display_in_progress] - @display_unsuccessful = @practices_list[0][:display_unsuccessful] + #@practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a + @practices_list = PageMapComponent.find_by_id(pc.component_id) + @short_name = @practices_list.short_name + @display_successful = @practices_list.display_successful + @display_in_progress = @practices_list.display_in_progress + @display_unsuccessful = @practices_list.display_unsuccessful adoptions = get_adopting_facilities_for_these_practices @practices_list build_map_component adoptions @adoptions_count = adoptions.count @@ -86,7 +87,7 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) def get_adopting_facilities_for_these_practices(practices_list) va_facilities_list = [] - practices_list[0]["practices"].each do |pr| + 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 diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index afb0b9c10..339da741e 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -2,7 +2,7 @@ module PageHelper def practices_to_display_in_info_window(facility_id, practice_list, names, taglines, short_names) dh = DiffusionHistory.where(va_facility_id: facility_id) dh.each do |dh| - if practice_list[0][0][:practices].include?(dh.practice_id.to_s) + if practice_list.practices.include?(dh.practice_id.to_s) names.push Practice.find_by_id(dh.practice_id).name short_names.push Practice.find_by_id(dh.practice_id).short_name taglines.push Practice.find_by_id(dh.practice_id).tagline diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_community_map_infowindow.html.erb index d92cac10c..24a13baaa 100644 --- a/app/views/maps/_community_map_infowindow.html.erb +++ b/app/views/maps/_community_map_infowindow.html.erb @@ -9,7 +9,7 @@ names = [] taglines = [] short_names = [] - practices_to_display_in_info_window facility_id, practice_list.split(","), names, taglines, short_names + practices_to_display_in_info_window facility_id, practice_list, names, taglines, short_names @num_practices_adopted = names.count %> <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'padding-for-map-component-infowindow-text usa-link font-sans-md text-bold' %> From b21b74b1e99c9f038f7931ff60e857ace85dc72f Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 22 Sep 2022 16:37:49 -0700 Subject: [PATCH 40/99] dm-3508 Refactored some code in the controller. --- app/controllers/page_controller.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 439199268..52daf8a8a 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -5,13 +5,9 @@ def show @page_components = @page.page_components @page_components.each do |pc| if pc.component_type == "PageMapComponent" - #@practices_list = PageMapComponent.select(:practices, :short_name, :display_successful, :display_unsuccessful, :display_in_progress).where(id: pc.component_id).to_a @practices_list = PageMapComponent.find_by_id(pc.component_id) @short_name = @practices_list.short_name - @display_successful = @practices_list.display_successful - @display_in_progress = @practices_list.display_in_progress - @display_unsuccessful = @practices_list.display_unsuccessful - adoptions = get_adopting_facilities_for_these_practices @practices_list + adoptions = get_adopting_facilities_for_these_practices(@practices_list, @practices_list.display_successful, @practices_list.display_in_progress, @practices_list.display_unsuccessful) build_map_component adoptions @adoptions_count = adoptions.count end @@ -85,18 +81,18 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) ) end - def get_adopting_facilities_for_these_practices(practices_list) + 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" && @display_successful + if dhs == "Completed" && successful_adoptions va_facilities_list.push dh.va_facility_id - elsif dhs == "In progress" && @display_in_progress + elsif dhs == "In progress" && in_progress_adoptions va_facilities_list.push dh.va_facility_id - elsif dhs == "Unsuccessful" && @display_unsuccessful + elsif dhs == "Unsuccessful" && unsuccessful_adoptions va_facilities_list.push dh.va_facility_id end end From d83a80b879fe6196cbf939ed08865fe89f0878f8 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:02:28 -0700 Subject: [PATCH 41/99] dm-3508 renamed infowindow partial to _page_map_infowindow --- app/controllers/page_controller.rb | 2 +- ...ty_map_infowindow.html.erb => _page_map_infowindow.html.erb} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename app/views/maps/{_community_map_infowindow.html.erb => _page_map_infowindow.html.erb} (100%) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 52daf8a8a..d85cddc13 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -45,7 +45,7 @@ def build_map_component(adopting_facilities_list) }) marker.shadow nil marker.json({ id: facility.id }) - marker.infowindow render_to_string(partial: 'maps/community_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: @practices_list }) end end diff --git a/app/views/maps/_community_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb similarity index 100% rename from app/views/maps/_community_map_infowindow.html.erb rename to app/views/maps/_page_map_infowindow.html.erb From ec00f49c3a397ee7690b6f803dd94bb9882c62cf Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:10:40 -0700 Subject: [PATCH 42/99] dm-3508 another slight refactor... --- app/helpers/page_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index 339da741e..867f2ac1d 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -3,9 +3,9 @@ def practices_to_display_in_info_window(facility_id, practice_list, names, tagli dh = DiffusionHistory.where(va_facility_id: facility_id) dh.each do |dh| if practice_list.practices.include?(dh.practice_id.to_s) - names.push Practice.find_by_id(dh.practice_id).name - short_names.push Practice.find_by_id(dh.practice_id).short_name - taglines.push Practice.find_by_id(dh.practice_id).tagline + names.push dh.practice.name + short_names.push dh.practice.short_name + taglines.push dh.practice.tagline end end end From ddab3dfda6d41274da4010de0f71d1ffb5f9ea54 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 26 Sep 2022 10:43:20 -0700 Subject: [PATCH 43/99] dm-3508 UPdate based on PR comments. --- app/admin/pages.rb | 2 +- app/controllers/page_controller.rb | 2 +- .../resource/_page_map_component_form.html.arb | 18 +++++++++--------- ...0220830113020_create_page_map_components.rb | 6 +++--- spec/features/pages/show_page_spec.rb | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/admin/pages.rb b/app/admin/pages.rb index a6879e39d..4d5020fd2 100644 --- a/app/admin/pages.rb +++ b/app/admin/pages.rb @@ -8,7 +8,7 @@ :id, :component_type, :position, :_destroy, component_attributes: [ :url, :description, :title, :text, :heading_type, :subtopic_title, :subtopic_description, :alignment, :page_image, :caption, :alt_text, :html_tag, :display_name, :attachment, :cta_text, :button_text, :card, - :display_successful, :display_in_progress, :display_unsuccessful, :short_name, practices: [] + :display_successful_adoptions, :display_in_progress_adoptions, :display_unsuccessful_adoptions, :short_name, practices: [] ] ] diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index d85cddc13..681313863 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -7,7 +7,7 @@ def show if pc.component_type == "PageMapComponent" @practices_list = PageMapComponent.find_by_id(pc.component_id) @short_name = @practices_list.short_name - adoptions = get_adopting_facilities_for_these_practices(@practices_list, @practices_list.display_successful, @practices_list.display_in_progress, @practices_list.display_unsuccessful) + adoptions = 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 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 d4af9934c..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 @@ -50,30 +50,30 @@ html = Arbre::Context.new 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]" + 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' - input value: component&.display_successful || nil, type: 'checkbox', checked: component&.display_successful?, + input value: component&.display_successful_adoptions || nil, type: 'checkbox', checked: component&.display_successful_adoptions?, id: "page_page_components_attributes_#{placeholder}_component_attributes_display_successful", - name: "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_input" do if component - input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_in_progress]" + 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' - input value: '1', type: 'checkbox', checked: component&.display_in_progress?, + input value: '1', type: 'checkbox', checked: component&.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]" + 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 if component - input type: 'hidden', value: '0', name: "page[page_components_attributes][#{placeholder}][component_attributes][display_unsuccessful]" + 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' - input value: '1', type: 'checkbox', checked: component&.display_unsuccessful?, + input value: '1', type: 'checkbox', checked: component&.display_unsuccessful_adoptions?, id: "page_page_components_attributes_#{placeholder}_component_attributes_display_unsuccessful", - name: "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' end diff --git a/db/migrate/20220830113020_create_page_map_components.rb b/db/migrate/20220830113020_create_page_map_components.rb index 0a45e53e4..ae3afcb91 100644 --- a/db/migrate/20220830113020_create_page_map_components.rb +++ b/db/migrate/20220830113020_create_page_map_components.rb @@ -6,9 +6,9 @@ def change t.string :short_name t.string :description t.string :practices, array: true, default: [] - t.boolean :display_successful, default: false - t.boolean :display_in_progress, default: false - t.boolean :display_unsuccessful, default: false + t.boolean :display_successful_adoptions, default: false + t.boolean :display_in_progress_adoptions, default: false + t.boolean :display_unsuccessful_adoptions, default: false t.timestamps end end diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index dffc43cb8..d3a84fbbf 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -37,7 +37,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: true, display_in_progress: true, display_unsuccessful: true) + 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) 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) From 939abf1e6904f518120f5a697769fc20c54639c5 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 26 Sep 2022 12:52:00 -0700 Subject: [PATCH 44/99] dm-3508 Fixed styling for Info Window Facility Link. --- app/views/maps/_page_map_infowindow.html.erb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb index 24a13baaa..69ce26510 100644 --- a/app/views/maps/_page_map_infowindow.html.erb +++ b/app/views/maps/_page_map_infowindow.html.erb @@ -2,8 +2,6 @@
<% station_name = facility.official_station_name - station_number = facility.station_number - facility_name = facility.official_station_name facility_id = facility.id practice_list = @practices_list names = [] @@ -12,7 +10,13 @@ practices_to_display_in_info_window facility_id, practice_list, names, taglines, short_names @num_practices_adopted = names.count %> - <%= link_to "#{station_name} #{ show_common_name(station_name, facility.common_name)}", va_facility_path(facility), class: 'padding-for-map-component-infowindow-text usa-link font-sans-md text-bold' %> +

+ <%= link_to va_facility_path(facility) do %> +

+ <% end %> +

<%= @num_practices_adopted %> <% if @short_name.length > 0 %> <%= @short_name %> <% else %> Total <% end %> Innovation<% if @num_practices_adopted != 1 %>s<% end %>
From 3e87346434ab0b3199efe1ba03056d73fed608b7 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 27 Sep 2022 14:49:03 -0700 Subject: [PATCH 45/99] dm-3508 Map and info window styles.. enums for Diffusion History statuses.. etc. --- app/assets/javascripts/page/page_map.es6 | 2 +- .../dm/components/_diffusion_history.scss | 2 - .../stylesheets/dm/pages/_practice.scss | 17 ++------ app/controllers/page_controller.rb | 40 +++++++++---------- .../diffusion_history_status_helper.rb | 24 +++++++++++ app/views/maps/_page_map_infowindow.html.erb | 14 +++---- app/views/page/_page_map.html.erb | 2 +- 7 files changed, 55 insertions(+), 46 deletions(-) create mode 100644 app/helpers/diffusion_history_status_helper.rb diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 271685969..7313d6944 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -17,7 +17,7 @@ function initialize() { handler.buildMap({ provider: { center: {lat: 39.8097343, lng: -98.5556199}, - zoom: 4.1, + zoom: 3.8, zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, diff --git a/app/assets/stylesheets/dm/components/_diffusion_history.scss b/app/assets/stylesheets/dm/components/_diffusion_history.scss index b08010528..fd8045782 100644 --- a/app/assets/stylesheets/dm/components/_diffusion_history.scss +++ b/app/assets/stylesheets/dm/components/_diffusion_history.scss @@ -7,8 +7,6 @@ .community_map_styles{ height: 540px; - width: 100%; - max-width: 726px; } .home-marker-modal { diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 1332e62d3..2c8a7c2e8 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -990,21 +990,12 @@ li.small-disc:before { .map-infowindow-size{ width: 575px !important; - min-width: 200px !important; + //min-width: 200px !important; height: 339px !important; } -.map-infowindow-border{ - width: 560px !important; - min-width: 200px !important; - border-width: 0.01rem !important; - border-color: lightgray !important; - border-style: dotted !important; - border-radius: 4px !important; - padding: 2% 3% 2% 4% !important; -} -.padding-for-map-component-infowindow-text{ - padding-left: 4% !important; - display:block !important; + +.gm-style-iw.gm-style-iw-c{ + padding: 56px 8px 52px 8px; } tr.border_bottom td { diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 681313863..4f3e59818 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -7,7 +7,7 @@ def show if pc.component_type == "PageMapComponent" @practices_list = PageMapComponent.find_by_id(pc.component_id) @short_name = @practices_list.short_name - adoptions = get_adopting_facilities_for_these_practices(@practices_list, @practices_list.display_successful_adoptions, @practices_list.display_in_progress_adoptions, @practices_list.display_unsuccessful_adoptions) + 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 @@ -81,23 +81,23 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) ) end - 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" && successful_adoptions - va_facilities_list.push dh.va_facility_id - elsif dhs == "In progress" && 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 + # 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 diff --git a/app/helpers/diffusion_history_status_helper.rb b/app/helpers/diffusion_history_status_helper.rb new file mode 100644 index 000000000..1b306f0b6 --- /dev/null +++ b/app/helpers/diffusion_history_status_helper.rb @@ -0,0 +1,24 @@ +module DiffusionHistoryStatusHelper + + def get_adopting_facilities_for_these_practices(practices_list, successful_adoptions, in_progress_adoptions, unsuccessful_adoptions) + debugger + 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/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb index 69ce26510..48d843726 100644 --- a/app/views/maps/_page_map_infowindow.html.erb +++ b/app/views/maps/_page_map_infowindow.html.erb @@ -1,5 +1,5 @@
-
+
<% station_name = facility.official_station_name facility_id = facility.id @@ -10,20 +10,16 @@ practices_to_display_in_info_window facility_id, practice_list, names, taglines, short_names @num_practices_adopted = names.count %> -

- <%= link_to va_facility_path(facility) do %> -

- <% end %> +

+ <%= 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 %>
<% i = 0 %> <% while i < names.length do %> -
+
<%= names[i] %> <% if short_names[i].to_s.length > 0 %> <%= "(" + short_names[i] + ")" %> <% end %>
<%= taglines[i] %> diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index cc1d93e77..5b0b9a659 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 ca972341eb27037bbd54b9f9dec94800a07849d0 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:05:50 -0700 Subject: [PATCH 46/99] dm-3508 Addend links for innovations within the map component markers info-window --- app/helpers/diffusion_history_status_helper.rb | 1 - app/helpers/page_helper.rb | 3 ++- app/views/maps/_page_map_infowindow.html.erb | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/helpers/diffusion_history_status_helper.rb b/app/helpers/diffusion_history_status_helper.rb index 1b306f0b6..17679cfd8 100644 --- a/app/helpers/diffusion_history_status_helper.rb +++ b/app/helpers/diffusion_history_status_helper.rb @@ -1,7 +1,6 @@ module DiffusionHistoryStatusHelper def get_adopting_facilities_for_these_practices(practices_list, successful_adoptions, in_progress_adoptions, unsuccessful_adoptions) - debugger va_facilities_list = [] practices_list.practices.each do |pr| diffusion_histories = DiffusionHistory.where(practice_id: pr) diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index 867f2ac1d..de008402a 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -1,11 +1,12 @@ module PageHelper - def practices_to_display_in_info_window(facility_id, practice_list, names, taglines, short_names) + def practices_to_display_in_info_window(facility_id, practice_list, 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) 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 diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb index 48d843726..8f7680e26 100644 --- a/app/views/maps/_page_map_infowindow.html.erb +++ b/app/views/maps/_page_map_infowindow.html.erb @@ -7,7 +7,8 @@ names = [] taglines = [] short_names = [] - practices_to_display_in_info_window facility_id, practice_list, names, taglines, short_names + slugs = [] + practices_to_display_in_info_window facility_id, practice_list, names, taglines, short_names, slugs @num_practices_adopted = names.count %>

@@ -20,7 +21,9 @@ <% i = 0 %> <% while i < names.length do %>

- <%= names[i] %> <% if short_names[i].to_s.length > 0 %> <%= "(" + short_names[i] + ")" %> <% end %> + + <%= names[i] %> <% if short_names[i].to_s.length > 0 %> <%= "(" + short_names[i] + ")" %> <% end %> +
<%= taglines[i] %>
From 4e6b13a427160921c57a3f039b54837fe75c6b1c Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:59:09 -0700 Subject: [PATCH 47/99] dm-3508 forgot to update these changes in schema.rb --- db/schema.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 8ae62fa1c..e9d113631 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -668,9 +668,9 @@ t.string "short_name" t.string "description" t.string "practices", default: [], array: true - t.boolean "display_successful", default: false - t.boolean "display_in_progress", default: false - t.boolean "display_unsuccessful", default: false + t.boolean "display_successful_adoptions", default: false + t.boolean "display_in_progress_adoptions", default: false + t.boolean "display_unsuccessful_adoptions", default: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["page_component_id"], name: "index_page_map_components_on_page_component_id" From 8a9b2b3d8dccf1858d058c08b59bee4e9a173c59 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 11:46:42 -0700 Subject: [PATCH 48/99] dm-3508 remove commented code and fix margin in info window. --- app/controllers/page_controller.rb | 20 -------------------- app/views/maps/_page_map_infowindow.html.erb | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 4f3e59818..fcee302da 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -80,24 +80,4 @@ def get_pagy_practices_array (practices, page_practice_list_index, params_index) link_extra: "data-remote='true' class='dm-paginated-#{page_practice_list_index}-link dm-paginated-#{page_practice_list_index}-practices-#{params_index.nil? ? 2 : params_index.to_i + 1}-link dm-button--outline-secondary margin-top-105 width-auto'" ) end - - # 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 diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb index 8f7680e26..4cb3eae99 100644 --- a/app/views/maps/_page_map_infowindow.html.erb +++ b/app/views/maps/_page_map_infowindow.html.erb @@ -14,7 +14,7 @@

<%= 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 %>
From f9b96e0850a1125f8b91de7c3dcd09393539e11d Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:38:52 -0700 Subject: [PATCH 49/99] dm-3508 Added model test. --- spec/models/page_map_component_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 spec/models/page_map_component_spec.rb diff --git a/spec/models/page_map_component_spec.rb b/spec/models/page_map_component_spec.rb new file mode 100644 index 000000000..7418a0f2e --- /dev/null +++ b/spec/models/page_map_component_spec.rb @@ -0,0 +1,7 @@ +require 'rails_helper' + +RSpec.describe PageMapComponent, type: :model do + describe 'associations' do + it { should have_one(:page_component) } + end +end \ No newline at end of file From c5650bf1168e519c34c7a2daedf2a2f916f346b2 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:53:44 -0700 Subject: [PATCH 50/99] dm-3508 more tests for map --- spec/features/pages/show_page_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index d3a84fbbf..f5f09a62c 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -87,6 +87,11 @@ it 'should display the map' do expect(page).to have_content('test map') expect(page).to have_content('map description') + expect(html).to have_selector('div', id: 'page_builder_map') + expect(html).to have_selector('div', class: 'grid-col-12') + expect(html).to have_selector('div', class: 'desktop:grid-col-7') + expect(html).to have_selector('div', class: 'community_map_styles') + expect(html).to have_selector('div', class: 'gm-style') end it 'Should display the subpage hyperlink' do From 0ad892e9a40cdb03c6b249510a21eff4f80444af Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:00:26 -0700 Subject: [PATCH 51/99] dm-3508 try to fix test. --- 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 f5f09a62c..be28db7a1 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -87,7 +87,7 @@ it 'should display the map' do expect(page).to have_content('test map') expect(page).to have_content('map description') - expect(html).to have_selector('div', id: 'page_builder_map') + expect(html).to have_selector('#page_builder_map') expect(html).to have_selector('div', class: 'grid-col-12') expect(html).to have_selector('div', class: 'desktop:grid-col-7') expect(html).to have_selector('div', class: 'community_map_styles') From 52fd16015af1aec7ad21961536e4a9787ff47ae2 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:08:25 -0700 Subject: [PATCH 52/99] dm-3508 Fix test. --- spec/features/pages/show_page_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index be28db7a1..4c317b7b3 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -87,7 +87,6 @@ it 'should display the map' do expect(page).to have_content('test map') expect(page).to have_content('map description') - expect(html).to have_selector('#page_builder_map') expect(html).to have_selector('div', class: 'grid-col-12') expect(html).to have_selector('div', class: 'desktop:grid-col-7') expect(html).to have_selector('div', class: 'community_map_styles') From fdcdbe24498147696b6d44ff7477ffbe57b60a51 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:18:08 -0700 Subject: [PATCH 53/99] dm-3508 --- spec/features/pages/show_page_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 4c317b7b3..7f6cacbff 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -88,7 +88,6 @@ expect(page).to have_content('test map') expect(page).to have_content('map description') expect(html).to have_selector('div', class: 'grid-col-12') - expect(html).to have_selector('div', class: 'desktop:grid-col-7') expect(html).to have_selector('div', class: 'community_map_styles') expect(html).to have_selector('div', class: 'gm-style') end From 801eb9f8bf5bbd5474e65f0dca05812967861994 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:28:37 -0700 Subject: [PATCH 54/99] dm-3508 ok.. lets try different syntax.. --- spec/features/pages/show_page_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 7f6cacbff..9411270b8 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -87,9 +87,11 @@ it 'should display the map' do expect(page).to have_content('test map') expect(page).to have_content('map description') - expect(html).to have_selector('div', class: 'grid-col-12') - expect(html).to have_selector('div', class: 'community_map_styles') - expect(html).to have_selector('div', class: 'gm-style') + expect(html).to have_selector('div#page_builder_map') + expect(html).to have_selector('div.grid-col-12') + expect(html).to have_selector('desktop:grid-col-7') + expect(html).to have_selector('div.community_map_styles') + expect(html).to have_selector('div.gm-style') end it 'Should display the subpage hyperlink' do From d3847e3dd0b14abe8aa478a7f154333fd583f5fd Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:00:35 -0700 Subject: [PATCH 55/99] m-3508 display-none? --- spec/features/pages/show_page_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 9411270b8..12adecc44 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -87,7 +87,6 @@ it 'should display the map' do expect(page).to have_content('test map') expect(page).to have_content('map description') - expect(html).to have_selector('div#page_builder_map') expect(html).to have_selector('div.grid-col-12') expect(html).to have_selector('desktop:grid-col-7') expect(html).to have_selector('div.community_map_styles') From b5fa7f2e40fde9750865f5c0b3b5e802774d1642 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:22:01 -0700 Subject: [PATCH 56/99] dm-3508 forgot the div --- 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 12adecc44..8bf54944d 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -88,7 +88,7 @@ expect(page).to have_content('test map') expect(page).to have_content('map description') expect(html).to have_selector('div.grid-col-12') - expect(html).to have_selector('desktop:grid-col-7') + expect(html).to have_selector('div.desktop:grid-col-7') expect(html).to have_selector('div.community_map_styles') expect(html).to have_selector('div.gm-style') end From ea5ed0ab66eba64a76bf22475c13b554a1ec6287 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:28:29 -0700 Subject: [PATCH 57/99] dm-3508 --- spec/features/pages/show_page_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 8bf54944d..c5c30c4c6 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -88,7 +88,6 @@ expect(page).to have_content('test map') expect(page).to have_content('map description') expect(html).to have_selector('div.grid-col-12') - expect(html).to have_selector('div.desktop:grid-col-7') expect(html).to have_selector('div.community_map_styles') expect(html).to have_selector('div.gm-style') end From 41439a84eb8093f9aa1fa7a91ea22d13b0d624b5 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:38:43 -0700 Subject: [PATCH 58/99] dm-3508 --- spec/features/pages/show_page_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index c5c30c4c6..20d0ce674 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -88,7 +88,6 @@ expect(page).to have_content('test map') expect(page).to have_content('map description') expect(html).to have_selector('div.grid-col-12') - expect(html).to have_selector('div.community_map_styles') expect(html).to have_selector('div.gm-style') end From ef5984c4925a52ed7492be94114da1e0d4cc0272 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:57:16 -0700 Subject: [PATCH 59/99] dm-3508 --- spec/features/pages/show_page_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 20d0ce674..611fc8d98 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -88,7 +88,6 @@ expect(page).to have_content('test map') expect(page).to have_content('map description') expect(html).to have_selector('div.grid-col-12') - expect(html).to have_selector('div.gm-style') end it 'Should display the subpage hyperlink' do From 892636867375753c4e08ffea057b40d70094a4ed Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Fri, 30 Sep 2022 09:53:58 -0700 Subject: [PATCH 60/99] dm-3508 info window styles --- app/assets/javascripts/application.js | 3 ++- .../javascripts/page/page_infowindow.coffee | 23 +++++++++++++++++++ app/assets/javascripts/page/page_map.es6 | 3 +++ .../dm/components/page_component.scss | 6 +++++ .../stylesheets/dm/pages/_practice.scss | 10 ++++---- app/views/page/show.html.erb | 2 +- 6 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 app/assets/javascripts/page/page_infowindow.coffee diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 848b7d9d1..be13643fc 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -57,4 +57,5 @@ //= require visns/visn_va_facility_infowindow //= require jquery.collapser.js //= require category_usage.js -//= require tinymce \ No newline at end of file +//= require tinymce +//= require page/page_infowindow \ No newline at end of file diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee new file mode 100644 index 000000000..e37e7e312 --- /dev/null +++ b/app/assets/javascripts/page/page_infowindow.coffee @@ -0,0 +1,23 @@ +class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from base builder + # 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 + @infowindow = new InfoBox(@infobox(boxText)) + +# add @bind_infowindow() for < 2.1 + + infobox: (boxText)-> + content: boxText + pixelOffset: new google.maps.Size(-25, 0) + boxStyle: { + width: "479px", + height: "339px", + overflow: "auto", + backgroundColor: "white", + padding: "52px 8px" + } + alignBottom: true diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 7313d6944..9cf9d56be 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -2,6 +2,9 @@ function initialize() { const handler = Gmaps.build('Google', { markers: { clusterer: null + }, + builders: { + Marker: PageInfoBoxBuilder } }); let markers; diff --git a/app/assets/stylesheets/dm/components/page_component.scss b/app/assets/stylesheets/dm/components/page_component.scss index f7ed674ee..b15ecd509 100644 --- a/app/assets/stylesheets/dm/components/page_component.scss +++ b/app/assets/stylesheets/dm/components/page_component.scss @@ -145,4 +145,10 @@ margin: 0; } } + + .page-map-component{ + .page-marker-container { + height: 339px; + } + } } diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 87265e203..34f0d25ac 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -988,11 +988,11 @@ li.small-disc:before { } } -.map-infowindow-size{ - width: 575px !important; - //min-width: 200px !important; - height: 339px !important; -} +//.map-infowindow-size{ +// width: 575px !important; +// //min-width: 200px !important; +// height: 339px !important; +//} .gm-style-iw.gm-style-iw-c{ padding: 56px 8px 52px 8px; diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index 8e3043f40..6e2115e85 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -184,7 +184,7 @@
<%= content_tag(:span, title, class: 'margin-right-1') if title != '' %>
-
+
<%= render partial: "page/page_map", locals: { component: component } %>
From 3986563c8818c226e6f5cd6b5d1b5795a361140d Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Fri, 30 Sep 2022 10:02:39 -0700 Subject: [PATCH 61/99] dm-3508 --- 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 e37e7e312..8cf4c4223 100644 --- a/app/assets/javascripts/page/page_infowindow.coffee +++ b/app/assets/javascripts/page/page_infowindow.coffee @@ -12,7 +12,7 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba infobox: (boxText)-> content: boxText - pixelOffset: new google.maps.Size(-25, 0) + pixelOffset: new google.maps.Size(-200, 200) boxStyle: { width: "479px", height: "339px", From eb41e02f672e53a319f87b99c155abb6ee3a4def Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Fri, 30 Sep 2022 10:10:55 -0700 Subject: [PATCH 62/99] dm-3508 info window size and positioning --- app/assets/javascripts/page/page_infowindow.coffee | 6 +++--- app/assets/javascripts/page/page_map.es6 | 2 +- app/views/page/_page_map.html.erb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee index 8cf4c4223..bda674de5 100644 --- a/app/assets/javascripts/page/page_infowindow.coffee +++ b/app/assets/javascripts/page/page_infowindow.coffee @@ -12,10 +12,10 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba infobox: (boxText)-> content: boxText - pixelOffset: new google.maps.Size(-200, 200) + pixelOffset: new google.maps.Size(-180, 200) boxStyle: { - width: "479px", - height: "339px", + width: "450px", + height: "300px", overflow: "auto", backgroundColor: "white", padding: "52px 8px" diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 9cf9d56be..1cf86c5f0 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -20,7 +20,7 @@ function initialize() { handler.buildMap({ provider: { center: {lat: 39.8097343, lng: -98.5556199}, - zoom: 3.8, + zoom: 4.0, zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, diff --git a/app/views/page/_page_map.html.erb b/app/views/page/_page_map.html.erb index 5b0b9a659..d126bb6dd 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 c4d782bb4f7a17ef57b38a029f03deab4602cd6b Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Fri, 30 Sep 2022 10:13:22 -0700 Subject: [PATCH 63/99] dm-3508 --- 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 bda674de5..f530194b9 100644 --- a/app/assets/javascripts/page/page_infowindow.coffee +++ b/app/assets/javascripts/page/page_infowindow.coffee @@ -12,7 +12,7 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba infobox: (boxText)-> content: boxText - pixelOffset: new google.maps.Size(-180, 200) + pixelOffset: new google.maps.Size(-150, 200) boxStyle: { width: "450px", height: "300px", From 16b4de06e0ecf9882ccb3824a5ddb905ce7c4207 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Fri, 30 Sep 2022 11:09:27 -0700 Subject: [PATCH 64/99] dm-3508 --- 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 f530194b9..16ed83b06 100644 --- a/app/assets/javascripts/page/page_infowindow.coffee +++ b/app/assets/javascripts/page/page_infowindow.coffee @@ -12,7 +12,7 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba infobox: (boxText)-> content: boxText - pixelOffset: new google.maps.Size(-150, 200) + pixelOffset: new google.maps.Size(-200, 150) boxStyle: { width: "450px", height: "300px", From 36acdb50116e3019cd2d0f31045d5b988e9aa388 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 3 Oct 2022 11:36:59 -0700 Subject: [PATCH 65/99] dm-3508 Style changes per design. --- .../javascripts/page/page_infowindow.coffee | 4 ++-- app/assets/javascripts/page/page_map.es6 | 3 ++- .../dm/components/_diffusion_history.scss | 2 +- .../stylesheets/dm/pages/_practice.scss | 6 ----- app/views/maps/_page_map_infowindow.html.erb | 2 +- app/views/page/_page_map.html.erb | 2 +- spec/features/pages/show_page_spec.rb | 24 ++++++++++++++++++- 7 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/page/page_infowindow.coffee b/app/assets/javascripts/page/page_infowindow.coffee index 16ed83b06..00eebf1a2 100644 --- a/app/assets/javascripts/page/page_infowindow.coffee +++ b/app/assets/javascripts/page/page_infowindow.coffee @@ -12,9 +12,9 @@ class @PageInfoBoxBuilder extends Gmaps.Google.Builders.Marker # inherit from ba infobox: (boxText)-> content: boxText - pixelOffset: new google.maps.Size(-200, 150) + pixelOffset: new google.maps.Size(-260, 150) boxStyle: { - width: "450px", + width: "540px", height: "300px", overflow: "auto", backgroundColor: "white", diff --git a/app/assets/javascripts/page/page_map.es6 b/app/assets/javascripts/page/page_map.es6 index 1cf86c5f0..286f5cf0d 100644 --- a/app/assets/javascripts/page/page_map.es6 +++ b/app/assets/javascripts/page/page_map.es6 @@ -11,6 +11,7 @@ function initialize() { let dataMarkers; function buildMapMarkers(data) { + debugger dataMarkers = _.map(data, function (json, index) { json.marker = markers[index]; return json; @@ -20,7 +21,7 @@ function initialize() { handler.buildMap({ provider: { center: {lat: 39.8097343, lng: -98.5556199}, - zoom: 4.0, + zoom: 4.2, zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT }, diff --git a/app/assets/stylesheets/dm/components/_diffusion_history.scss b/app/assets/stylesheets/dm/components/_diffusion_history.scss index fd8045782..b764be737 100644 --- a/app/assets/stylesheets/dm/components/_diffusion_history.scss +++ b/app/assets/stylesheets/dm/components/_diffusion_history.scss @@ -6,7 +6,7 @@ } .community_map_styles{ - height: 540px; + height: 440px; } .home-marker-modal { diff --git a/app/assets/stylesheets/dm/pages/_practice.scss b/app/assets/stylesheets/dm/pages/_practice.scss index 34f0d25ac..1ea90dc85 100644 --- a/app/assets/stylesheets/dm/pages/_practice.scss +++ b/app/assets/stylesheets/dm/pages/_practice.scss @@ -988,12 +988,6 @@ li.small-disc:before { } } -//.map-infowindow-size{ -// width: 575px !important; -// //min-width: 200px !important; -// height: 339px !important; -//} - .gm-style-iw.gm-style-iw-c{ padding: 56px 8px 52px 8px; } diff --git a/app/views/maps/_page_map_infowindow.html.erb b/app/views/maps/_page_map_infowindow.html.erb index 4cb3eae99..fe95a2417 100644 --- a/app/views/maps/_page_map_infowindow.html.erb +++ b/app/views/maps/_page_map_infowindow.html.erb @@ -1,4 +1,4 @@ -
+
<% 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? %> <% 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