From 592eac5d8dc4c704bfb34915c0703fc2aecc6d46 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 6 Jul 2014 18:28:18 -0700 Subject: Adds support for querying your micropub endpoint to check for syndication targets. This changes the value of "in-reply-to" to use hyphens instead of underscore separators!! Also shows you the full request made to your micropub endpoint. --- views/dashboard.php | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++--- views/docs.php | 33 ++++++++++++++++++-- 2 files changed, 114 insertions(+), 6 deletions(-) (limited to 'views') diff --git a/views/dashboard.php b/views/dashboard.php index cabeedc..d88a59c 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -23,6 +23,24 @@ +
+ +
+ syndication_targets) { + echo '
    '; + foreach($this->syndication_targets as $syn) { + echo '
  • '; + } + echo '
'; + } else { + ?>
No syndication targets were found on your site. + You can provide a list of supported syndication targets that will appear as checkboxes here.
+
+
+
@@ -45,6 +63,11 @@ + + test_response): ?>

Last response from your Micropub endpoint (response_date) ?>)

@@ -80,17 +103,26 @@ $(function(){ $("#btn_post").click(function(){ + + var syndications = []; + $("#syndication-container button.btn-info").each(function(i,btn){ + syndications.push($(btn).data('syndication')); + }); + $.post("/micropub/post", { content: $("#note_content").val(), - in_reply_to: $("#note_in_reply_to").val(), + 'in-reply-to': $("#note_in_reply_to").val(), location: $("#note_location").val(), category: $("#note_category").val(), - slug: $("#note_slug").val() + slug: $("#note_slug").val(), + 'syndicate-to': syndications.join(',') }, function(data){ var response = JSON.parse(data); if(response.location != false) { - $("#note_form").slideUp(); + $("#note_form").slideUp(200, function(){ + $(window).scrollTop($("#test_success").position().top); + }); $("#test_success").removeClass('hidden'); $("#test_error").addClass('hidden'); @@ -107,8 +139,11 @@ $(function(){ } $("#last_response_date").html("(just now)"); + $("#test_request").html(response.request); + $("#last_request_container").show(); $("#test_response").html(response.response); - }) + }); + return false; }); function location_error(msg) { @@ -174,10 +209,54 @@ $(function(){ fetch_location(); } + bind_syndication_buttons(); }); + +function reload_syndications() { + $.getJSON("/micropub/syndications", function(data){ + if(data.targets) { + $("#syndication-container").html(''); + for(var i in data.targets) { + var target = data.targets[i].target; + var favicon = data.targets[i].favicon; + $("#syndication-container ul").append('
  • '); + } + bind_syndication_buttons(); + } else { + + } + console.log(data); + }); +} + +function bind_syndication_buttons() { + $("#syndication-container button").unbind("click").click(function(){ + $(this).toggleClass('btn-info'); + return false; + }); +} +