Skip to content

Instantly share code, notes, and snippets.

@billyboozer
Created October 29, 2013 13:24
Show Gist options
  • Save billyboozer/7214580 to your computer and use it in GitHub Desktop.
Save billyboozer/7214580 to your computer and use it in GitHub Desktop.
Embed html in yaml
// Yaml object
- image: /images/landing_pages/cool-season/interface.jpg
download: http://www.backedbybayer.com/system/product_guide/asset_file/73/Product_Interface.pdf
title: Interface
body: Interface provides year-round broad-spectrum disease control and plant health promotion with StressGard<sup>&trade;</sup> Formulation Technology. Interface controls key diseases such as dollar spot, brown patch, snow mold, Microdochium patch and leaf spots.
button_text: View Guide
// In the Controller
def cool_season_turf
@industry = Industry.find_by_slug 'golf-course-management'
@category = @industry.categories.find_by_slug 'fungicides'
@guides = YAML.load_file("#{Rails.root}/public/files/guides.yml")
@guides.map! { |data| OpenStruct.new(data) }
@products = YAML.load_file("#{Rails.root}/public/files/product-sheets.yml")
@products.map! { |data| OpenStruct.new(data) }
end
// In the view
#product-sheets.toggleDiv
.card-container
- @products.each_with_index do |product, index|
.card{class: (index+1)%4==0?"last":""}
.front.side
= image_tag product.image
.controls
%h5= product.title
= link_to "#{product.button_text}", product.download, class: 'download button', target: '_blank'
.info
= link_to 'i', '#', class: 'button'
.back.side
.content
%h3= product.title
%p= product.body
= link_to 'View Guide', product.download, class: 'button', target: '_blank'
.back_btn
=link_to 'Back','#', class: 'button'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment