Skip to content

Commit

Permalink
Remove hardcoded content from homepage view
Browse files Browse the repository at this point in the history
  • Loading branch information
camillevilla committed Sep 4, 2024
1 parent d4c66e7 commit bb2dc8a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 115 deletions.
2 changes: 1 addition & 1 deletion app/models/homepage_feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def image_s3_presigned_url(style = nil)
end

def self.column_size(item_count = 3)
if item_count >= 3
if item_count == nil || item_count >= 3
'three-column-layout'
else # update this later to deal with incoming designs
'two-column-layout'
Expand Down
145 changes: 31 additions & 114 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -91,130 +91,47 @@
</form>
</section>
<div class="grid-container">
<% fallback_content? = @homepage.blank? && (controller.action_name != 'preview') %>
<section id="homepage-section-1" class="homepage-section">
<% if fallback_content? %>
<h2 class="section-title">Featured Innovations</h2>
<div class="grid-row grid-gap">
<div id="section-1-feature-1" class="homepage-feature three-column-layout">
<%= image_tag("homepage/innovation-CREW.jpg", alt: "Two people preparing vegetables at a cutting board",class: "homepage-featured-image") %>
<h3 id="section-1-feature-1-title" class="feature-title">CREW: Carbohydrate Reduction Empowering Wellness (formerly Therapeutic Carbohydrate Reduction (TCR) Aspire)</h3>
<p class="usa-prose-body margin-bottom-5">
CREW is a 16-week lifestyle program that uses goal setting and whole health coaching to support Veterans with Type 2 Diabetes and other metabolic health conditions.
</p>
<a href="/innovations/therapeutic-carbohydrate-restricted-tcr-aspire" aria-describedby="section-1-feature-1-title" class="usa-link">View Innovation</a>
</div>
<div id="section-1-feature-2" class="homepage-feature three-column-layout">
<%= image_tag("homepage/innovation-PRIDE.jpg", alt: "Rainbow flag and trans flag patterned identification tags encircled by a stethoscope", class: "homepage-featured-image") %>
<h3 id="section-1-feature-2-title" class="feature-title">PRIDE In All Who Served</h3>
<p class="usa-prose-body margin-bottom-5">
PRIDE In All Who Served is a health promotion group for LGBTQIA+ Veterans that fosters support and improves health literacy. Veterans have praised the program for significantly enhancing their well-being and communication with healthcare providers.
</p>
<a href="/innovations/pride-in-all-who-served-reducing-healthcare-disparities-for-lgbt-veterans" aria-describedby="section-1-feature-2-title" class="usa-link">View Innovation</a>
</div>
<div id="section-1-feature-3" class="homepage-feature three-column-layout">
<%= image_tag("homepage/innovation-Close-to-Me.jpg", alt: "Doctor and patient discuss cancer test results", class: "homepage-featured-image") %>
<h3 id="section-1-feature-3-title" class="feature-title">Close to Me Cancer Care</h3>
<p class="usa-prose-body margin-bottom-5">
Close to Me Cancer Care, sponsored by the VHA National Oncology Program Office, provides anti-cancer therapy services at Community Based Outpatients Clinics (CBOCs) to increase access points to care for Veterans.
</p>
<a href="/innovations/close-to-me-infusion-service" aria-describedby="section-1-feature-3-title" class="usa-link">View Innovation</a>
</div>
</div>
<% else %>
<h2 class="section-title"><%= @homepage&.section_title_one %> </h2>
<div class="grid-row grid-gap">
<% column_classes = HomepageFeature.column_size(@section_one_features.count) %>
<% @section_one_features.each_with_index do |hf, index| %>
<div id="section-1-feature-<%= index + 1 %>" class="homepage-feature <%= column_classes %>">
<%= image_tag "#{hf&.image_s3_presigned_url}", alt: hf&.image_alt_text, class: 'homepage-featured-image' if hf.featured_image.exists? %>
<%= tag.h3 hf.title, id: "section-1-feature-#{index + 1}-title", class: 'feature-title' if hf.title.present? %>
<%= tag.p hf.description, class: 'usa-prose-body margin-bottom-5' if hf.description.present? %>
<%= link_to hf&.cta_text, hf.url, class: 'usa-link', 'aria-describedby': "section-1-feature-#{index + 1}-title" if hf.url.present? %>
</div>
<% end %>
<h2 class="section-title"><%= @homepage&.section_title_one %> </h2>
<div class="grid-row grid-gap">
<% column_classes = HomepageFeature.column_size(@section_one_features&.count) %>
<% @section_one_features&.each_with_index do |hf, index| %>
<div id="section-1-feature-<%= index + 1 %>" class="homepage-feature <%= column_classes %>">
<%= image_tag "#{hf&.image_s3_presigned_url}", alt: hf&.image_alt_text, class: 'homepage-featured-image' if hf.featured_image.exists? %>
<%= tag.h3 hf.title, id: "section-1-feature-#{index + 1}-title", class: 'feature-title' if hf.title.present? %>
<%= tag.p hf.description, class: 'usa-prose-body margin-bottom-5' if hf.description.present? %>
<%= link_to hf&.cta_text, hf.url, class: 'usa-link', 'aria-describedby': "section-1-feature-#{index + 1}-title" if hf.url.present? %>
</div>
<% end %>
</div>
</section>
<section id="homepage-section-2" class="homepage-section">
<% if fallback_content? %>
<h2 class="section-title">Trending Tags</h2>
<div class="grid-row grid-gap">
<div id="section-2-feature-1" class="homepage-feature three-column-layout">
<%= image_tag("homepage/tag-suicide-prevention.jpg", alt: "VA Secretary Denis McDonough greeting a volunteer at a VA clinic", class: "homepage-featured-image") %>
<h3 id="section-2-feature-1-title" class="feature-title">Suicide Prevention</h3>
<p class="usa-prose-body margin-bottom-5">
Discover our range of innovations focused on suicide prevention, ensuring Veterans receive the essential mental health care they deserve.
</p>
<a href="/search?category=Suicide%20Prevention" aria-describedby="section-2-feature-1-title" class="usa-link">Learn More</a>
</div>
<div id="section-2-feature-2" class="homepage-feature three-column-layout">
<%= image_tag("homepage/tag-homeheatlh.jpg", alt: "a miniature house in glove hands of a medical staff member", class: "homepage-featured-image") %>
<h3 id="section-2-feature-2-title" class="feature-title">Home Health</h3>
<p class="usa-prose-body margin-bottom-5">
Explore cutting-edge home health innovations, providing Veterans with personalized and accessible care in the comfort of their own homes
</p>
<a href="/search?category=Home%20Health" aria-describedby="section-2-feature-2-title" class="usa-link">Learn More</a>
</div>
<div id="section-2-feature-3" class="homepage-feature three-column-layout">
<%= image_tag("homepage/tag-specialty-care.jpg", alt: "a man attached to a blood pressure monitor", class: "homepage-featured-image") %>
<h3 id="section-2-feature-3-title" class="feature-title">Specialty Care</h3>
<p class="usa-prose-body margin-bottom-5">
Access the latest innovations in specialty care, dedicated to providing advanced medical treatments and personalized care tailored to Veterans' unique health needs.
</p>
<a href="/search?category=Specialty%20Care" aria-describedby="section-2-feature-3-title" class="usa-link">Learn More</a>
<h2 class="section-title"><%= @homepage&.section_title_two %></h2>
<div class="grid-row grid-gap">
<% column_classes = HomepageFeature.column_size(@section_two_features&.count) %>
<% @section_two_features&.each_with_index do |hf, index| %>
<div id="section-2-feature-<%= index + 1 %>" class="homepage-feature <%= column_classes %>">
<%= image_tag "#{hf&.image_s3_presigned_url}", alt: hf&.image_alt_text, class: 'homepage-featured-image' if hf.featured_image.exists? %>
<%= tag.h3 hf.title, id: "section-2-feature-#{index + 1}-title", class: 'feature-title' if hf.title.present? %>
<%= tag.p hf.description, class: 'usa-prose-body margin-bottom-5' if hf.description.present? %>
<%= link_to hf&.cta_text, hf.url, class: 'usa-link', 'aria-describedby': "section-2-feature-#{index + 1}-title" if hf.url.present? %>
</div>
</div>
<% else %>
<h2 class="section-title"><%= @homepage&.section_title_two %></h2>
<div class="grid-row grid-gap">
<% column_classes = HomepageFeature.column_size(@section_two_features.count) %>
<% @section_two_features.each_with_index do |hf, index| %>
<div id="section-2-feature-<%= index + 1 %>" class="homepage-feature <%= column_classes %>">
<%= image_tag "#{hf&.image_s3_presigned_url}", alt: hf&.image_alt_text, class: 'homepage-featured-image' if hf.featured_image.exists? %>
<%= tag.h3 hf.title, id: "section-2-feature-#{index + 1}-title", class: 'feature-title' if hf.title.present? %>
<%= tag.p hf.description, class: 'usa-prose-body margin-bottom-5' if hf.description.present? %>
<%= link_to hf&.cta_text, hf.url, class: 'usa-link', 'aria-describedby': "section-2-feature-#{index + 1}-title" if hf.url.present? %>
</div>
<% end %>
</div>
<% end %>
<% end %>
</div>
</section>
<section id="homepage-section-3" class="homepage-section">
<% if fallback_content? %>
<h2 class="section-title">Innovation Communities</h2>
<div class="grid-row grid-gap">
<div id="section-3-feature-1" class="homepage-feature two-column-layout">
<%= image_tag("homepage/community-age-friendly.jpg", alt: 'doctor and patient looking at a tablet together', class: "homepage-featured-image") %>
<h3 id="section-3-feature-1-title" class="feature-title">Age-Friendly</h3>
<p class="usa-prose-body margin-bottom-5">
Reimagining the landscape of healthcare for our aging Veteran population.
</p>
<%= link_to 'View Community', '/communities/age-friendly', class: 'usa-link', 'aria-describedby': 'section-3-feature-1-title' %>
</div>
<div id="section-3-feature-2" class="homepage-feature two-column-layout">
<%= image_tag("homepage/community-vr.jpg", alt: "a person wearing a VR headset, weraing a mask, and a Veterans Affairs lanyard", class: "homepage-featured-image") %>
<h3 id="section-3-feature-2-title" class="feature-title">VA Immersive</h3>
<p class="usa-prose-body margin-bottom-5">
We help improve care delivery and experiences by leveraging immersive technology for falls risk assessment, neurological risk assessment, pain management, anxiety, addiction recovery, physical therapy, recreation therapy, PTSD, employee education, and more.
</p>
<%= link_to 'View Community', '/communities/va-immersive', class: 'usa-link', 'aria-describedby': 'section-3-feature-2-title' %>
</div>
</div>
<% else %>
<h2 class="section-title"><%= @homepage&.section_title_three %></h2>
<div class="grid-row grid-gap">
<% column_classes = HomepageFeature.column_size(@section_three_features.count) %>
<% @section_three_features.each_with_index do |hf, index| %>
<div id="section-3-feature-<%= index + 1 %>" class="homepage-feature <%= column_classes %>">
<%= image_tag "#{hf&.image_s3_presigned_url}", alt: hf&.image_alt_text, class: 'homepage-featured-image' if hf.featured_image.exists? %>
<%= tag.h3 hf.title, id: "section-3-feature-#{index + 1}-title", class: 'feature-title' if hf.title.present? %>
<%= tag.p hf.description, class: 'usa-prose-body margin-bottom-5' if hf.description.present? %>
<%= link_to hf&.cta_text, hf.url, class: 'usa-link', 'aria-describedby': "section-3-feature-#{index + 1}-title" if hf.url.present? %>
</div>
<% end %>
<h2 class="section-title"><%= @homepage&.section_title_three %></h2>
<div class="grid-row grid-gap">
<% column_classes = HomepageFeature.column_size(@section_three_features&.count) %>
<% @section_three_features&.each_with_index do |hf, index| %>
<div id="section-3-feature-<%= index + 1 %>" class="homepage-feature <%= column_classes %>">
<%= image_tag "#{hf&.image_s3_presigned_url}", alt: hf&.image_alt_text, class: 'homepage-featured-image' if hf.featured_image.exists? %>
<%= tag.h3 hf.title, id: "section-3-feature-#{index + 1}-title", class: 'feature-title' if hf.title.present? %>
<%= tag.p hf.description, class: 'usa-prose-body margin-bottom-5' if hf.description.present? %>
<%= link_to hf&.cta_text, hf.url, class: 'usa-link', 'aria-describedby': "section-3-feature-#{index + 1}-title" if hf.url.present? %>
</div>
<% end %>
</div>
</section>
<section id="feature-nominate-innovation" class="">
<div class="grid-row grid-gap">
Expand Down

0 comments on commit bb2dc8a

Please sign in to comment.