daily pastebin goal
87%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## views/email_request/notification.rhtml
  2. A new request at tumblize.com was just posted!
  3.  
  4. Here are the details of the request:
  5.     Full Name: <% @request['name'] %>
  6.     E-mail Address: <% @request['email'] %>
  7.     Tumblog Name: <% @request['tumblrName'] %>
  8.     "The Life Story": <% @request['inspiration'] %>
  9.    
  10.     Web Services:
  11.     <% @request['webServices'].each{ |service, uri| %>
  12.     #{service}: #{uri}
  13.     <% } %>
  14.  
  15.     Selected Designer: <% @request['name'] %>
  16.     <% @debugval %>
  17. ## app/controllers/request_handler_controller.rb
  18. class RequestHandlerController < ApplicationController
  19.     def email
  20.         @request = {
  21.             'name' => params["name"],
  22.             'email' => params["email"],
  23.             'tumblrName' => params["tumblrName"],
  24.             'inspiration' => params["inspiration"],
  25.             'designer' => params["designer"],
  26.             'webServices' => {
  27.                 'flickr' => params["flickr"],
  28.                 'lastfm' => params["lastfm"],
  29.                 'facebook' => params["facebook"]}}
  30.  
  31.         EmailRequest.deliver_notification(@request, "debug")
  32.         redirect_to SUCCESS_PAGE
  33.     end
  34.  
  35.     require 'basecamp'
  36.     def basecamp
  37.         @requestor = Request.new(
  38.             :name => params['name'],
  39.             :email => params['email'],
  40.             :email_confirmation => params['emailConfirm'],
  41.             :tumblrName => params["tumblrName"],
  42.             :inspiration => params["inspiration"],
  43.             :designer => params["designer"],
  44.             :webServices => params["webServices"],
  45.             :webServicesSelections => params["webServicesSelections"]
  46.         )
  47.        
  48.         if @requestor.valid?
  49.             #push_to_api(@requestor)
  50.             redirect_to SUCCESS_PAGE
  51.         else
  52.             redirect_to :back
  53.         end
  54.     end
  55. end
  56. ## app/models/email_request.rb
  57. class EmailRequest < ActionMailer::Base
  58.     def notification(request, debugval)
  59.         recipients  "paul@metalabdesign.com"
  60.         from        "tumblizee@tumblize.com"
  61.         subject     "New Tumblize Request"
  62.         body        :request => request, :debugval => debugval
  63.         content_type "text/html"
  64.     end
  65. end
  66. ## app/models/request.rb
  67. class Request < ActiveForm
  68.     # Only instance variables are necessary as we have no database
  69.     attr_accessor :name, :email, :email_confirmation, :tumblrName, :inspiration, :designer, :webServices, :webServicesSelections
  70.  
  71.     # The following are required fields
  72. #   validates_presence_of :name, :email, :email_confirmation, :tumblrName, :designer, :on => :create
  73.  
  74.     # A reasonable length name
  75. #   validates_length_of :name, :within => 5..100, :too_short => "just a bit more detail, please", :too_long => "oops. tmi.", :on => :create
  76.  
  77.     # Email should match confirmation, and be an valid e-mail address
  78. #   validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/, :message => "don't call us, we'll call you", :on => :create
  79. #   validates_confirmation_of :email, :message => "inspect, please", :on => :create
  80. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top