lorna
12 years agoMaven
Using @component within an endpoint
We want a component (that is visible only to our admins) and shows the most active threads in that node. That part is fine. The next requirement is to be able to change the time range ...
So I have a component that by default displays 24h and has a dropdown selection to pick 1y, 1M or 1w. I'm using an endpoint for that with the node & time as url parameters.
It works ... except I made it easy and used <@component> to build it (see below). The links for the results is then wrong:
/*mycommunity*/forums/forumtopicpage/board-id/*boardid*/message-id/2
instead of
/t5/*boardname*/*subject*/m-p/421
Can I use @component within an endpoint? If so, how?
<#assign time_range = http.request.parameters.name.get("time_range","")?string /> <#assign category = http.request.parameters.name.get("category","")?string /> <#assign result_list_size = 5 /> <#assign rest_query = "/categories/id/"+category+"/search/messages?q=is_root:true&sort_by=-replies&rangeTime="+time_range+"&restapi.response_style=view&restapi.format_detail=full_list_element&include_forums=true&size=" + result_list_size /> <div id="new-activity"><@component id="forums.widget.message-list-panel" title="Most Active Threads" messages="rest_v1:"+rest_query style="slim" numMessages="conv:"+result_list_size /></div>
Thank you!