我在将Galleria与我的rails应用程序集成时遇到问题。这是交易:

这些是我文件的位置:

/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


在我的application.css中,我添加了这一行:

*= require galleria.classic


在我的application.js中,我添加了这一行:

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


最后,这恰好是我的视图文件:

<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>


刷新页面时,没有图像显示。最重要的是,我得到以下错误消息:


致命错误:/root/rails_project/sample_app/app/assets/javascript/galleria.classic.min.js上的主题无法加载,请检查主题路径。


请帮助我准确地将文件放置在何处。

提前致谢!

最佳答案

更新您的代码:

Galleria.loadTheme("<%= javascript_path('galleria.classic.js') %>");

10-08 08:48