From 6c6800e83abff1478cc4a9a3969372ec884b4b40 Mon Sep 17 00:00:00 2001 From: e-lie Date: Sat, 1 Sep 2018 19:53:24 +0000 Subject: [PATCH] combine filtrers --- src/js/yunohost/controllers/apps.js | 12 ++++++++---- src/views/app/app_list_install.ms | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 7d7acdee..01caa518 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -110,10 +110,12 @@ transitionDuration: 200 }); - filterByClassAndName = function(filterClass) { + filterByClassAndName = function() { var input = jQuery("#filter-app-cards").val().toLowerCase(); var stringMatch = (jQuery(this).find('.app-title').text().toLowerCase().indexOf(input) > -1); - var classMatch = jQuery(this).hasClass(filterClass); + + var filterClass = jQuery("#dropdownFilter").attr("data-filter"); + var classMatch = (filterClass === '*') ? true : jQuery(this).hasClass(filterClass); return stringMatch && classMatch; }, @@ -121,10 +123,12 @@ cardGrid.isotope({ filter: '.official' }); jQuery('.dropdownFilter').on('click', function() { - cardGrid.isotope({ filter: filterByClassAndName }); - // change dropdown label jQuery('#app-cards-list-filter-text').text(jQuery(this).find('.menu-item').text()); + // change filter attribute + jQuery('#dropdownFilter').attr("data-filter", jQuery(this).attr("data-filter")); + + cardGrid.isotope({ filter: filterByClassAndName }); }); jQuery("#filter-app-cards").on("keyup", function() { diff --git a/src/views/app/app_list_install.ms b/src/views/app/app_list_install.ms index bc3b8e33..bdc9f2a3 100644 --- a/src/views/app/app_list_install.ms +++ b/src/views/app/app_list_install.ms @@ -22,7 +22,7 @@ -