You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/03/18 00:40:29 UTC

[whimsy.git] [2/2] Commit 4dbd0be: add checkboxes

Commit 4dbd0be9f4319bfdce2034c36fa9a8d0a26b496f:
    add checkboxes


Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>

------------------------------------------------------------
www/board/agenda/views/actions/feedback.json.rb              | + 
www/board/agenda/views/feedback.html.rb                      | +++++++ --
------------------------------------------------------------
17 changes: 14 additions, 3 deletions.
------------------------------------------------------------


diff --git a/www/board/agenda/views/actions/feedback.json.rb b/www/board/agenda/views/actions/feedback.json.rb
index a3df23f..d014531 100644
--- a/www/board/agenda/views/actions/feedback.json.rb
+++ b/www/board/agenda/views/actions/feedback.json.rb
@@ -31,6 +31,7 @@
   # select exec officer, additional officer, and committee reports
   next unless item[:attach] =~ /^(4[A-Z]|\d|[A-Z]+)$/
   next unless item['chair_email']
+  next unless @dryrun or @checked[item['title'].gsub(/\s/, '_')]
 
   # collect comments and minutes
   text = ''
diff --git a/www/board/agenda/views/feedback.html.rb b/www/board/agenda/views/feedback.html.rb
index b3e5c09..9a5066e 100644
--- a/www/board/agenda/views/feedback.html.rb
+++ b/www/board/agenda/views/feedback.html.rb
@@ -15,19 +15,28 @@
 
     _p_ 'loading'
 
-    _script %{
+    _script %q{
       var button = document.querySelector('button');
       var alert = document.querySelector('.alert');
+      var form = document.querySelector('form');
 
       jQuery.getJSON('feedback.json', function(data) {
         data.forEach(function(message) {
           var h1 = document.createElement('h1');
           h1.setAttribute('id', message.title);
           h1.textContent = message.title;
+
+          var input = document.createElement('input');
+          input.setAttribute('type', 'checkbox');
+          input.setAttribute('name', 'checked[' +
+            message.title.replace(/\s/g, '_') + ']');
+          input.checked = true;
+          h1.insertBefore(input, h1.firstChild);
+
           var pre = document.createElement('pre');
           pre.textContent = message.mail;
-          document.body.appendChild(h1);
-          document.body.appendChild(pre);
+          form.appendChild(h1);
+          form.appendChild(pre);
         });
 
         document.querySelector('p').remove();
@@ -40,6 +49,7 @@
         button.disabled = true;
         jQuery.ajax('feedback.json', {
           method: 'POST',
+          data: $(form).serialize(),
 
           success: function(event) {
             alert.classList.add('alert-success');