|
| 1 | +@extends('default') |
| 2 | + |
| 3 | +@section('pagetitle') Edit {{ $title }} - EdPaste @endsection |
| 4 | + |
| 5 | +@section('navbar') |
| 6 | +<li class="nav-item active"><a href="#" class="nav-link">Home</a></li> |
| 7 | +@if (Auth::check()) |
| 8 | +<li class="nav-item"><a href="/users/dashboard" class="nav-link">Dashboard</a></li> |
| 9 | +<li class="nav-item"><a href="/users/account" class="nav-link">My Account</a></li> |
| 10 | +<li class="nav-item"><a href=" /logout" class="nav-link">Logout <i>({{ Auth::user()->name }})</i></a></li> |
| 11 | +@else |
| 12 | +<li class="nav-item"><a href="/login" class="nav-link">Login</a></li> |
| 13 | +<li class="nav-item"><a href="/register" class="nav-link">Register</a></li> |
| 14 | +@endif |
| 15 | +@endsection |
| 16 | + |
| 17 | +@section('script') |
| 18 | +<script src="../jquery.autogrowtextarea.min.js"></script> |
| 19 | +<script> |
| 20 | + function checkvalue(value) |
| 21 | + { |
| 22 | + if(value==="password") |
| 23 | + document.getElementById('passwordInput').style.display='block'; |
| 24 | + else |
| 25 | + document.getElementById('passwordInput').style.display='none'; |
| 26 | + } |
| 27 | +</script> |
| 28 | +@endsection |
| 29 | + |
| 30 | +@section('content') |
| 31 | +<div class="container"> |
| 32 | + <form action="/edit/{{ $link }}" method="post" accept-charset="utf-8"> |
| 33 | + {{ csrf_field() }} |
| 34 | + {{-- Ca c'est pour éviter que les navigateurs préremplissent les champs --}} |
| 35 | + <input style="display:none" type="text" name="fakeusernameremembered"/> |
| 36 | + <input style="display:none" type="password" name="fakepasswordremembered"/> |
| 37 | + |
| 38 | + <div class="row"> |
| 39 | + <div class="form-group col-xs-12 @if ($errors->has('pasteTitle')) has-error @endif"> |
| 40 | + <label for="pasteTitle">Title</label> |
| 41 | + <input type="text" class="form-control" name="pasteTitle" id="pasteTitle" placeholder="Title (optional)" maxlength="70" value="{{ old('pasteTitle') ? old('pasteTitle') : $title }}"> |
| 42 | + @if ($errors->has('pasteTitle')) |
| 43 | + <span class="help-block"> |
| 44 | + <strong>{{ $errors->first('pasteTitle') }}</strong> |
| 45 | + </span> |
| 46 | + @endif |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + <div class="row"> |
| 50 | + <div class="form-group col-xs-12 @if ($errors->has('pasteContent')) has-error @endif"> |
| 51 | + <label for="pasteContent">Content</label> |
| 52 | + <script type="text/javascript"> |
| 53 | + $(document).ready(function(){ |
| 54 | + $("#pasteContent").autoGrow(); |
| 55 | + }); |
| 56 | + </script> |
| 57 | + <textarea class="form-control input-sm" name="pasteContent" id="pasteContent" rows="15" placeholder="Paste your text here..." style="font-family: monospace;">{{ old('pasteContent') ? old('pasteContent') : $content }}</textarea> |
| 58 | + @if ($errors->has('pasteContent')) |
| 59 | + <span class="help-block"> |
| 60 | + <strong>{{ $errors->first('pasteContent') }}</strong> |
| 61 | + </span> |
| 62 | + @endif |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + <div class="row"> |
| 66 | + <div class="form-group col-sm-3 @if ($errors->has('expire')) has-error @endif"> |
| 67 | + <label for="expire">Paste expiration</label> |
| 68 | + <select class="form-control" name="expire" id="expire"> |
| 69 | + <option disabled selected></option> |
| 70 | + <option value="never">Never</option> |
| 71 | + <option value="burn">Burn after reading</option> |
| 72 | + <option value="10m">10 minutes</option> |
| 73 | + <option value="1h">1 hour</option> |
| 74 | + <option value="1d">1 day</option> |
| 75 | + <option value="1w">1 week</option> |
| 76 | + </select> |
| 77 | + @if ($errors->has('expire')) |
| 78 | + <span class="help-block"> |
| 79 | + <strong>{{ $errors->first('expire') }}</strong> |
| 80 | + </span> |
| 81 | + @endif |
| 82 | + </div> |
| 83 | + <div class="form-group col-sm-3 @if ($errors->has('pastePassword')) has-error @endif"> |
| 84 | + <label for="privacy">Privacy</label> |
| 85 | + <select class="form-control" name="privacy" id="privacy" onchange='checkvalue(this.value)'> |
| 86 | + <option value="link" {{ $privacy == "link" ? 'selected' : '' }}>Unlisted, access with link</option> |
| 87 | + <option value="password" {{ $privacy == "password" || $errors->has('pastePassword') ? 'selected' : '' }}>Password-protected</option> |
| 88 | + <option value="private" {{ $privacy == "private" ? 'selected' : '' }}>Private, only me</option> |
| 89 | + </select> |
| 90 | + </div> |
| 91 | + {{-- Ce truc n'apparait que si "Password-protected" est séléctionné plus haut --}} |
| 92 | + <div class="form-group col-sm-2 @if ($errors->has('pastePassword')) has-error @endif" id="passwordInput" @if (!$errors->has('pastePassword')) style="display:none;" @endif> |
| 93 | + <label for="pastePassword">Password</label> |
| 94 | + <input type="password" class="form-control" name="pastePassword" id="pastePassword" placeholder="Enter a password..." maxlength="40"> |
| 95 | + @if ($errors->has('pastePassword')) |
| 96 | + <span class="help-block"> |
| 97 | + <strong>{{ $errors->first('pastePassword') }}</strong> |
| 98 | + </span> |
| 99 | + @endif |
| 100 | + </div> |
| 101 | + </div> |
| 102 | + <div class="row"> |
| 103 | + <div class="form-group text-center"> |
| 104 | + <script> |
| 105 | + $(function () { |
| 106 | + $('[data-toggle="tooltip"]').tooltip() |
| 107 | + }) |
| 108 | + </script> |
| 109 | + {{-- La tooltip n'apparaît que pour les users non-id et le btn devient danger si y'a des erreurs --}} |
| 110 | + <div class="checkbox"> |
| 111 | + <label><input type="checkbox" name="noSyntax" @if ($noSyntax) checked @endif>Disable syntax highlighting</label> |
| 112 | + </div> |
| 113 | + <button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!Auth::check()) data-toggle="tooltip" data-placement="top" title="Registered users have access to other privacy tools" @endif>Submit</button> |
| 114 | + </div> |
| 115 | + </div> |
| 116 | + |
| 117 | + </div> |
| 118 | +</div> |
| 119 | +</form> |
| 120 | +</div> |
| 121 | +@endsection |
0 commit comments