Pergunta

I'm trying to use the timeline from http://timeline.verite.co/ - and I can't get it to work. I think I've tracked down the issue, but don't know how to resolve it.

Basically, the javascript is being served from the assets folder, and it is coded to look within the same folder for certain files that it needs to work (e.g. /assets/js/timeline.js). Even though this file is within the correct folder in the assets folder, the app is giving a routing error saying that no route matches /assets/js/timeline.js.

As the javascript has been minified and is a nightmare to try and trawl through, is there a way that I can get the assets folder to respond to routing requests? Or will this be a massive problem in production and in reality there is a better way to do it?

Any help would be much appreciated!

Foi útil?

Solução

I've come across a fix that works for now - in case anyone else needs to use this. It's probably very clunky and not the greatest, but still. This works in development, not tried it in production. Feel free to suggest any improvements/alternatives.

I put the following in the application layout:

<%= javascript_include_tag "/js/storyjs-embed.js" %>
        <script>
            $(document).ready(function() {
                createStoryJS({
                    type:       'timeline',
                    width:      '800',
                    height:     '600',
                    source:     '/js/example_json.json',
                    embed_id:   'my-timeline'
                });
            });
        </script>

Then put the relevant files in the folder structure that the JS asks for in the public folder. And, for now at least, it works.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top