micropub form submit: add button action to formData
This commit is contained in:
parent
5752181b7c
commit
523a086928
2 changed files with 7 additions and 5 deletions
|
@ -27,14 +27,16 @@ $(function(){
|
|||
function submitMicropubForm(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
var form = $(this);
|
||||
var form = $(this).closest('form');
|
||||
var replyArea = form.parent();
|
||||
var endpoint = form.attr('action');
|
||||
var responseArea = $('.micropub-response', replyArea);
|
||||
var formData = form.serializeArray();
|
||||
formData.push({name: this.name, value: this.value});
|
||||
|
||||
$.post(
|
||||
form.attr('action'),
|
||||
form.serialize(),
|
||||
formData,
|
||||
function(result) {
|
||||
if (Math.floor(result.code / 100) == 2) {
|
||||
responseArea.html('<a target="_blank" href="' + result.location + '">Success!</a>');
|
||||
|
@ -57,7 +59,7 @@ $(function(){
|
|||
$(".show-reply-form").off('click').click(clickShowReplyForm);
|
||||
$(".show-like-form").off('click').click(clickShowLikeForm);
|
||||
|
||||
$(".micropub-form").off('submit').submit(submitMicropubForm);
|
||||
$(".micropub-form button[type='submit']").off('click').click(submitMicropubForm);
|
||||
|
||||
$(".micropub-form .content").focus(function (){
|
||||
$(this).animate({ height: "4em" }, 200);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<input type="hidden" name="target" value="{{ entry.permalink }}"/>
|
||||
<div>
|
||||
<textarea class="content" name="content"></textarea>
|
||||
<button type="submit" name="action" value="reply" class="fa fa-reply"></button>
|
||||
<button type="submit" name="action" value="like" class="fa fa-star"></button>
|
||||
<button type="submit" name="action" value="reply"><i class="fa fa-reply"></i></button>
|
||||
<button type="submit" name="action" value="like"><i class="fa fa-star"></i></button>
|
||||
</div>
|
||||
<div>
|
||||
{% for target in current_user.get_setting('syndicate-to', []) %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue