<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%
MBCategoryDisplay categoryDisplay = new MBCategoryDisplay(scopeGroupId, categoryId);
%>

<liferay-ui:search-container
	searchContainer="<%= categoryEntriesSearchContainer %>"
>
	<liferay-ui:search-container-row
		className="com.liferay.message.boards.model.MBCategory"
		escapedModel="<%= true %>"
		keyProperty="categoryId"
		modelVar="curCategory"
	>

		<%
		row.setPrimaryKey(String.valueOf(curCategory.getCategoryId()));
		%>

		<liferay-portlet:renderURL varImpl="rowURL">
			<portlet:param name="mvcRenderCommandName" value="/message_boards/view_category" />
			<portlet:param name="mbCategoryId" value="<%= String.valueOf(curCategory.getCategoryId()) %>" />
		</liferay-portlet:renderURL>

		<liferay-ui:search-container-column-icon
			icon="folder"
			toggleRowChecker="<%= true %>"
		/>

		<liferay-ui:search-container-column-text
			colspan="<%= 2 %>"
		>
			<h4>
				<aui:a href="<%= rowURL.toString() %>">
					<%= curCategory.getName() %>
				</aui:a>

				<c:if test='<%= Objects.equals(curCategory.getDisplayStyle(), "question") %>'>
					<aui:icon cssClass="icon-monospaced" image="question-circle" markupView="lexicon" message="question" />
				</c:if>
			</h4>

			<h5 class="text-default">
				<%= curCategory.getDescription() %>
			</h5>

			<%
			int subcategoriesCount = categoryDisplay.getSubcategoriesCount(curCategory);
			int threadsCount = categoryDisplay.getSubcategoriesThreadsCount(curCategory);
			%>

			<span class="h6 mt-2 text-default">
				<liferay-ui:message arguments="<%= subcategoriesCount %>" key='<%= (subcategoriesCount == 1) ? "x-category" : "x-categories" %>' />
			</span>
			<span class="h6 text-default">
				<liferay-ui:message arguments="<%= threadsCount %>" key='<%= (threadsCount == 1) ? "x-thread" : "x-threads" %>' />
			</span>
		</liferay-ui:search-container-column-text>

		<liferay-ui:search-container-column-jsp
			path="/message_boards/category_action.jsp"
		/>
	</liferay-ui:search-container-row>

	<liferay-ui:search-iterator
		displayStyle="descriptive"
		markupView="lexicon"
		resultRowSplitter="<%= new MBResultRowSplitter() %>"
	/>
</liferay-ui:search-container>