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.

109 lines
4.2 KiB

  1. <div class="narrow">
  2. <?= partial('partials/header') ?>
  3. <div style="float: right; margin-top: 6px;">
  4. <button class="btn btn-success" id="btn_post">Save Bookmark</button>
  5. </div>
  6. <div style="clear: both;">
  7. <div class="alert alert-success hidden" id="test_success"><strong>Success! We found a Location header in the response!</strong><br>Your post should be on your website now!<br><a href="" id="post_href">View your post</a></div>
  8. <div class="alert alert-danger hidden" id="test_error"><strong>Your endpoint did not return a Location header.</strong><br>See <a href="/creating-a-micropub-endpoint">Creating a Micropub Endpoint</a> for more information.</div>
  9. </div>
  10. <form role="form" style="margin-top: 20px;" id="note_form">
  11. <div class="form-group">
  12. <label for="note_bookmark"><code>bookmark-of</code></label>
  13. <input type="text" id="note_bookmark" value="<?= $this->bookmark_url ?>" class="form-control">
  14. </div>
  15. <div class="form-group">
  16. <label for="note_name"><code>name</code></label>
  17. <input type="text" id="note_name" value="<?= $this->bookmark_name ?>" class="form-control">
  18. </div>
  19. <div class="form-group">
  20. <label for="note_content"><code>content</code> (optional)</label>
  21. <textarea id="note_content" value="" class="form-control" style="height: 5em;"><?= $this->bookmark_content ?></textarea>
  22. </div>
  23. <div class="form-group">
  24. <label for="note_category"><code>category</code> (optional, comma-separated list of tags)</label>
  25. <input type="text" id="note_category" value="<?= $this->bookmark_tags ?>" class="form-control" placeholder="e.g. web, personal">
  26. </div>
  27. <div class="form-group">
  28. <label for="note_syndicate-to"><code>syndicate-to</code> <a href="javascript:reload_syndications()">(refresh)</a></label>
  29. <div id="syndication-container">
  30. <?php
  31. if($this->syndication_targets) {
  32. echo '<ul>';
  33. foreach($this->syndication_targets as $syn) {
  34. echo '<li>'
  35. . '<button data-syndicate-to="'.(isset($syn['uid']) ? htmlspecialchars($syn['uid']) : htmlspecialchars($syn['target'])).'" class="btn btn-default btn-block">'
  36. . ($syn['favicon'] ? '<img src="'.htmlspecialchars($syn['favicon']).'" width="16" height="16"> ' : '')
  37. . htmlspecialchars($syn['target'])
  38. . '</button>'
  39. . '</li>';
  40. }
  41. echo '</ul>';
  42. } else {
  43. ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
  44. You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php
  45. }
  46. ?>
  47. </div>
  48. </div>
  49. </form>
  50. <hr>
  51. <div style="text-align: right;">
  52. Bookmarklet: <a href="javascript:<?= js_bookmarklet('partials/bookmark-bookmarklet', $this) ?>" class="btn btn-default btn-xs">bookmark</a>
  53. </div>
  54. </div>
  55. <script>
  56. $(function(){
  57. $("#btn_post").click(function(){
  58. var syndications = [];
  59. $("#syndication-container button.btn-info").each(function(i,btn){
  60. syndications.push($(btn).data('syndication'));
  61. });
  62. $.post("/micropub/post", {
  63. 'bookmark-of': $("#note_bookmark").val(),
  64. name: $("#note_name").val(),
  65. content: $("#note_content").val(),
  66. category: csv_to_array($("#note_category").val()),
  67. 'syndicate-to': syndications
  68. }, function(response){
  69. if(response.location != false) {
  70. $("#test_success").removeClass('hidden');
  71. $("#test_error").addClass('hidden');
  72. $("#post_href").attr("href", response.location);
  73. // $("#note_bookmark").val("");
  74. // $("#note_content").val("");
  75. // $("#note_category").val("");
  76. window.location = response.location;
  77. } else {
  78. $("#test_success").addClass('hidden');
  79. $("#test_error").removeClass('hidden');
  80. }
  81. });
  82. return false;
  83. });
  84. bind_syndication_buttons();
  85. });
  86. <?= partial('partials/syndication-js') ?>
  87. </script>