This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/templates/widgets/genericFileField.hamlet
2020-07-22 12:07:01 +02:00

63 lines
2.2 KiB
Plaintext

$newline never
$maybe ident <- identSecret
<input type=hidden name=#{fieldName} id=#{fieldId}--ident value=#{ident}>
$if not (null fileInfos)
<table .file-input__list .table .table--narrow .table--striped .table--hover .table--condensed>
<colgroup>
<col .checkbox-only>
<col .tooltip-only>
<col>
<thead>
<tr>
<th .table__th>
<th .table__th colspan=2>
_{MsgPreviouslyUploadedInfo}
$forall FileUploadInfo{..} <- fileInfos
<tbody>
<tr>
<td .table__td>
<input type=checkbox id=#{fuiHtmlId} name=#{fieldName} :fuiChecked:checked value=#{review _FileTitle fuiTitle} :fuiForced:readonly>
<td .table__td .tooltip-only>
$if fuiSession
^{messageTooltip uploadOnlySessionMessage}
<td .table__td>
<label for=#{fuiHtmlId} .file-input__list-item>
#{fuiTitle}
<div .file-input__info>
_{MsgPreviouslyUploadedDeletionInfo}
<div .file-uploads-label>_{MsgAddMoreFiles}
$# new files
<input type="file" uw-file-input name=#{fieldName} id=#{fieldId} :fieldMultiple:multiple :acceptRestricted:accept=#{accept} :req && null fileInfos:required :is _Just fieldMaxFileSize:data-max-size=#{maybe "-1" tshow fieldMaxFileSize}>
$if fieldMultiple
<div .file-input__info>
_{MsgMultiFileUploadInfo}
$maybe exts <- fmap toNullable fieldRestrictExtensions
<div .file-input__info>
_{MsgUploadModeExtensionRestriction}: #
<ul .list--inline .list--comma-separated .list--iconless>
$forall ext <- bool id (mappend zipExtensions) mayUnpack exts
<li style="font-family: monospace">#{ext}
$if fieldMultiple
<br>
_{MsgUploadModeExtensionRestrictionMultipleTip}
$maybe maxSize <- fieldMaxFileSize
<div .file-input__info>
$if fieldMultiple
_{MsgFileUploadMaxSizeMultiple (textBytes maxSize)}
$else
_{MsgFileUploadMaxSize (textBytes maxSize)}
$if not (fieldOptionForce fieldUnpackZips)
<div .file-input__unpack>
^{iconTooltip (i18n MsgAutoUnzipInfo) Nothing False}
<label for=#{fieldId}_zip>_{MsgAutoUnzip}
<input type=checkbox id=#{fieldId}--zip name=#{fieldName} value=#{unpackZips} :fieldOptionDefault fieldUnpackZips:checked>