Browse Source

add slug field. collapse form after a successful post

pull/5/head
Aaron Parecki 11 years ago
parent
commit
3ef4104992
  1. 18
      views/dashboard.php

18
views/dashboard.php

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

Loading…
Cancel
Save