diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js
index d1fdc2ed8..ab096e508 100644
--- a/admin/themes/default/js/history.js
+++ b/admin/themes/default/js/history.js
@@ -368,13 +368,112 @@ function lineConstructor(line, id, imageDisplay) {
newLine.find(".type-id").hide();
break;
case "search":
+ // for debug
+ // console.log('search n° : ', line.SEARCH_ID, ' ', line.SEARCH_DETAILS);
+ const search_details = line.SEARCH_DETAILS;
+ const search_icons = {
+ 'allwords': 'gallery-icon-search',
+ 'tags': 'gallery-icon-tag',
+ 'date_posted': 'gallery-icon-calendar-plus',
+ 'cat': 'gallery-icon-album',
+ 'author': 'gallery-icon-user-edit',
+ 'added_by': 'gallery-icon-user',
+ 'filetypes': 'gallery-icon-file-image',
+ }
newLine.find(".type-name").html(line.SECTION);
newLine.find(".type-id").html("#" + line.SEARCH_ID);
if (!line.SEARCH_ID)
{
newLine.find(".type-id").hide();
}
- newLine.find(".detail-item-1").hide();
+
+ if (!search_details)
+ {
+ newLine.find(".detail-item-1").hide();
+ break;
+ }
+ let active_search_details = {};
+ Object.keys(search_details).forEach(key => {
+ if (search_details[key] !== null) {
+ active_search_details[key] = search_details[key];
+ }
+ });
+ let count_item = 1;
+ const active_items = Object.keys(active_search_details);
+ if (active_items.length > 0)
+ {
+ if (active_search_details.allwords)
+ {
+ newLine.find(".detail-item-" + count_item).html(active_search_details.allwords.join(' ')).addClass(search_icons.allwords + ' tiptip');
+ newLine.find(".detail-item-" + count_item).attr('title', '' + str_search_details['allwords'] + ' : ' + active_search_details.allwords.join(' '));
+ count_item++;
+ }
+ if (active_search_details.cat)
+ {
+ const array_cat = Object.values(active_search_details.cat);
+ newLine.find(".detail-item-" + count_item).html(array_cat.join(' + ')).addClass(search_icons.cat + ' tiptip');
+ newLine.find(".detail-item-"+ count_item).attr('title','' + str_search_details['cat'] + ' : ' + array_cat.join(' + ')).removeClass("hide");
+ count_item++;
+ }
+ if (count_item <= 2 && active_search_details.tags)
+ {
+ const array_tags = Object.values(active_search_details.tags);
+ newLine.find(".detail-item-" + count_item).html(array_tags.join(' + ')).addClass(search_icons.tags + ' tiptip');
+ newLine.find(".detail-item-"+ count_item).attr('title', '' + str_search_details['tags'] + ' : ' + array_tags.join(' + ')).removeClass("hide");
+ count_item++;
+ }
+ if (count_item <= 2)
+ {
+ let badge_to_add = active_items.length == 1 ? 1 : count_item == 1 ? 2 : 1;
+ let badge_added = 0;
+ active_items.some(key => {
+ if (key !== 'allwords' && key !== 'cat' && key !== 'tags') {
+ let array_key;
+ if (Array.isArray(active_search_details[key]))
+ {
+ array_key = active_search_details[key];
+ }
+ else if (typeof active_search_details[key] === 'object')
+ {
+ array_key = Object.values(active_search_details[key]);
+ }
+ else
+ {
+ array_key = [active_search_details[key]];
+ }
+ newLine.find(".detail-item-" + count_item).html(array_key.join(' + ')).addClass(search_icons[key] + ' tiptip');
+ newLine.find(".detail-item-" + count_item).attr('title', '' + str_search_details[key] + ' : ' + array_key.join(' + ')).removeClass("hide");
+ count_item++;
+ badge_added++;
+ if (badge_added === badge_to_add) {
+ return true;
+ }
+ }
+ return false;
+ });
+ }
+ }
+ else
+ {
+ newLine.find(".detail-item-1").hide();
+ }
+ if (active_items.length >= 3)
+ {
+ let search_details_str = Object.entries(active_search_details)
+ .map(([key, value]) => {
+ let value_str;
+ if(Array.isArray(value)) {
+ value_str = value.join(' + ');
+ } else if (typeof value === 'object') {
+ value_str = Object.entries(value).map(([k, v]) => v).join(' + ');
+ } else {
+ value_str = value;
+ }
+ return `${str_search_details[key]}: ${value_str}`;
+ }).join('
');
+ newLine.find(".detail-item-3").html('See details').addClass('icon-info-circled-1 tiptip');
+ newLine.find(".detail-item-3").attr('title', search_details_str).removeClass('hide');
+ }
break;
case "favorites":
newLine.find(".type-name").html(str_favorites);
diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl
index 2e457f209..0d32e97f2 100644
--- a/admin/themes/default/template/history.tpl
+++ b/admin/themes/default/template/history.tpl
@@ -50,6 +50,16 @@ const str_guest = '{'guest'|@translate}';
const str_contact_form = '{'Contact Form'|@translate}';
const str_edit_img = '{'Edit photo'|@translate}';
+const str_search_details = {
+ "allwords": "{'Search for words'|@translate}",
+ "date_posted": "{'Post date'|@translate}",
+ "tags": str_tags,
+ "cat": "{'Album'|@translate}",
+ "author": "{'Author'|@translate}",
+ "added_by": "{'Added by'|@translate}",
+ "filetypes": "{'File type'|@translate}",
+};
+
const guest_id = {$guest_id};
{/footer_script}
@@ -58,6 +68,7 @@ const guest_id = {$guest_id};
{combine_script id='jquery.confirm' load='footer' require='jquery' path='themes/default/js/plugins/jquery-confirm.min.js'}
{combine_css path="admin/themes/default/fontello/css/animation.css" order=10} {* order 10 is required, see issue 1080 *}
+{combine_css path="themes/default/vendor/fontello/css/gallery-icon.css" order=-10}