<%--
/**
 * 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.
 *
 *
 *
 */
--%>

<%@ include file="/init.jsp" %>

<%
AssetEntry assetEntry = (AssetEntry)request.getAttribute("view.jsp-assetEntry");
AssetRenderer<?> assetRenderer = (AssetRenderer<?>)request.getAttribute("view.jsp-assetRenderer");
String fullContentRedirect = (String)request.getAttribute("view.jsp-fullContentRedirect");

AssetEntryActionDropdownItemsProvider assetEntryActionDropdownItemsProvider = new AssetEntryActionDropdownItemsProvider(assetRenderer, assetPublisherDisplayContext.getAssetEntryActions(assetEntry.getClassName()), fullContentRedirect, liferayPortletRequest, liferayPortletResponse);

List<DropdownItem> dropdownItems = assetEntryActionDropdownItemsProvider.getActionDropdownItems();
%>

<c:if test="<%= ListUtil.isNotEmpty(dropdownItems) %>">
	<c:choose>
		<c:when test="<%= dropdownItems.size() > 1 %>">
			<liferay-ui:icon-menu
				cssClass="visible-interaction"
				direction="left-side"
				icon="<%= StringPool.BLANK %>"
				markupView="lexicon"
				message="<%= StringPool.BLANK %>"
				showWhenSingleIcon="<%= true %>"
				triggerCssClass="text-primary"
			>

				<%
				for (DropdownItem dropdownItem : dropdownItems) {
					Map<String, Object> data = (HashMap<String, Object>)dropdownItem.get("data");
				%>

					<liferay-ui:icon
						data="<%= data %>"
						message='<%= String.valueOf(dropdownItem.get("label")) %>'
						method="get"
						url='<%= String.valueOf(dropdownItem.get("href")) %>'
						useDialog='<%= GetterUtil.getBoolean(data.get("useDialog")) %>'
					/>

				<%
				}
				%>

			</liferay-ui:icon-menu>
		</c:when>
		<c:otherwise>

			<%
			DropdownItem dropdownItem = dropdownItems.get(0);

			Map<String, Object> data = (HashMap<String, Object>)dropdownItem.get("data");
			%>

			<liferay-ui:icon
				cssClass="visible-interaction"
				data='<%= (HashMap)dropdownItem.get("data") %>'
				icon='<%= String.valueOf(dropdownItem.get("icon")) %>'
				linkCssClass="text-primary"
				markupView="lexicon"
				message='<%= String.valueOf(dropdownItem.get("label")) %>'
				method="get"
				url='<%= String.valueOf(dropdownItem.get("href")) %>'
				useDialog='<%= GetterUtil.getBoolean(data.get("useDialog")) %>'
			/>
		</c:otherwise>
	</c:choose>
</c:if>