Skip to content

Commit

Permalink
get real filter value counts
Browse files Browse the repository at this point in the history
  • Loading branch information
litvinovg committed Oct 23, 2024
1 parent 6559e3d commit 7c7bf91
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,34 @@
<li id="${value.id?html}" class="li-selected">
<a href="#" class="selected">
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
<@sl.getSelectedLabel sl.getValueID(filter.id, valueNumber)?html value f />
<@sl.getSelectedLabel sl.getValueID(filter.id, valueNumber)?html value f getCurrentCount(f value) />
</a>
</li>
<#else>
<li id="${value.id?html}">
<a href="#">
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
<@sl.getLabel sl.getValueID(f.id, valueNumber) value f />
<@sl.getLabel sl.getValueID(f.id, valueNumber) value f getCurrentCount(f value) />
</a>
</li>
</#if>
<#assign valueNumber = valueNumber + 1>
</#list>
</#macro>

<#function getCurrentCount f v>
<#if filters[f.id]??>
<#assign filter = filters[f.id]>
<#if filter.values[v.id]??>
<#return filter.values[v.id].count >
<#else>
<#return 0 />
</#if>
<#else>
<#return 0 />
</#if>
</#function>

<#macro filterFacets f>
<#assign selectedValue = "" >
<#assign valueNumber = 1>
Expand All @@ -109,14 +122,14 @@
<li id="${value.id?html}" class="li-selected">
<a href="#" class="selected">
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
<@sl.getSelectedLabel sl.getValueID(f.id, valueNumber)?html value f />
<@sl.getSelectedLabel sl.getValueID(f.id, valueNumber)?html value f getCurrentCount(f value) />
</a>
</li>
<#else>
<li id="${value.id?html}">
<a href="#">
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
<@sl.getLabel sl.getValueID(f.id, valueNumber) value f />
<@sl.getLabel sl.getValueID(f.id, valueNumber) value f getCurrentCount(f value) />
</a>
</li>
</#if>
Expand All @@ -130,8 +143,8 @@
<#else>
<#assign indexFilterName = "raw_label_regex">
</#if>
<#if filters[indexFilterName]??>
<#assign indexFilter = filters[indexFilterName]>
<#if filterGenericInfo.filters[indexFilterName]??>
<#assign indexFilter = filterGenericInfo.filters[indexFilterName]>
<nav id="alpha-browse-container" role="navigation">
<ul id="alpha-browse-individuals">
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<#if v.selected>
<@getInput filter v getValueID(filter.id, valueNumber) valueNumber />
<#if user.loggedIn || filter.public>
<@getSelectedLabel getValueID(filter.id, valueNumber)?html v filter />
<@getSelectedLabel getValueID(filter.id, valueNumber)?html v filter v.count />
</#if>
</#if>
<#assign valueNumber = valueNumber + 1>
Expand Down Expand Up @@ -187,7 +187,7 @@
</#if>
<#if user.loggedIn || v.publiclyAvailable>
<@getInput filter v getValueID(filter.id, valueNumber) valueNumber />
<@getLabel getValueID(filter.id, valueNumber)?html v filter additionalLabels />
<@getLabel getValueID(filter.id, valueNumber)?html v filter additionalLabels v.count />
</#if>
</#if>
<#assign valueNumber = valueNumber + 1>
Expand Down Expand Up @@ -226,15 +226,15 @@
</#macro>


<#macro getSelectedLabel valueId value filter >
<#macro getSelectedLabel valueId value filter count >
<#assign label = filter.name + " : " + value.name >
<#if !filter.localizationRequired>
<#assign label = filter.name + " : " + value.id >
</#if>
<label for="${valueId}">${getValueLabel(label, value.count)?html}</label>
<label for="${valueId}">${getValueLabel(label, count)?html}</label>
</#macro>

<#macro getLabel valueId value filter additional=false >
<#macro getLabel valueId value filter count additional=false >
<#assign label = value.name >
<#assign additionalClass = "" >
<#if !filter.localizationRequired>
Expand All @@ -243,7 +243,7 @@
<#if additional=true>
<#assign additionalClass = "additional-search-options hidden-search-option" >
</#if>
<label class="${additionalClass}" for="${valueId}" >${getValueLabel(label, value.count)?html}</label>
<label class="${additionalClass}" for="${valueId}" >${getValueLabel(label, count)?html}</label>
</#macro>

<#macro userSelectedInput filter>
Expand Down

0 comments on commit 7c7bf91

Please sign in to comment.