Here’s my latest attempt. A couple of questions.

1. When I create the button, I set data_email to the email address.

But when I add the event listener, I getAttribute on data-email. Is there some 
magic that transforms data_email to data-email?

2. I’m missing the lesson on creating new line characters in strings. \n 
doesn’t seem to work.

3. How do I tell email to use my clr at apache.org address? 

Thanks,

Craig

clr% svn diff
Index: icla-lint.cgi
===================================================================
--- icla-lint.cgi       (revision 972670)
+++ icla-lint.cgi       (working copy)
@@ -122,7 +122,8 @@
           end
 
           _td do
-            _button 'email', data_id: id
+            _button 'email', data_email: "#{name} <#{email}>",
+              data_issue: note, data_name: name
             _span note
           end
 
@@ -151,8 +152,24 @@
     buttons = document.querySelectorAll('button')
     for i in 0...buttons.length
       buttons[i].addEventListener('click') do |event|
-        id = event.target.getAttribute('data-id')
-        alert(id)
+        email = event.target.getAttribute('data-email')
+        issue = event.target.getAttribute('data-issue')
+        name  = event.target.getAttribute('data-name')
+
+        destination = "mailto:#{email}[email protected]";
+        subject = 'Your Apache ICLA'
+        from = '[email protected]'
+        body = 'Dear ' + name + '\n' +
+            'While reviewing our records, we have not been able to locate your 
ICLA.\n' +
+            'Can you please resubmit to [email protected]? 
http://apache.org/licenses/#submitting\n' +
+            'Best regards,\n\n' +
+            'Craig'
+
+        window.location = destination +
+          "&from=#{encodeURIComponent(from)}" +
+          "&subject=#{encodeURIComponent(subject)}" +
+          "&body=#{encodeURIComponent(body)}"
+
       end
     end

> On Nov 16, 2015, at 10:24 PM, Sam Ruby <[email protected]> wrote:
> 
> On Tue, Nov 17, 2015 at 12:31 AM, Craig L Russell
> <[email protected]> wrote:
>> Another thought on this, since it would be nice to have this feature work 
>> both on a client and on the whimsy service.
>> 
>> Maybe the “alert” could create an email message that can be edited to suit 
>> (similar to the commit message in SA tool) and once it’s perfect, the (send) 
>> button would send the completed, edited message to the email system to be 
>> sent.
>> 
>> I’ll experiment with the alert dialog box to see what is involved.
> 
> I do suggest that you try the following patch before you explore a dialog box:
> 
> Index: icla-lint.cgi
> ===================================================================
> --- icla-lint.cgi    (revision 972667)
> +++ icla-lint.cgi    (working copy)
> @@ -122,7 +122,8 @@
>           end
> 
>           _td do
> -            _button 'email', data_id: id
> +            _button 'email', data_email: "#{name} <#{email}>",
> +              data_issue: note
>             _span note
>           end
> 
> @@ -151,8 +152,16 @@
>     buttons = document.querySelectorAll('button')
>     for i in 0...buttons.length
>       buttons[i].addEventListener('click') do |event|
> -        id = event.target.getAttribute('data-id')
> -        alert(id)
> +        email = event.target.getAttribute('data-email')
> +        issue = event.target.getAttribute('data-issue')
> +
> +        destination = "mailto:#{email}[email protected]";
> +        subject = issue
> +        body = 'blah, blah, blah'
> +
> +        window.location = destination +
> +          "&subject=#{encodeURIComponent(subject)}" +
> +          "&body=#{encodeURIComponent(body)}"
>       end
>     end
> 
> ===================================================================
> 
> If you want to go the dialog box route, what the board agenda tool
> uses is Bootstrap modals:
> 
> http://getbootstrap.com/javascript/#modals
> 
> To pull in bootstrap, add the following to the top of your script:
> 
> require 'wunderbar/bootstrap/theme'
> 
> Have fun!
> 
> - Sam Ruby

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!

Reply via email to