Hi everybody,
I just started to learn Odoo, and I try to create a snippet for my theme. I added a CSS style for my snippet, but I don't know how to add JS !
In my snippet.xml , I writed this :
<template id="mystyle" name="My style" inherit_id="website.assets_backend">
<xpath expr="." position="inside">
<link href="/theme_kissa/static/src/css/style.css" rel="stylesheet" type="text/css"/>
<link href="/theme_kissa/static/src/js/javascript.js" rel="stylesheet" type="text/javascript"/>
</xpath>
and in my Javascript.js , this one :
odoo.define('theme_kissa.javascript_nom', function(require) {
"use strict";
var a_variable = require('theme_kissa.javascript_nom.define'); // for this file 'your_module_name.some_name'
a_variable.include({
fonctionjava: function(args) {
$(".filter-button").click(function(){
var value = $(this).attr('data-filter');
if(value == "all")
{
//$('.filter').removeClass('hidden');
$('.filter').show('1000');
}
else
{
// $('.filter[filter-item="'+value+'"]').removeClass('hidden');
// $(".filter").not('.filter[filter-item="'+value+'"]').addClass('hidden');
$(".filter").not('.'+value).hide('3000');
$('.filter').filter('.'+value).show('3000');
}
});
if ($(".filter-button").removeClass("active")) {
$(this).removeClass("active");
}
$(this).addClass("active");
},
});
});
Can you help please? Where is the wrong with this code ? And sorry for my english...