Skip to Content
Menu
This question has been flagged
1 Reply
8285 Views

i have created a snippet but the css and js are not being called. 

this is in my snippet.xml

<section class="oe_snippet_body fancybox">
                        <div class="col-md-3">
                            <div class="post-thumbnail element">
                                <img src="/website_fancybox/static/img/Moon.jpg"/> 
                                <a data-fancybox-group="gallery" href="/website_fancybox/static/img/Moon.jpg"
                                class="element-lightbox fancybox">
                                <i class="fa fa-search-plus"></i></a>
                            </div>
                        </div>
                    </section>

and i tried to call the css and js using assets.xml

<openerp>
    <data>

        <template id="javascripts_head" inherit_id="website.layout">
            <xpath expr="//head" position="inside">
              <link href="/website_fancybox/static/css/bootstrap.min.css" rel="stylesheet" type="text/less"/>
              <link href="/website_fancybox/static/css/style.css" rel="stylesheet" type="text/less"/>
              <link href="/website_fancybox/static/css/jquery.fancybox.css" rel="stylesheet" type="text/less"/>
              <script type="text/javascript" src="/website_fancybox/static/src/js/fboxscript.js"></script>
              <script type="text/javascript" src="/website_fancybox/static/src/js/jquery.fancybox.js"></script>
              <script type="text/javascript" src="/website_fancybox/static/src/js/jquery-1.10.1.min.js"></script>
            </xpath>
        </template>

    </data>
</openerp>

how do i make this work. i wanted the image to show in col-md-3 size not its original size. also the js would bring up modal box. 

Avatar
Discard
Best Answer

You need a template that inherit "website.assets_editor", something like that:

<template id="custom_css_and_js" inherit_id="website.assets_editor" name="Custom CSS and JS">

    <xpath expr="//link[last()]" position="after">

        <!-- your custom css goes here -->

    </xpath>

    <xpath expr="//script[last()]" position="after">

        <!-- your custom javascript goes here -->

    </xpath>

</template>

Avatar
Discard