added filters by text type

This commit is contained in:
2018-09-18 12:21:57 +02:00
parent 30443960ab
commit 2eeceb6a60
10 changed files with 190 additions and 61 deletions
+39
View File
@@ -25,6 +25,7 @@ module.exports = {
]),
m('div', {'id':"menus"}, [
m(_PartsNav),
m(_Filters),
m(_RouteMenu),
m(_LangMenu)
])
@@ -57,6 +58,44 @@ var _PartsNav = {
}
};
// ___ _ _ _ __ __
// | __(_) | |_ ___ _ _ ___ | \/ |___ _ _ _ _
// | _|| | | _/ -_) '_(_-< | |\/| / -_) ' \ || |
// |_| |_|_|\__\___|_| /__/ |_| |_\___|_||_\_,_|
var _Filters = {
view(vn){
var lang = m.route.param('lang');
return m('nav', {id:'filters'}, [
m('h3', _i18n.t('Filters')),
m('ul', _dbs.types[lang].map(function(p){
// console.log("types", p);
return m('li', [
m('a', {
'href':`#filter-${p}`,
'type':`${p}`,
onclick(e){
// console.log('click filter btn', type);
e.preventDefault();
if(e.target.parentNode.classList.contains('active')){
e.target.parentNode.classList.remove('active');
_dbs.active_type_filter = null;
}else{
e.target.parentNode.classList.add('active');
let type = e.target.getAttribute("type");
_dbs.active_type_filter = type;
}
return false;
}
}, p)
]);
})
)
]);
}
}
// ____ __
// / __ \____ __ __/ /____ ____ ___ ___ ____ __ __
// / /_/ / __ \/ / / / __/ _ \ / __ `__ \/ _ \/ __ \/ / / /