<%--
/**
 * 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="/html/taglib/ui/asset_addon_entry_selector/init.jsp" %>

<div class="lfr-asset-addon-entry-selector" id="<%= namespace + id %>assetAddonEntrySelector">
	<aui:input name="<%= hiddenInput %>" type="hidden" value='<%= ListUtil.toString(selectedAssetAddonEntries, "key") %>' />

	<ul class="list-inline list-unstyled selected-entries">

		<%
		for (AssetAddonEntry assetAddonEntry : selectedAssetAddonEntries) {
		%>

			<li class="list-entry" data-key="<%= assetAddonEntry.getKey() %>">
				<span class="label label-circle label-entry">
					<%= assetAddonEntry.getLabel(locale) %>

					<button class="remove-button" type="button">
						<i class="icon-remove"></i>
					</button>
				</span>
			</li>

		<%
		}
		%>

	</ul>

	<aui:button cssClass="select-button" name='<%= id + "selectButton" %>' value="select" />
</div>

<aui:script use="liferay-asset-addon-entry-selector">
	var assetAddonEntries = [];

	<%
	for (AssetAddonEntry assetAddonEntry : assetAddonEntries) {
	%>

		assetAddonEntries.push(
			{
				icon: '<%= assetAddonEntry.getIcon() %>',
				key: '<%= assetAddonEntry.getKey() %>',
				label: '<%= assetAddonEntry.getLabel(locale) %>'
			}
		);

	<%
	}
	%>

	var selectedAssetAddonEntries = [];

	<%
	for (AssetAddonEntry assetAddonEntry : selectedAssetAddonEntries) {
	%>

		selectedAssetAddonEntries.push('<%= assetAddonEntry.getKey() %>');

	<%
	}
	%>

	var assetAddonEntrySelector = new Liferay.AssetAddonEntrySelector(
		{
			assetAddonEntries: assetAddonEntries,
			dialogTitle: '<liferay-ui:message key="<%= title %>" />',
			rootNode: '#<%= namespace + id %>assetAddonEntrySelector',
			selectedAssetAddonEntries: selectedAssetAddonEntries
		}
	);
</aui:script>