Show micropub error descriptions
[tt-rss-micropub.git] / commentform.phtml
index 8d07af0..d1ffd82 100644 (file)
@@ -9,7 +9,7 @@
 
       new Ajax.Request('backend.php', {
           parameters: dojo.objectToQuery(this.getValues()),
-         onSuccess: function(transport) {
+          onSuccess: function(transport) {
               notify_info(transport.responseJSON.message);
               $('postReplyUrl').writeAttribute(
                   'href', transport.responseJSON.location
@@ -19,7 +19,7 @@
               //Effect.Grow('postReplySuccess');
               $('postReply').hide();
               $('postReplySuccess').show();
-         },
+          },
           onFailure: function(transport) {
               notify_error(transport.responseText);
           }
   <?php print_hidden('plugin', 'micropub'); ?>
   <?php print_hidden('method', 'action'); ?>
   <?php print_hidden('mode', 'post'); ?>
+  <input name="action" value="" id="mpaction"
+         dojoType="dijit.form.TextBox" style="display: none"/>
 
-  <?php print_hidden('replyTo', htmlspecialchars($article['link'])); ?>
+  <?php print_hidden('postUrl', htmlspecialchars($article['link'])); ?>
+
+  <div style="text-align: right">
+   <button type="submit" name="action"
+     onclick="dijit.byId('mpaction').set('value',this.value);"
+     value="bookmark">🔖 Bookmark</button>
+   <button type="submit" name="action"
+     onclick="dijit.byId('mpaction').set('value',this.value);"
+     value="like">♥ Like</button>
+  </div>
+
+  <textarea name="content" rows="4" cols="60"
+            style="box-sizing: border-box; width:100%; height: auto"
+            dojoType="dijit.form.SimpleTextarea"
+   ></textarea><br/>
 
   <?php if (count($accounts) == 1) { ?>
    <?php print_hidden('me', htmlspecialchars(reset($accounts))); ?>
   <?php } else { ?>
    <label for="micropub-me">Identity:</label>
-   <?php print_select('micropub-me', null, $accounts,
+   <?php print_select('micropub-me', $defaultAccount, $accountUrls,
      'dojoType="dijit.form.Select" size="1"', 'me'); ?>
    <br/>
   <?php } ?>
 
-  <textarea name="content" rows="4" cols="60"
-            style="width:95%; height: auto"
-            dojoType="dijit.form.SimpleTextarea"
-   ></textarea><br/>
-  <button type="submit">Post comment</button>
+  <button type="submit" name="action"
+    onclick="dijit.byId('mpaction').set('value',this.value);"
+    value="comment">Post comment</button>
  </form>
 
  <div class="reply" style="text-align: right">