Skip to content

Instantly share code, notes, and snippets.

@jessabean
Created April 17, 2013 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessabean/5408752 to your computer and use it in GitHub Desktop.
Save jessabean/5408752 to your computer and use it in GitHub Desktop.
Example of inserting javascript specific to a page or resource
!!!
%html{:lang => "en", :xhmns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en"}
%head
%title= full_title(yield(:title))
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
= stylesheet_link_tag "application", "http://fonts.googleapis.com/css?family=Questrial|Damion"
= javascript_include_tag "https://js.stripe.com/v1/", "application"
= csrf_meta_tags
= tag :meta, :name => "stripe-key", :content => STRIPE_PUBLIC_KEY
%body
= render :partial => "shared/navbar"
#content.container
= render :partial => "shared/sub_menu", :locals => {:categories => @categories}
= render :partial => "shared/flash_messages", :locals => {:flash => flash}
= yield
= render :partial => "shared/footer"
= yield(:javascripts)
/ %h1= current_store.name
%ul.breadcrumb
%li
%span.divider
/
%li.active
All Products
.row-fluid
.thumbnails.product_list
- @products.each_with_index do |product, index|
- if product.active
%li.span3
.thumbnail{id: "thumbnail-#{index}"}
= link_to product_path(product.store, product) do
= image_tag product.photo.url
%div{class: "cart-hidden-#{index}"}
= button_to "Add to Cart", line_items_path(:store_id => current_store, :product_id => product), :class => "form-primary-button"
.caption
%h5= link_to product.title, product_path(product.store, product)
%p= number_to_currency(product.price_in_dollars)
/ = paginate @products
= javascript_include_tag "products"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment