related to #1465 removed useless translations + added icon on ip and username hover + labels

This commit is contained in:
Matthieu Leproux 2021-09-20 11:00:16 +02:00 committed by plegall
parent 2db6c52f3d
commit 98c8269cdf
5 changed files with 65 additions and 34 deletions

View file

@ -109,11 +109,11 @@ function fillHistoryResult(ajaxParam) {
$(".loading").removeClass("hide");
// console.log(ajaxParam.user);
// console.log(raw_data);
data = raw_data.result[0];
imageDisplay = raw_data.result[1].display_thumbnail;
console.log("RESULTS");
maxPage = raw_data.result[2];
data = raw_data.result["lines"];
imageDisplay = raw_data.result["params"].display_thumbnail;
// console.log("RESULTS");
maxPage = raw_data.result["maxPage"];
console.log(data);
//clear lines before refill
$(".tab .search-line").remove();
@ -172,7 +172,7 @@ function lineConstructor(line, id, imageDisplay) {
newLine.find(".date-day").html(line.DATE);
newLine.find(".date-hour").html(line.TIME);
newLine.find(".user-name").html(line.USERNAME);
newLine.find(".user-name").html(line.USERNAME + '<i class="add-filter icon-plus-circled"></i>');
newLine.find(".user-name").attr("id", line.USERID);
if (current_param.user == "-1") {
@ -184,10 +184,11 @@ function lineConstructor(line, id, imageDisplay) {
})
}
newLine.find(".user-ip").html(line.IP);
newLine.find(".user-ip").html(line.IP + '<i class="add-filter icon-plus-circled"></i>');
newLine.find(".user-ip").data("ip", line.IP);
if (current_param.ip == "") {
newLine.find(".user-ip").on("click", function () {
current_param.ip = $(this).html();
current_param.ip = $(this).data("ip");
current_param.pageNumber = 0;
addIpFilter($(this).html());
fillHistoryResult(current_param);
@ -207,8 +208,17 @@ function lineConstructor(line, id, imageDisplay) {
switch (line.SECTION) {
case "tags":
if (line.TAGS.length > 1 && line.TAGS.length <= 2 ) {
newLine.find(".type-name").html(line.TAGS[0] +", "+ line.TAGS[1] + ", ...");
newLine.find(".type-id").html("#" + line.TAGIDS[0] +", "+ line.TAGIDS[1] + ", ...");
} else if (line.TAGS.length > 2) {
newLine.find(".type-name").html(line.TAGS[0] +", "+ line.TAGS[1] +", "+ line.TAGS[2] + ", ...");
newLine.find(".type-id").html("#" + line.TAGIDS[0] +", "+ line.TAGIDS[1] +", "+ line.TAGIDS[2] + ", ...");
} else {
newLine.find(".type-name").html(line.TAGS[0]);
newLine.find(".type-id").html("#" + line.TAGIDS[0]);
}
let detail_str = "";
line.TAGS.forEach(tag => {
detail_str += tag + ", ";
@ -234,6 +244,17 @@ function lineConstructor(line, id, imageDisplay) {
newLine.find(".type-name").html(str_favorites);
newLine.find(".type-id").remove();
break;
case "recent_cats":
newLine.find(".type-name").html(str_recent_cats);
newLine.find(".type-id").remove();
break;
case "recent_pics":
newLine.find(".type-name").html(str_recent_pics);
newLine.find(".type-id").remove();
break;
case "categories":
newLine.find(".type-name").html(line.CATEGORY);
newLine.find(".type-id").remove();
default:
break;

View file

@ -36,8 +36,10 @@ const API_METHOD = "{$API_METHOD}";
const str_dwld = "{'Downloaded'|translate}";
const str_most_visited = "{'Most visited'|translate}";
const str_best_rated = "{'Best rated'|translate}";
const str_list = "{'Random'|translate}";
const str_favorites = "{'Favorites'|translate}";
const str_list = "{'Random photo'|translate}";
const str_favorites = "{'Your favorites'|translate}";
const str_recent_cats = "{'Recent albums'|translate}";
const str_recent_pics = "{'Recent photos'|translate}";
{/footer_script}
{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
@ -82,7 +84,7 @@ const str_favorites = "{'Favorites'|translate}";
</div>
</div>
<div class="filter-tags">
<label> Personnalized filters</label>
<label>{'Personnalized filters'|translate}</label>
<div class="filter-container">
<div id="default-filter" class="filter-item hide">
<i class="filter-icon"> </i>
@ -139,8 +141,8 @@ const str_favorites = "{'Favorites'|translate}";
</div>
<div class="user-section">
<span class="user-name bold" title="{'Add a filter'}"> Zac le boss </span>
<span class="user-ip" title="{'Add a filter'}"> 192.168.0.0</span>
<span class="user-name bold" title="{'Add a filter'|translate}"> Zac le boss <i class="add-filter icon-plus-circled"></i></span>
<span class="user-ip" title="{'Add a filter'|translate}"> 192.168.0.0 <i class="add-filter icon-plus-circled"></i></span>
</div>
<div class="type-section">
@ -428,6 +430,20 @@ jQuery(document).ready( function() {
white-space: nowrap;
}
.add-filter {
display: none;
}
.user-name:hover .add-filter {
display: inline;
margin-left: 4px;
}
.user-ip:hover .add-filter {
display: inline;
margin-left: 4px;
}
.detail-item-1, .detail-item-2, .detail-item-3 {
background: #f0f0f0f0;
}

View file

@ -943,9 +943,8 @@ SELECT
? ( isset($name_of_category[$line['category_id']])
? $name_of_category[$line['category_id']]
: 'deleted'.$line['category_id'] )
: '';
: 'root';
}
/** */
array_push( $result,
array(
@ -966,18 +965,19 @@ SELECT
'TAGIDS' => explode(",",$tag_ids),
)
);
/** */
}
/**
* Pagination Time
*/
$max_page = ceil(count($result)/100);
$result = array_reverse($result, true);
$result = array_slice($result, $param['pageNumber']*100, 100);
return [$result, $param, $max_page];
/* Tableau associatif here cf ws_images_search*/
return array(
'lines' => $result,
'params' => $param,
'maxPage' => $max_page
);
// [$result, $param, $max_page];
}
?>

View file

@ -1262,7 +1262,4 @@ $lang['Tag name'] = 'Tag name';
$lang['Visited'] = 'Visited';
$lang['Downloaded'] = 'Downloaded';
$lang['Most visited'] = 'Most visited';
$lang['Best rated'] = 'Best rated';
$lang['Random'] = 'Random';
$lang['Favorites'] = 'Favorites';
$lang['Personnalized filters'] = 'Personnalized filters';

View file

@ -1264,7 +1264,4 @@ $lang['Tag name'] = 'Nom du tag';
$lang['Visited'] = 'Visité';
$lang['Downloaded'] = 'Téléchargé';
$lang['Most visited'] = 'Les plus visitées';
$lang['Best rated'] = 'Les mieux notées';
$lang['Random'] = 'Aléatoire';
$lang['Favorites'] = 'Favoris';
$lang['Personnalized filters'] = 'Filtres personnalisés';