bnlucas
10 years agoAdept
Accessing messages.message.labels.label
I'm trying to access the label text for recent topics, and I can't for the life of me figure this out.
<#macro tabbed title tab call sort_by="" count=10 checked=false>
<#if sort_by??>
<#assign messages = rest("${call}?page_size=${count}&sort_by=${sort_by}").messages />
<#else>
<#assign messages = rest("${call}?page_size=${count}").messages />
</#if>
<#list messages.message as message>
<#assign views = message.views.count />
<#assign kudos = message.kudos.count />
<#assign replies = 0 />
<li>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="80%" rowspan="2"><div>${message.subject}</div></td>
<td width="10%">Views</td>
<td width="10%" class="cc-tab-item-count">${views}</td>
</tr>
<tr>
<td width="80%" rowspan="2"><div>${message.labels.label}</div></td>
<td width="10%">Kudos</td>
<td width="10%" class="cc-tab-item-count">${kudos}</td>
</tr>
<tr>
<td width="10%">Replies</td>
<td width="10%" class="cc-tab-item-count">${replies}</td>
</tr>
</tbody>
</table>
</li>
</#list>
</#macro>Everything is working but the labels. I have tried the following, thinking it was in a list, but I'm still not getting anything.
<#assign messages = rest("/topics/recent?page_size=1").messages />
<#list messages.message as message>
<#list message.labels as label>
${label.text}
</#list>
</#list>Is there something that I'm missing? I can access message.views.count and message.kudos.count, but that's it...
Try
<#list message.labels.label as label> ${label.text} </#list>