{namespace m=Neos\Media\ViewHelpers}
{namespace neos=Neos\Neos\ViewHelpers}
<f:layout name="EditImage"/>

<f:section name="Title">Edit asset collection</f:section>

<f:section name="Content">
    <f:form method="post" action="updateAssetCollection" controller="Asset" object="{assetCollection}" objectName="assetCollection">
        <legend>{neos:backend.translate(id: 'editCollection', package: 'Neos.Media.Browser')}</legend>
        <div class="neos-row-fluid">
            <div class="neos-span6 neos-image-inputs">
                <fieldset>
                    <legend>{neos:backend.translate(id: 'basics', package: 'Neos.Media.Browser')}</legend>
                    <label for="title">{neos:backend.translate(id: 'field.title', package: 'Neos.Media.Browser')}</label>
                    <f:form.textfield property="title" id="title" placeholder="{neos:backend.translate(id: 'field.title', package: 'Neos.Media.Browser')}"/>
                    <f:if condition="{tags}">
                        <label>{neos:backend.translate(id: 'tags', package: 'Neos.Media.Browser')}</label>
                        <f:for each="{tags}" as="tag">
                            <label class="neos-checkbox neos-inline">
                                <m:form.checkbox property="tags" multiple="TRUE" value="{tag}"/>
                                <span></span> {tag.label}
                            </label>
                        </f:for>
                    </f:if>
                </fieldset>
            </div>
        </div>
        <div class="neos-footer">
            <f:link.action action="index" controller="Asset" class="neos-button" addQueryString="true">{neos:backend.translate(id: 'cancel', package: 'Neos.Neos')}</f:link.action>
            <a data-toggle="modal" href="#collection-{assetCollection -> f:format.identifier()}" class="neos-button neos-button-danger">{neos:backend.translate(id: 'delete', package: 'Neos.Neos')}</a>
            <f:form.submit id="save" class="neos-button neos-button-primary" value="{neos:backend.translate(id: 'save', package: 'Neos.Neos')}"/>
            <div class="neos-hide" id="collection-{assetCollection -> f:format.identifier()}">
                <div class="neos-modal-centered">
                    <div class="neos-modal-content">
                        <div class="neos-modal-header">
                            <button type="button" class="neos-close neos-button" data-dismiss="modal"></button>
                            <div class="neos-header">{neos:backend.translate(id: 'message.reallyDeleteAsset', arguments: {0: assetCollection.title}, package: 'Neos.Media.Browser')}</div>
                            <div>
                                <div class="neos-subheader">
                                    <p>
                                        {neos:backend.translate(id: 'message.willDeleteCollection', package: 'Neos.Media.Browser')}<br/>
                                        {neos:backend.translate(id: 'message.operationCannotBeUndone', package: 'Neos.Media.Browser')}
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div class="neos-modal-footer">
                            <a href="#" class="neos-button" data-dismiss="modal">{neos:backend.translate(id: 'cancel', package: 'Neos.Neos')}</a>
                            <button type="submit" form="postHelper" formaction="{f:uri.action(action: 'deleteAssetCollection', controller: 'Asset', arguments: {assetCollection: assetCollection}, addQueryString: true)}" class="neos-button neos-button-mini neos-button-danger">
                                {neos:backend.translate(id: 'message.confirmDeleteCollection', package: 'Neos.Media.Browser')}
                            </button>
                        </div>
                    </div>
                </div>
                <div class="neos-modal-backdrop neos-in"></div>
            </div>
        </div>
        <f:render partial="ConstraintsHiddenFields" arguments="{constraints: constraints}" />
    </f:form>
    <f:form action="index" id="postHelper" method="post">
        <f:render partial="ConstraintsHiddenFields" arguments="{constraints: constraints}" />
    </f:form>
</f:section>
