Commit ad566a71 authored by Alexandre Goldstein's avatar Alexandre Goldstein
Browse files

add total count to folder view

parent 13238990
Pipeline #8824 failed with stage
......@@ -612,8 +612,8 @@ msgstr "archive(s) sélectionnée(s)"
msgid "Result"
msgstr "Résultat"
msgid "result(s) on"
msgstr "résultat(s) sur"
msgid "archive(s) on"
msgstr "archives(s) sur"
msgid "Select all"
msgstr "Tous"
......
......@@ -9,7 +9,7 @@
</ol>
</div>
<div id="folderContents" class="folderContents hide">
<div id="fodlerToolbar" class="row">
<div id="folderToolbar" class="row">
<h4 class="pull-left col-md-4 lockedFolder hide">
<i class="text-danger fa fa-lock" style="font-size: 30px"/>
</h4>
......@@ -196,6 +196,7 @@
folderId : null,
pathList : [],
showArchivePath: false,
totalArchives: null,
getfolderContents: function(orgRegNumber, folderId, archivalProfiles, locked, acceptArchivesWithoutProfiles, pathList) {
this.orgRegNumber = orgRegNumber;
......@@ -226,7 +227,7 @@
type : "GET",
dataType : 'json',
success : function (response) {
ArchiveFolderList.buildResultList(response.archives);
ArchiveFolderList.buildResultList(response.archives, null, false, response.countWithoutLimit);
if (locked) {
ArchiveFolderList.folderPanel.find('.addChildrenArchive').remove();
}
......@@ -255,7 +256,7 @@
$("#folderToolbarSearch").data("orgregnumber", orgRegNumber).data("folderid", folderId);
},
buildResultList: function(archives, options, showArchivePath) {
buildResultList: function(archives, options, showArchivePath, totalResult) {
// to inititate default value and avoid bug on IE 11
if (options === undefined) {
options = null;
......@@ -281,6 +282,7 @@
defaultOptions = {
datas: archives,
total: totalResult,
rowMerge: ArchiveFolderList.mergeRow,
rowMaxNumber: 10,
rowTranslation: $('#rows_text').text(),
......
......@@ -6,9 +6,9 @@
<div class="panel-heading clearfix">
<div class="pull-left">
<?merge hasReachMaxResults.not() ?>
<h4><?merge archive.count() ?> result(s)</h4>
<h4><?merge archive.count() ?> archive(s)</h4>
<?merge hasReachMaxResults ?>
<h4><?merge archive.count() ?> result(s) on <?merge totalResultsWithoutLimit ?> archive(s)</h4>
<h4><?merge archive.count() ?> archive(s) on <?merge totalResultsWithoutLimit ?> result(s)</h4>
</div>
<div class="dropdown pull-right">
<button class="btn btn-warning dropdown-toggle" type="button" id="archiveList_actions" data-toggle="dropdown" aria-expanded="true" title="Actions" disabled="disabled">
......
/* OPTIONS
datas -> json datas to merge,
total -> nombre de résultat total,
rowMerge -> datas merging function,
rowMaxNumber -> default rowNumber,
rowTranslation -> translation for "row"
......@@ -57,7 +58,8 @@ var DataList = {
'<\/div>',
selectAllHTML :'<h4 class="pull-left" style="width:15px"><i class="selectAll multipleSelection fa fa-square-o" style="cursor:pointer"\/><\/h4>',
selectorHTML :'<h4 class="pull-left" style="width:15px"><i class="multipleSelection fa fa-square-o" style="cursor:pointer"\/><\/h4>',
resultNumberHTML:"<h2 class='itemNumber' style='margin:0px 0px 0px 40px'><small><span class='resultNumber' \/><span class='itemsName'\/><\/small><\/h2>",
resultNumberHTML:'<h2 class="itemNumber" style="margin:0px 0px 0px 40px"><small><span class="resultNumber"\/><span class="itemsName"\/><\/small><\/h2>',
totalNumberHTML :'<h2 class="itemNumber" style="margin:-40px 0px 0px 160px"><small>/&nbsp(<span class="totalNumber"\/><span/>&nbsptotal)<\/small><\/h2>',
init: function(options, element) {
var id = Math.round(new Date().getTime() + (Math.random() * 100));
......@@ -118,6 +120,9 @@ var DataList = {
header.append(this.resultNumberHTML);
this.dataList[id].totalNumber = "<h4><span class='totalNumber'\/><\/h4>";
header.append(this.totalNumberHTML);
if (options.translation) {
$.each(options.translation, function(key, value) {
header.find('[title='+key+']').attr('title', value);
......@@ -198,6 +203,7 @@ var DataList = {
paginationType : options.paginationType,
unsearchable : options.unsearchable,
itemsName : options.itemsName,
total : options.total,
element : this.dataList[id].element,
list : this.dataList[id].list,
toolbar : this.dataList[id].toolbar,
......@@ -217,6 +223,8 @@ var DataList = {
} else {
this.buildList(id);
}
console.log("in build, result total =");
console.log(this.dataList[id].total);
},
buildPaginationButtons: function(id, filteredDatas) {
......@@ -302,8 +310,9 @@ var DataList = {
},
buildList: function(id, range, filteredDatas) {
var totalResult = this.dataList[id].total;
var datas = this.dataList[id].datas;
if(filteredDatas != undefined){
datas = filteredDatas;
} else {
......@@ -351,8 +360,10 @@ var DataList = {
this.dataList[id].list.append(datas[i].html.data('index', i));
}
// Set the result number
// Set the search result displayed (maxResult in conf)
this.dataList[id].toolbar.find('.itemNumber .resultNumber').html(datas.length);
// Set the total result number
this.dataList[id].toolbar.find('.itemNumber .totalNumber').html(totalResult);
this.dataList[id].element.find('.selectAll').removeClass('fa-check-square-o').addClass('fa-square-o');
this.dataList[id].element.find('.multipleSelection').not('.selectAll').on('click', DataList.bind_selection);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment