spec/layout/filter_link.cfm
2025-06-02 16:16:51 +03:00

24 lines
1.4 KiB
Plaintext

<!--- It is strongly recommended to keep this tag closed. Unclosed tag generates output into the variable ATTRIBUTES.output only, which may be confusing --->
<!---v0.2 10:07 02.01.2019 - skipped url params--->
<cfif thisTag.executionMode IS "end" OR NOT thisTag.hasEndTag>
<cfparam name="ATTRIBUTES.filterUrl" type="string" default=""/>
<cfparam name="ATTRIBUTES.filter" type="struct" default=#structNew()#/>
<cfparam name="ATTRIBUTES.fwx" type="string" default=""/>
<cfset qString="#ATTRIBUTES.fwx#"/>
<!---Чтобы передавать параметры в URL (и не пользоваться сессией), надо правильно форматировать параметры всех типов--->
<!--- <cfloop collection=#ATTRIBUTES.filter# item="item">
<cftry>
<cfset fltr=structFind(ATTRIBUTES.filter,item)/>
<cfset qString=listAppend(qString, "#item#=#fltr.val#", "&")/>
<cfcatch type="ANY"></cfcatch>
</cftry>
</cfloop>--->
<cfset filterOn=request.filterOn(ATTRIBUTES.filter)/>
<!--- actually, any non-empty string can be assigned to reset_filter --->
<cfoutput><a href="#ATTRIBUTES.filterUrl#?#qString#"><cfif filterOn><b>#request.i18("Фильтр...","Filter")#</b><cfelse>#request.i18("Фильтр","Filter")#</cfif></b></a>
<cfif filterOn><a href="#request.thisPage#?reset_filter=yes">(#request.i18("снять","reset")#)</a></cfif></cfoutput>
</cfif>