<!DOCTYPE html>
<html lang=fr>
    <head>
        % include('head.html')
        <script src="/assets/scripts/newform.js" defer></script>
    </head>
    <body>
        <form action="/new" method=POST id=post-snippet accept-charset=utf-8>
            <textarea spellcheck=false placeholder="Entrer votre code." name=code autofocus required>{{code}}</textarea>
            <input type=hidden name=parentid value="{{parentid}}">

            <div class="controls">
                <input class="control" list=maxusage-presets type="number" min="0" title="Nombre d'utilisation maximum : 0 ou 10, ect." placeholder="Nombre d'utilisation maximum : 0 ou 10, ect." name=maxusage>
                <datalist id=maxusage-presets>
                    <option value="0">
                    <option value="2">
                    <option value="10">
                    <option value="100">
                </datalist>

                <input pattern="[0-9dhms]+" list=durations-preset placeholder="Expiration : 0 ou 1d1h1m1s" class="control" title="Expiration : 0 ou 1d1h1m1s" name=lifetime>
                <datalist id=durations-preset>
                    <option value="0">
                    <option value="7d">
                    <option value="1d">
                    <option value="6h">
                    <option value="1h">
                    <option value="10m">
                </datalist>

                <select class="control" title="Langage" name=lang>
                    <option disabled>Langage</option>
                    % for ext, lang in languages:
                    % if lang == default_language:
                        <option value="{{ext}}" selected>{{lang.title()}}</option>
                    % else:
                        <option value="{{ext}}">{{lang.title()}}</option>
                    % end
                    % end
                </select>

                <button class="control" title="Enregistrer" type=submit>
                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
                      <path fill-rule="evenodd" d="M6 2a2 2 0 00-2 2v12a2 2 0 002 2h8a2 2 0 002-2V7.414A2 2 0 0015.414 6L12 2.586A2 2 0 0010.586 2H6zm5 6a1 1 0 10-2 0v3.586l-1.293-1.293a1 1 0 10-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 11.586V8z" clip-rule="evenodd" />
                    </svg>
                </button>
            </div>
        </form>
    </body>
</html>
