7

so I have scoured stackoverflow and found some similar articles but nothing has worked for me yet. I am creating a rails app and I want to use the Masonry for my layout. I have tried uploading the js as described in this post, but I could not get it to work no matter how many times I tried (yes I matched all the correct IDs and classes). I know the gem is working because the CSS is loading fine, I just cant get the JS to work. Here is what I have at the moment

Gemfile:

# masonry layout
gem 'masonry-rails'

application.js:

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree . 
//= require masonry/jquery.masonry  

index.html.erb:

<div class="center">

<div id="masonry-container" class="transitions-enabled infinite-scroll clearfix">
    <%= render @products %>
</div>

    <div class="paginator">
    <%= will_paginate @products, renderer: BootstrapPagination::Rails %>
    </div>
</div>

_products.html.erb

<div class="box">
<% gfyid = product.gfy.to_s.gsub("http://gfycat.com/", "") %>
<h2><%= product.name %></h2>
<div class="gfySize">
    <div class="gfyitem" data-title=false data-autoplay=false data-controls=false data-expand=false data-id="<%= gfyid %>"></div>
</div>

I am so lost, I have been working on this for hours trying everything. The CSS is working/looking fine but I am just struggling with the js. Would appreciate any help thank you so much!

Community
  • 1
  • 1
tommy-taco
  • 227
  • 1
  • 8
  • What is not working and what is not occurring that you expect to occur? Do you have any errors messages? Have you looked at your js console? – Michael Jul 18 '14 at 06:31
  • There are no error messages, and the css elements from the gem are working fine. The console doesn't bring anything up, just loading scripts from gfycat, as I am using their js plugin on my website – tommy-taco Jul 18 '14 at 20:01
  • Could it be that you are not closing your
    ?
    – Jackson Jul 25 '14 at 11:45
  • Hey sorry I did not come back to this, I ended up abondoning the gem and installing it manually, putting the masonry file in the vendors folder and writing the code in the product.js section. I think the latter is what fixed it, thanks! – tommy-taco Jul 25 '14 at 20:38

1 Answers1

1

Try installing it manually, putting the masonry file in the vendors folder and writing the code in the product.js section.

Andrew Hendrie
  • 5,455
  • 3
  • 37
  • 64