Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SendController < ApplicationController
- before_filter :set_user, :set_nav
- stage do |steps|
- steps.send_choice do
- long_name "Send Choice"
- data do
- column :how, :type => :string, :default => "for_me"
- column :disclaimer_agree, :type => :boolean
- validates_presence_of :how, :disclaimer_agree, :message => "Please select agree or disagree on disclaimer"
- validates_acceptance_of :disclaimer_agree
- end
- forward do
- @current_object = @step.data.new(params[:current_object])
- { :id => :review_apps } if @current_object.how == "print"
- end
- end
- steps.request_ssn do
- long_name "Request SSN"
- data do
- column :ssn, :type => :string
- validates_presence_of :ssn
- end
- end
- steps.review_apps do
- long_name "Review Applications"
- data do
- column :choice, :type => :string
- validates_presence_of :choice, :message => "Please make a choice"
- end
- before :show do
- puts @current_object.choice
- @form_notes = @user.form_notes
- # generate = params[:id]
- pdfer = PdfManager.new(@user)
- for note in @form_notes
- data = pdfer.remote_call(note.form_id)
- remote = ActionWebService::Client::XmlRpc.new(PdfWriterApi, PDF_WEBSERVICE)
- logger.debug("Sending data: #{data}")
- file = remote.create_pdf_for_form(data)
- logger.debug("Received: #{file}")
- note.update_attribute('file', file)
- end
- end
- forward do
- @current_object = @step.data.new(params[:current_object])
- "/account/edit_info" if @current_object.choice == "yes"
- end
- end
- steps.request_email do
- long_name "Request Email"
- data do
- column :email_address, :type => :string
- validates_presence_of :email_address
- validates_format_of :email_address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
- validates_confirmation_of :email_address, :message => "should match confirmation"
- end
- end
- steps.thank_you do
- long_name "Thank You!"
- end
- end
- private
- def set_nav
- @step_number = 3
- @nc.continue_form = true
- unless @step.nil?
- @nc.back_link(controller_name, 'show', @step.back_url[:id])
- @nc.continue_link(controller_name, 'show', @step.forward_url[:id])
- end
- end
- end
Add Comment
Please, Sign In to add comment