Forum Discussion

jmurray's avatar
jmurray
Champion
12 years ago

getting a module to disappear itself when it's empty

I have a piece of custom content that serves as an unsolved threads module.  Works great except that once everything's solved, it's an ugly, empty, useless box.   I am trying to figure out how to c...
  • DougS's avatar
    DougS
    12 years ago

    It looks like you are relying on the "forums.widget.message-list-panel" component to do the actual REST query, and you want to determine before rendering that component whether or not to display it.  You could use the same query, but with a /count at the end of the path, to determine if there will be any results -- something like this:

     

    <#assign rest_count_query = "/boards/id/ent5/search/messages/count?openresponse=true&sort_by=-topicPostDate&include_forums=true&page_size=" + results_list_size/>
    
    <#assign rest_count = rest(rest_count_query).value />
    <#if rest_count?number gt 0>
      <#-- call the forums.widget.message-list-panel component -->
    </#if>

     

  • KaelaC's avatar
    KaelaC
    12 years ago
    There is ?solved=true but that will only return you solved threads. It is a filter on all messages. Unfortunately, that means that ?solved=false doesn't get you all unsolved threads. It just gets you all threads (same as what you have without anything in the query string). I would add an idea to have either ?solved=false return unsolved threads or a new filter ?unsolved=true.