4

I am having trouble integrating Galleria with my rails application. Here is the deal:

These are the locations of my files:

/root/rails_project/sample_app/app/assets/stylesheets/galleria.classic.css.scss
/root/rails_project/sample_app/app/assets/javascript/galleria-1.2.7.min.js
/root/rails_project/sample_app/app/assets/javascript/galleria-1.2.7.min.js
/root/rails_project/sample_app/app/assets/javascript/galleria.classic.js
/root/rails_project/sample_app/app/assets/javascript/classic-loader.gif
/root/rails_project/sample_app/app/assets/javascript/classic-map.png

In my application.css, I have added this line :

*= require galleria.classic

In my application.js, I have added this line :

//= require galleria-1.2.7
//= require galleria.classic

Finally, this happens to be my view file:

<h1>Displaying Photos</h1>
<script src="/root/rails_project/sample_app/app/assets/javascript/galleria-1.2.7.min.js"></script>
<div id="abc">
<% @pictures.each do |picture| %>
    <% if (picture.tag).include? @tag %>
            <ol class="microposts">
            <li id="<%= picture.id %>">
            <span class="content">
                    <%= image_tag picture.photo.url(:medium) %>
            </span>
            </li>
            </ol>
    <% end %>
<% end %>
</div>
<script>
            Galleria.loadTheme('/root/rails_project/sample_app/app/assets/javascript/galleria.classic.min.js');
        Galleria.run('#abc');
</script>

When I refresh my page, none of the images are displayed. On top of that I get the following error message:

Fatal error: Theme at /root/rails_project/sample_app/app/assets/javascript/galleria.classic.min.js could not load, check theme path.

Please help me out with where exactly to put my files.

Thanks in advance!

Kevin Bedell
  • 13,254
  • 10
  • 78
  • 114
sidharth singh
  • 309
  • 1
  • 5
  • 12

1 Answers1

4

Update your code:

Galleria.loadTheme("<%= javascript_path('galleria.classic.js') %>");
NARKOZ
  • 27,203
  • 7
  • 68
  • 90
  • Thanks a lot man. That worked for me. I have been so many things since the morning. Nothing seemed to work. Just one more question though - Currently, I have placed my JS and CSS files for Galleria in vendor/assets/javascript and vendor/assets/stylesheets respectively. Is that okay or should I move them back to app/assets instead. I have asset pipelining enabled. – sidharth singh Jul 09 '12 at 13:25