nmbug.js: Stub out a dialog for editing tags
authorW. Trevor King <wking@tremily.us>
Sat, 20 Sep 2014 22:32:38 +0000 (15:32 -0700)
committerW. Trevor King <wking@tremily.us>
Sun, 21 Sep 2014 12:18:58 +0000 (05:18 -0700)
It lists the associated Message-ID and tags, but I haven't added
JavaScript to support editing the tag list yet.  I'm using the
<dialog> element [1] to float this dialog over the launching page
(e.g. Gmane), so we don't have to worry about mucking with whatever's
going on there ;).

[1]: https://html.spec.whatwg.org/multipage/forms.html#the-dialog-element

nmbug.js

index 332172905e1085d7225df39987a4dbd9fb99b827..ecf03d894d64a9ea207abb959c96d1cbd6da7347 100644 (file)
--- a/nmbug.js
+++ b/nmbug.js
@@ -25,7 +25,29 @@ nmbug = {
                request.send();
        },
        _edit_tags: function (message_id, tags) {
                request.send();
        },
        _edit_tags: function (message_id, tags) {
-               alert('edit ' + tags + ' for ' + message_id);
+               var dialog = document.createElement('dialog');
+
+               var content = document.createElement('p');
+               content.innerHTML = 'Edit tags for ' + message_id;
+               dialog.appendChild(content);
+
+               var ul = document.createElement('ul');
+               dialog.appendChild(ul);
+               for (var i = 0; i < tags.length; i++) {
+                       var li = document.createElement('li');
+                       li.innerHTML = tags[i];
+                       ul.appendChild(li);
+               }
+               var close = document.createElement('button');
+               close.innerHTML = 'Close';
+               close.onclick = function () {
+                       dialog.close();
+               };
+               dialog.appendChild(close);
+
+               document.body.appendChild(dialog);
+
+               dialog.show();
        },
 };
 
        },
 };