diff --git a/admin/albums.php b/admin/albums.php index ac675bbd5..ba7473a77 100644 --- a/admin/albums.php +++ b/admin/albums.php @@ -170,8 +170,16 @@ function assocToOrderedTree($assocT) { $orderedTree = array(); + $query = ' +SELECT + category_id, + COUNT(*) AS nb_photos + FROM '.IMAGE_CATEGORY_TABLE.' + GROUP BY category_id +;'; + + $nb_photos_in = query2array($query, 'category_id', 'nb_photos'); - // echo '
'; print_r($assocT); echo '
'; foreach($assocT as $cat) { $orderedCat = array(); @@ -179,7 +187,7 @@ function assocToOrderedTree($assocT) $orderedCat['name'] = $cat['cat']['name']; $orderedCat['status'] = $cat['cat']['status']; $orderedCat['id'] = $cat['cat']['id']; - $orderedCat['nb_images'] = 'test2'; + $orderedCat['nb_images'] = isset($nb_photos_in[$cat['cat']['id']]) ? $nb_photos_in[$cat['cat']['id']] : 0; $orderedCat['last_updates'] = $cat['cat']['lastmodified']; if (isset($cat['children'])) { diff --git a/admin/themes/default/js/albums.js b/admin/themes/default/js/albums.js index feda7e7ab..2c8a6ae7a 100644 --- a/admin/themes/default/js/albums.js +++ b/admin/themes/default/js/albums.js @@ -74,7 +74,7 @@ $(document).ready(() => { cont.find(".move-cat-title").after( "
" +"" - +""+ node.nb_images +"" + +"" +""+ node.last_updates +"" +"
" ) @@ -84,6 +84,12 @@ $(document).ready(() => { } else { cont.find(".nb-subcats").hide(); } + + if (node.nb_images != 0) { + cont.find(".nb-images").text(node.nb_images); + } else { + cont.find(".nb-images").hide(); + } } var url_split = window.location.href.split("#"); diff --git a/admin/themes/default/template/albums.tpl b/admin/themes/default/template/albums.tpl index 0b4f9ff33..3b68deeda 100644 --- a/admin/themes/default/template/albums.tpl +++ b/admin/themes/default/template/albums.tpl @@ -448,7 +448,7 @@ input[name="position"] { .badge-container i { padding: 2px 6px 2px 4px!important; border-radius: 10px !important; - font-size: 10px !important; + font-size: 0.85em !important; margin: 0 2px !important; font-weight: 700; font-style: normal;