From f63e6a5c32c6c4984bb91c25716b81ccba655f8a Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Mon, 10 Oct 2022 15:46:26 +0200 Subject: [PATCH] related to #1743 better detail section with tiptip and icons and link to cat in gallery --- admin/themes/default/js/history.js | 20 ++++++++++++++++++-- admin/themes/default/template/history.tpl | 4 ++++ include/ws_functions/pwg.php | 13 +++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js index 0fd389291..414abcb8b 100644 --- a/admin/themes/default/js/history.js +++ b/admin/themes/default/js/history.js @@ -200,7 +200,7 @@ function fillHistoryResult(ajaxParam) { imageDisplay = raw_data.result["params"].display_thumbnail; maxPage = raw_data.result["maxPage"]; summary = raw_data.result["summary"]; - // console.log(raw_data); + console.log(raw_data); //clear lines before refill @@ -227,6 +227,12 @@ function fillHistoryResult(ajaxParam) { activateLineOptions(); $(".loading").addClass("hide"); updatePagination(maxPage); + $('.tiptip').tipTip({ + delay: 0, + fadeIn: 200, + fadeOut: 200, + edgeOffset: 3 + }); }) } @@ -332,47 +338,57 @@ function lineConstructor(line, id, imageDisplay) { detail_str += tag + ", "; }); detail_str = detail_str.slice(0, -2) + newLine.find(".detail-item-1").html(str_tags).addClass('icon-tags'); newLine.find(".detail-item-2").html(detail_str); newLine.find(".detail-item-2").attr("title", detail_str).removeClass("hide"); break; case "most_visited": newLine.find(".type-name").html(str_most_visited); + newLine.find(".detail-item-1").html(str_most_visited).addClass('icon-fire'); newLine.find(".type-id").hide(); break; case "best_rated": newLine.find(".type-name").html(str_best_rated); + newLine.find(".detail-item-1").html(str_best_rated).addClass("icon-star"); newLine.find(".type-id").hide(); break; case "list": newLine.find(".type-name").html(str_list); + newLine.find(".detail-item-1").html(str_list).addClass('icon-dice-solid'); newLine.find(".type-id").hide(); break; case "favorites": newLine.find(".type-name").html(str_favorites); + newLine.find(".detail-item-1").html(str_favorites).addClass('icon-heart'); newLine.find(".type-id").hide(); break; case "recent_cats": newLine.find(".type-name").html(str_recent_cats); + newLine.find(".detail-item-1").html(str_recent_cats).addClass('icon-clock'); newLine.find(".type-id").hide(); break; case "recent_pics": newLine.find(".type-name").html(str_recent_pics); + newLine.find(".detail-item-1").html(str_recent_pics).addClass('icon-clock'); newLine.find(".type-id").hide(); break; case "categories": newLine.find(".type-name").html(line.CATEGORY); + newLine.find(".detail-item-1").html(line.CATEGORY).addClass("icon-folder-open tiptip").attr("title", line.FULL_CATEGORY_PATH); if (line.IMAGE == "") { newLine.find(".type-id").hide(); } break; case "memories-1-year-ago": newLine.find(".type-name").html(str_memories); + newLine.find(".detail-item-1").html(str_memories).addClass('icon-clock'); newLine.find(".type-id").hide(); break; case "contact": newLine.find(".type-icon i").addClass("line-icon icon-mail-1 icon-yellow"); newLine.find(".type-name").html(str_contact_form); + newLine.find(".detail-item-1").html(str_contact_form); newLine.find(".type-id").hide(); break; default: @@ -399,7 +415,7 @@ function lineConstructor(line, id, imageDisplay) { } } - newLine.find(".detail-item-1").html(line.SECTION).removeClass("hide"); + newLine.find(".detail-item-1").removeClass("hide"); if (line.TYPE == "high") { newLine.find(".detail-item-1").html(str_dwld).addClass("icon-blue").removeClass("detail-item-1").removeClass("hide"); newLine.find(".date-dwld-icon").addClass("icon-blue icon-floppy") diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl index a6730faf7..2b46ec47c 100644 --- a/admin/themes/default/template/history.tpl +++ b/admin/themes/default/template/history.tpl @@ -42,6 +42,7 @@ const str_recent_cats = "{'Recent albums'|translate}"; const str_recent_pics = "{'Recent photos'|translate}"; const str_memories = "{'Memories'|translate}"; const str_no_longer_exist_photo = "{'This photo no longer exists'|@translate}"; +const str_tags = "{'Tags'|translate}"; const unit_MB = "{"%s MB"|@translate}"; const str_guest = '{'guest'|@translate}'; const str_contact_form = '{'Contact Form'|@translate}'; @@ -482,6 +483,9 @@ jQuery(document).ready( function() { white-space: nowrap; } +.detail-item::before { + margin: 0 5px 0 0px; +} .add-filter { display: none; diff --git a/include/ws_functions/pwg.php b/include/ws_functions/pwg.php index b78685f13..111620d95 100644 --- a/include/ws_functions/pwg.php +++ b/include/ws_functions/pwg.php @@ -822,13 +822,21 @@ SELECT id, uppercats ;'; $uppercats_of = query2array($query, 'id', 'uppercats'); + $full_cat_path = array(); $name_of_category = array(); foreach ($uppercats_of as $category_id => $uppercats) { + $full_cat_path[$category_id] = get_cat_display_name_cache( + $uppercats, + 'admin.php?page=album-', + ); + + $uppercats = explode(",", $uppercats); $name_of_category[$category_id] = get_cat_display_name_cache( - $uppercats - ); + end($uppercats), + 'admin.php?page=album-', + ); } } @@ -993,6 +1001,7 @@ SELECT 'EDIT_IMAGE' => $image_edit_string, 'TYPE' => $line['image_type'], 'SECTION' => $line['section'], + 'FULL_CATEGORY_PATH' => isset($full_cat_path[$line['category_id']]) ? strip_tags($full_cat_path[$line['category_id']]) : l10n('Root').$line['category_id'], 'CATEGORY' => isset($name_of_category[$line['category_id']]) ? $name_of_category[$line['category_id']] : l10n('Root').$line['category_id'], 'TAGS' => explode(",",$tag_names), 'TAGIDS' => explode(",",$tag_ids),