Skip to content

Commit

Permalink
add and set hideEmpty attr for DateHistogramSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
amdomanska committed Apr 6, 2023
1 parent dd2a40a commit 11e3ff6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions portality/static/js/doaj.fieldrender.edges.js
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,7 @@ $.extend(true, doaj, {

// whether to hide or just disable the facet if not active
this.hideInactive = edges.getParam(params.hideInactive, false);
this.hideEmpty = edges.getParam(params.hideEmpty, false)

// whether the facet should be open or closed
// can be initialised and is then used to track internal state
Expand Down Expand Up @@ -1987,6 +1988,9 @@ $.extend(true, doaj, {
// render each value, if it is not also a filter that has been set
for (var i = 0; i < ts.values.length; i++) {
var val = ts.values[i];
if (val.count === 0 && this.hideEmpty) {
continue
}
if ($.inArray(val.display, filterTerms) === -1) {

var ltData = "";
Expand Down
7 changes: 4 additions & 3 deletions portality/static/js/edges/public.article.edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ $.extend(true, doaj, {
return values;
},
renderer : doaj.renderers.newDateHistogramSelectorRenderer({
open: false,
open: true,
togglable: true,
countFormat: countFormat,
hideInactive: false
hideInactive: false,
hideEmpty: true
})
}),

Expand All @@ -131,7 +132,7 @@ $.extend(true, doaj, {
showCount: true,
hideEmpty: false,
open: false,
togglable: true
togglable: true,
})
}),

Expand Down
2 changes: 1 addition & 1 deletion portality/static/js/edges/public.journal.edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ $.extend(true, doaj, {
open: false,
togglable: true,
countFormat: countFormat,
hideInactive: false
hideInactive: true
})
}),

Expand Down

0 comments on commit 11e3ff6

Please sign in to comment.