Forum Discussion
I would like the first scenario you describe.
To have the component pull in content from the board in which it's shown, you can use the "coreNode" custom context object to determine the id of the board.
The exact method you'll want is "id". You can then plug this into the URL for your REST API request using freemarker:
${coreNode.id}
After you've got the code all set of the component, you'll then want to place it on the forums. You can do this via the "Forum Page" page in Studio.
- jmurray13 years agoChampionThis thread has been immensely helpful.
If I wanted to throw this component into a side rail, how would I go about displaying only the topic name instead of having kudos, author, and date in there along with it? - AdamN13 years agoKhoros Oracle
The component has a parameter named "style" which is set to "wide". You can change the value to "slim" to condense things down a bit. That sample code is actually at the bottom of Doug's post. Here it is again for easy reference:
<#assign message_list_title = text.format("custom.top_five_threads_with_no_replies.title") /> <#assign results_list_size = 5 /> <#assign rest_query = "/search/messages?openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size /> <div class="lia-panel lia-panel-standard top-five-threads-with-no-replies-wrapper"> <@component id="forums.widget.message-list-panel" title="${message_list_title}" messages="rest_v1:"+rest_query style="slim" numMessages="conv:"+results_list_size /> </div>
- jmurray13 years agoChampionDoh, I missed it. Thanks
- Agata13 years agoMentor
Hi,
how should the code be modified to exclude one board? I would like to used the first version that shows top 5 threads with no reply for all the boards except one board. Is this possible?
Thanks,
Agata
- Claudius13 years agoBoss
Here's the latest iteration. This widget only shows topics without replies in the current board/category focus:
<#assign message_list_title = text.format("custom.top_five_threads_with_no_replies.title") /> <#assign results_list_size = 5 /> <#assign coreNodeType = coreNode.nodeType /> <#if coreNodeType == "board"> <#assign rest_query = "/boards/id/${coreNode.id}/search/messages?openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size /> <#elseif coreNodeType == "category"> <#assign rest_query = "/categories/id/${coreNode.id}/search/messages?openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size /> </#if> <div class="lia-panel lia-panel-standard top-five-threads-with-no-replies-wrapper"> <@component id="forums.widget.message-list-panel" title="${message_list_title}" messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size /> </div>
- aguycalledadam12 years agoContributor
Thanks everyone, great thread.
I dont seem to be able to get this last set of code to work though.
Keep getting this:
"Expression rest_query is undefined on line 10, column 109 in preview. The problematic instruction: ---------- ==> user-directive component [on line 10, column 9 in preview]"
I am trying to put an Unanswered threads widget in the sidebar which is board specific.
Thanks for any and all help - AdamN12 years agoKhoros Oracle
Do you get that error when you're previewing the component, or when you place it on the page? Based on the error message, it sounds like maybe that error is showing when you preview the component in Studio? If so, it's probably because the component doesn't have the proper context to operate properly. It could probably be changed to be more sensitive to those types of issues and avoid displaying an error, but if you try the component out on a board or category page, you may have better luck than in the preview.
- santosh_csc8 years agoGuideHow can I pass v2 query to this?
My query is select * from messages where conversation.solved=false and depth=0 and board.id in ('Developer-Discussion')
Related Content
- 4 years ago
- 10 months ago
- 13 years agoInactive User
- 3 years ago