Skip to content

Commit c6cbc04

Browse files
committed
prevent hidden filter values from being displayed
1 parent 7c7bf91 commit c6cbc04

File tree

1 file changed

+47
-43
lines changed

1 file changed

+47
-43
lines changed

webapp/src/main/webapp/templates/freemarker/body/menupage/browseSearchFilterValues.ftl

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,52 @@
6868
<#assign selectedValue = "" >
6969
<#assign valueNumber = 1>
7070
<#list f.values?values as value>
71+
<#if user.loggedIn || value.publiclyAvailable>
72+
<#if value.selected>
73+
<#assign selectedValue = value.id >
74+
</#if>
75+
<#assign valueLabel = value.name >
76+
<#if !(valueLabel?has_content)>
77+
<#assign valueLabel = value.id >
78+
</#if>
79+
<#if value.selected>
80+
<li id="${value.id?html}" class="li-selected">
81+
<a href="#" class="selected">
82+
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
83+
<@sl.getSelectedLabel sl.getValueID(filter.id, valueNumber)?html value f getCurrentCount(f value) />
84+
</a>
85+
</li>
86+
<#else>
87+
<li id="${value.id?html}">
88+
<a href="#">
89+
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
90+
<@sl.getLabel sl.getValueID(f.id, valueNumber) value f getCurrentCount(f value) />
91+
</a>
92+
</li>
93+
</#if>
94+
<#assign valueNumber = valueNumber + 1>
95+
</#if>
96+
</#list>
97+
</#macro>
98+
99+
<#function getCurrentCount f v>
100+
<#if filters[f.id]??>
101+
<#assign filter = filters[f.id]>
102+
<#if filter.values[v.id]??>
103+
<#return filter.values[v.id].count >
104+
<#else>
105+
<#return 0 />
106+
</#if>
107+
<#else>
108+
<#return 0 />
109+
</#if>
110+
</#function>
111+
112+
<#macro filterFacets f>
113+
<#assign selectedValue = "" >
114+
<#assign valueNumber = 1>
115+
<#list f.values?values as value>
116+
<#if user.loggedIn || value.publiclyAvailable>
71117
<#if value.selected>
72118
<#assign selectedValue = value.id >
73119
</#if>
@@ -79,7 +125,7 @@
79125
<li id="${value.id?html}" class="li-selected">
80126
<a href="#" class="selected">
81127
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
82-
<@sl.getSelectedLabel sl.getValueID(filter.id, valueNumber)?html value f getCurrentCount(f value) />
128+
<@sl.getSelectedLabel sl.getValueID(f.id, valueNumber)?html value f getCurrentCount(f value) />
83129
</a>
84130
</li>
85131
<#else>
@@ -91,49 +137,7 @@
91137
</li>
92138
</#if>
93139
<#assign valueNumber = valueNumber + 1>
94-
</#list>
95-
</#macro>
96-
97-
<#function getCurrentCount f v>
98-
<#if filters[f.id]??>
99-
<#assign filter = filters[f.id]>
100-
<#if filter.values[v.id]??>
101-
<#return filter.values[v.id].count >
102-
<#else>
103-
<#return 0 />
104-
</#if>
105-
<#else>
106-
<#return 0 />
107-
</#if>
108-
</#function>
109-
110-
<#macro filterFacets f>
111-
<#assign selectedValue = "" >
112-
<#assign valueNumber = 1>
113-
<#list f.values?values as value>
114-
<#if value.selected>
115-
<#assign selectedValue = value.id >
116-
</#if>
117-
<#assign valueLabel = value.name >
118-
<#if !(valueLabel?has_content)>
119-
<#assign valueLabel = value.id >
120-
</#if>
121-
<#if value.selected>
122-
<li id="${value.id?html}" class="li-selected">
123-
<a href="#" class="selected">
124-
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
125-
<@sl.getSelectedLabel sl.getValueID(f.id, valueNumber)?html value f getCurrentCount(f value) />
126-
</a>
127-
</li>
128-
<#else>
129-
<li id="${value.id?html}">
130-
<a href="#">
131-
<@sl.getInput f value sl.getValueID(f.id, valueNumber) valueNumber 'filter-form' />
132-
<@sl.getLabel sl.getValueID(f.id, valueNumber) value f getCurrentCount(f value) />
133-
</a>
134-
</li>
135140
</#if>
136-
<#assign valueNumber = valueNumber + 1>
137141
</#list>
138142
</#macro>
139143

0 commit comments

Comments
 (0)