Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
search-commons-webresources
Commits
45dab026
Commit
45dab026
authored
Jul 14, 2021
by
Gradl, Tobias
Browse files
438: Fix / reimplement 'show more' behavior (OPENED)
Task-Url:
search#438
parent
efab5dbc
Changes
2
Show whitespace changes
Inline
Side-by-side
js/search/search.queryHandler.js
View file @
45dab026
...
...
@@ -161,11 +161,12 @@ QueryHandler.prototype.removeSearchFacet = function(control) {
this
.
reorderFacets
();
};
QueryHandler
.
prototype
.
doSearch
=
function
(
isShowMore
,
initSearch
)
{
if
(
isShowMore
===
null
||
isShowMore
===
undefined
)
{
isShowMore
=
false
;
QueryHandler
.
prototype
.
doSearch
=
function
(
offset
,
initSearch
)
{
var
isShowMore
=
false
;
if
(
offset
!=
null
&&
offset
!=
undefined
&&
!
isNaN
(
offset
))
{
isShowMore
=
true
;
}
this
.
query
=
this
.
buildQuery
(
isShowMore
);
this
.
query
=
this
.
buildQuery
(
offset
);
this
.
imageQueue
=
[];
var
_this
=
this
;
...
...
@@ -173,7 +174,6 @@ QueryHandler.prototype.doSearch = function(isShowMore, initSearch) {
$
(
"
.wordcloud
"
).
text
(
""
);
this
.
clouds
=
[];
$
(
"
#search-loading-indicator
"
).
removeClass
(
"
fade
"
);
// Leave notifications in place for first execution of search
...
...
@@ -254,9 +254,10 @@ QueryHandler.prototype.removeAllFilters = function() {
this
.
doSearchDelayed
();
};
QueryHandler
.
prototype
.
buildQuery
=
function
(
isShowMore
)
{
QueryHandler
.
prototype
.
buildQuery
=
function
(
offset
)
{
var
query
=
{
entities
:
[],
start
:
(
offset
!=
null
&&
offset
!=
undefined
&&
!
isNaN
(
offset
))
?
parseInt
(
offset
)
:
null
,
filters
:
JSON
.
parse
(
$
(
"
#selected-filters
"
).
val
())
};
...
...
js/search/search.responseHandler.js
View file @
45dab026
...
...
@@ -45,9 +45,7 @@ ResponseHandler.prototype.process = function(resultArray, isShowMore) {
this
.
elements
.
resultsContainer
.
removeClass
(
"
hide
"
);
this
.
elements
.
placeholderWordcloud
.
addClass
(
"
hide
"
);
for
(
var
i
=
0
;
i
<
resultArray
.
length
;
i
++
)
{
var
data
=
resultArray
[
i
];
for
(
let
data
of
resultArray
)
{
if
(
data
.
resultType
==
"
REGULAR
"
)
{
this
.
processExecutedQueries
(
data
.
executedQueries
);
...
...
@@ -55,17 +53,15 @@ ResponseHandler.prototype.process = function(resultArray, isShowMore) {
this
.
processResponseDatasources
(
data
.
resultDatasources
);
this
.
processFilters
(
data
.
availableFilters
);
//
_
this.processResponseTerms();
//
_
this.processResponseSubjects();
//this.processResponseTerms();
//this.processResponseSubjects();
//
}
else
if
(
data
.
resultType
==
"
META
"
)
{
var
sourceIds
=
[];
for
(
var
j
=
0
;
j
<
data
.
resultDatasources
.
length
;
j
++
)
{
sourceIds
.
push
(
data
.
resultData
source
s
[
j
]
.
providerId
);
for
(
let
datasource
of
data
.
resultDatasources
)
{
sourceIds
.
push
(
datasource
.
providerId
);
}
search
.
metasearch
(
sourceIds
,
false
);
}
}
};
...
...
@@ -160,8 +156,6 @@ ResponseHandler.prototype.processResources = function(isShowMore, resultElements
}
let
query
=
search
.
queryHandler
.
buildQuery
(
false
);
this
.
elements
.
resourcesHeading
.
text
(
String
.
format
(
__translator
.
translate
(
"
~eu.dariah.de.minfba.search.view.result.n_of_m_results
"
),
resultElements
.
length
,
totalHits
));
var
indexOffset
=
this
.
elements
.
resourcesContainer
.
find
(
"
.search-results-item
"
).
length
;
for
(
var
i
=
0
;
i
<
resultElements
.
length
;
i
++
)
{
var
resultItem
=
$
(
"
<div class='search-results-item d-md-flex flex-row' style='display: none;'>
"
);
...
...
@@ -171,16 +165,18 @@ ResponseHandler.prototype.processResources = function(isShowMore, resultElements
resultItem
.
fadeIn
(
"
slow
"
);
}
this
.
elements
.
resourcesHeading
.
text
(
String
.
format
(
__translator
.
translate
(
"
~eu.dariah.de.minfba.search.view.result.n_of_m_results
"
),
$
(
"
.search-results-resource-item
"
).
length
,
totalHits
));
this
.
processImages
();
/*
if (hasMore) {
if
(
hasMore
)
{
this
.
elements
.
resourcesContainer
.
append
(
"
<div class='search-results-resources-show-more'>
"
+
"<button onclick='queryHandler.doSearch(
true
);' class='btn btn-default btn-lg'>" +
"
<button onclick='
search.
queryHandler.doSearch(
"
+
(
startIndex
+
resultElements
.
length
)
+
"
);' class='btn btn-default btn-lg'>
"
+
__translator
.
translate
(
"
~eu.dariah.de.minfba.search.view.result.show_more
"
)
+
"
</button>
"
+
"
</div>
"
);
}
*/
}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment