Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PublicController < ApplicationController
- # use the ReferralSource module
- include ReferralSource
- helper_method :referral_source
- def blog_post
- @sc.blog_post = BlogPost.find params[ :id ]
- # used by the side rail
- @sc.offer = @sc.blog_post.corporate_client.top_performing_offer
- @sc.ebook = @sc.blog_post.corporate_client.top_performing_ebook
- @sc.email_subscriber = EmailSubscriber.new
- # get the right source -- i.e. VisitPath or EngagementEngineProgression
- source = referral_source
- # add a visit_point if a VisitPath
- if source.visit?
- bpv = BlogPostVisit
- .create
- .property( "blog_post_id", params[ :id ] )
- .property( "blog_post_title", @sc.blog_post.latest_version.title )
- source.add_visit_node( bpv )
- end
- # add an engagement_engine_action if EngagementEngineProgression
- if source.eep?
- bpva = BlogPostVisitAction
- .create
- .property( "blog_post_id", params[ :id ] )
- .property( "blog_post_title", @sc.blog_post.latest_version.title )
- source.add_visit_node( bpva )
- end
- @sc.source = source.source_type
- @sc.source_id = source.source_id
- end
- def blog_post_index
- @sc.source = source
- @sc.blog_posts = BlogPost.approved( params[ :id ] )
- end
- def ebook_landing_page
- @sc.ebook = Ebook.find_by_id params[ :id ]
- @sc.prospect_info = ProspectInfo.new
- source = referral_source
- if source.visit?
- eblpv = EbookLandingPageVisit
- .create
- .property( 'ebook_title', @sc.ebook.name)
- .property( 'ebook_id', @sc.ebook.id )
- source.add_visit_node( eblpv )
- end
- if source.eep?
- eblpva = EbookLandingPageVisitAction
- .create
- .property( 'ebook_title', @sc.ebook.name )
- .property( 'ebook_id', @sc.ebook.id )
- source.add_visit_node( eblvpa )
- end
- @sc.source = source.source_type
- @sc.source_id = source.source_id
- end
- def ebook_landing_page_submitted
- # create the engagement engine progression with the prospect info
- eep = EngagementEngineProgression.create( prospect_info: ProspectInfo.create( params[ :prospect_info ] ) )
- # add the VisitPath if one exists( most likely )
- if params[ :source ] == "VisitPath"
- visit_path = VisitPath.find_by_id( params[ :source_id ] )
- eep.update_attributes( visit_path: visit_path )
- end
- # Add the landing page submitted
- eep.add_engagement_engine_action( EbookLandingPageSubmitted.create.property( "ebook_id", params[ :id ] ) )
- end
- def get_ebook
- # find the appropriate eep
- eep = EngagementEngineProgression.find_by_id( params[ :id ] )
- # find the appropriate ebook
- ebook = Ebook.find( eep.get_action( 'EbookLandingPageSubmitted' ).property( 'ebook_id' ) )
- # keep track of the ebook link being clicked
- eep.add_engagement_engine_action( EbookLinkClicked.create.property( "ebook_id", ebook.id ) )
- # present the ebook for prospect to save
- send_file "#{ ebook.pdf_asset_path }", :stream => true, :type => "application/pdf", :disposition => "attachment"
- end
- def get_offer
- # find the appropriate eep
- @sc.eep = EngagementEngineProgression.find_by_id( params[ :id ] )
- @sc.pitch_email = eep.get_action( 'SendOfferPitchEmail' )
- @sc.offer = Offer.find( pitch_email.id )
- @sc.landing_page_blueprint = @sc.offer.landing_page_blueprint
- @sc.prospect_form_blueprint = @sc.landing_page_blueprint.prospect_form_blueprint3
- end
- def source
- params[ :controller ]
- end
- end
Add Comment
Please, Sign In to add comment