Browse Source

add slug field. collapse form after a successful post

pull/5/head
Aaron Parecki 7 years ago
parent
commit
3ef4104992
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      views/dashboard.php

+ 13
- 5
views/dashboard.php View File

@ -1,7 +1,7 @@
<div class="narrow">
<?= partial('partials/header') ?>
<form role="form" style="margin-top: 20px;">
<form role="form" style="margin-top: 20px;" id="note_form">
<div class="form-group">
<label for="note_content"><code>content</code></label>
@ -14,10 +14,15 @@
</div>
<div class="form-group">
<label for="note_category"><code>category</code> (comma-separated list of tags)</label>
<label for="note_category"><code>category</code> (optional, comma-separated list of tags)</label>
<input type="text" id="note_category" value="" class="form-control" placeholder="e.g. web, personal">
</div>
<div class="form-group">
<label for="note_slug"><code>slug</code> (optional)</label>
<input type="text" id="note_slug" value="" class="form-control">
</div>
<div class="form-group">
<label for="note_location"><code>location</code></label>
<input type="checkbox" id="note_location_chk" value="">
@ -33,10 +38,9 @@
</div>
</div>
<button class="btn btn-success" id="btn_post">Post</button>
</form>
<button class="btn btn-success" id="btn_post">Post</button>
<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>
<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>
@ -80,11 +84,14 @@ $(function(){
content: $("#note_content").val(),
in_reply_to: $("#note_in_reply_to").val(),
location: $("#note_location").val(),
category: $("#note_category").val()
category: $("#note_category").val(),
slug: $("#note_slug").val()
}, function(data){
var response = JSON.parse(data);
if(response.location != false) {
$("#note_form").slideUp();
$("#test_success").removeClass('hidden');
$("#test_error").addClass('hidden');
$("#post_href").attr("href", response.location);
@ -92,6 +99,7 @@ $(function(){
$("#note_content").val("");
$("#note_in_reply_to").val("");
$("#note_category").val("");
$("#note_slug").val("");
} else {
$("#test_success").addClass('hidden');

Loading…
Cancel
Save