Mirror of Quill
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.1 KiB

  1. <div class="narrow">
  2. <?= partial('partials/header') ?>
  3. <form method="POST" action="/photo" role="form" style="margin-top: 20px;" id="note_form" enctype="multipart/form-data">
  4. <div class="form-group">
  5. <label for="note_photo"><code>photo</code></label>
  6. <div class="uploadBtn btn btn-default">
  7. <span>Choose File</span>
  8. <input type="file" name="note_photo" id="note_photo" accept="image/jpg,image/jpeg,image/gif,image/png">
  9. </div>
  10. <div class="hidden" id="photo_filename_container">
  11. <input type="text" class="form-control" disabled="disabled" id="photo_filename">
  12. </div>
  13. <p class="help-block">Photo JPEG, GIF or PNG.</p>
  14. </div>
  15. <div class="form-group">
  16. <label for="note_content"><code>content</code> (optional)</label>
  17. <textarea name="note_content" id="note_content" value="" class="form-control" style="height: 4em;"><?php if(isset($this->note_content)) echo $this->note_content ?></textarea>
  18. </div>
  19. <button class="btn btn-success" id="btn_post">Post</button>
  20. <div style="clear:both;"></div>
  21. </form>
  22. <?php if(!empty($this->location)): ?>
  23. <div class="alert alert-success">
  24. <strong>Success!</strong> Photo posted to: <em><a href="<?= $this->location ?>"><?= $this->location ?></a></em>
  25. </div>
  26. <?php endif ?>
  27. <?php if(!empty($this->error)): ?>
  28. <div class="alert alert-danger">
  29. <strong>Error:</strong> <em><?= $this->error ?></em>
  30. </div>
  31. <?php endif ?>
  32. <?php if(!empty($this->response)): ?>
  33. <h4>Response:</h4>
  34. <pre><?= $this->response ?></pre>
  35. <?php endif ?>
  36. </div>
  37. <script>
  38. $(function(){
  39. document.getElementById("note_photo").onchange = function () {
  40. var filename = this.value;
  41. if(filename.match(/[^\\]+$/)) {
  42. filename = filename.match(/[^\\]+$/)[0];
  43. }
  44. $("#photo_filename").val(filename);
  45. $("#photo_filename_container").removeClass("hidden");
  46. };
  47. });
  48. </script>