Created
February 26, 2009 02:54
-
-
Save atduskgreg/70608 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shoes.setup do | |
| gem 'activeresource' | |
| gem 'actionmailer' | |
| source "http://gems.github.com" | |
| gem 'ambethia-smtp-tls' | |
| end | |
| require 'rubygems' | |
| require 'action_mailer' | |
| require 'active_resource' | |
| require 'smtp-tls' | |
| class VolunteerMailer < ActionMailer::Base | |
| def volunteer_email(to, sender, subject, text) | |
| recipients to | |
| from sender | |
| subject subject | |
| body text | |
| end | |
| end | |
| ActionMailer::Base.perform_deliveries = true | |
| ActionMailer::Base.delivery_method = :smtp | |
| ActionMailer::Base.smtp_settings = { | |
| :tls => true, | |
| :address => 'smtp.gmail.com', | |
| :port => 587, | |
| :domain => 'me.com', | |
| :user_name => 'me@me.com', | |
| :password => '<redacted>', | |
| :authentication => :plain | |
| } | |
| Shoes.app :title => "PDX Pop Volunteer Email Machine!" , :width => 599, :height => 810, :resizable => false do | |
| def start_download | |
| @download = Thread.fork { $people = ["email@email.com"] } | |
| end | |
| $people = nil | |
| stack do | |
| image "little_guy.jpg" | |
| end | |
| stack :margin => 10 do | |
| @instructions = para "Compose an email to the volunteers:" | |
| @email = edit_box :width => 580, :height => 400 | |
| end | |
| def rotate_ball | |
| @ball.remove if @ball | |
| @ball_zone.prepend do | |
| rotate 15 | |
| @ball = image "beachball.png", :width => 30 | |
| end | |
| end | |
| stack :margin => 10 do | |
| @action_zone = flow do | |
| @ball_zone = stack(:width => 30, :height => 30) | |
| para em("loading contacts from Highrise") | |
| end | |
| end | |
| start_download | |
| @animation = animate(24) do |frame| | |
| rotate_ball | |
| if !@download.alive? | |
| @animation.remove | |
| @action_zone.clear do | |
| button "Send!" do | |
| Shoes.p @email.text | |
| VolunteerMailer.deliver_volunteer_email("you@you.com", "me@me.com", "hi from shoes", @email.text) | |
| end | |
| para link "#{$people.size} recipients", :click => Proc.new{ | |
| window :title => "All email addresses in Highrise",:width => 300 do | |
| stack :margin => 20 do | |
| para $people.join(", ") | |
| end | |
| end | |
| } | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment