<%--
/**
 * 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="/entries/init.jsp" %>

<%
List<AssetPublisherAddItemHolder> assetPublisherAddItemHolders = (List<AssetPublisherAddItemHolder>)request.getAttribute(CollectionPageLayoutTypeControllerWebKeys.ASSET_PUBLISHER_ADD_ITEM_HOLDERS);
%>

<liferay-ui:success key="collectionItemAdded" message="your-request-completed-successfully" />

<li class="control-menu-nav-item control-menu-nav-item-content">
	<c:choose>
		<c:when test="<%= assetPublisherAddItemHolders.size() == 1 %>">

			<%
			AssetPublisherAddItemHolder assetPublisherAddItemHolder = assetPublisherAddItemHolders.get(0);

			String label = LanguageUtil.format(request, "new-x", new Object[] {assetPublisherAddItemHolder.getModelResource()});
			%>

			<clay:link
				aria-label="<%= label %>"
				borderless="<%= true %>"
				cssClass="lfr-portal-tooltip"
				data-title="<%= label %>"
				displayType="unstyled"
				href="<%= String.valueOf(assetPublisherAddItemHolder.getPortletURL()) %>"
				icon="plus"
				monospaced="<%= true %>"
				small="<%= true %>"
			/>
		</c:when>
		<c:otherwise>

			<%
			String label = LanguageUtil.get(resourceBundle, "new-collection-page-item");

			CollectionItemsDetailDisplayContext collectionItemsDetailDisplayContext = (CollectionItemsDetailDisplayContext)request.getAttribute(CollectionPageLayoutTypeControllerWebKeys.COLLECTION_ITEMS_DETAIL_DISPLAY_CONTEXT);
			%>

			<clay:dropdown-menu
				aria-label="<%= label %>"
				borderless="<%= true %>"
				displayType="unstyled"
				dropdownItems="<%= collectionItemsDetailDisplayContext.getDropdownItems(assetPublisherAddItemHolders) %>"
				icon="plus"
				monospaced="<%= true %>"
				small="<%= true %>"
				title="<%= label %>"
			/>
		</c:otherwise>
	</c:choose>
</li>