Skip to content

Commit

Permalink
Added per-paragraph form url + page connection
Browse files Browse the repository at this point in the history
Conflicts:

	app/controllers/editor/auth_renderer.rb
  • Loading branch information
cykod committed Oct 15, 2010
1 parent ac5a6e1 commit f20fdc7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/editor/auth_controller.rb
Expand Up @@ -22,7 +22,7 @@ class Editor::AuthController < ParagraphController #:nodoc:all
editor_for :missing_password, :name => 'Missing Password', :triggers => [ ['Sent Email','action']], :features => ['missing_password']


editor_for :email_list, :name => 'Email List Signup', :triggers => [ ['Signed Up','action']], :features => ['email_list']
editor_for :email_list, :name => 'Email List Signup', :triggers => [ ['Signed Up','action']], :features => ['email_list'], :inputs => [ [:source,"Source URL",:path ]]
editor_for :splash, :name => 'Splash Page'
editor_for :view_account, :name => 'View Account', :no_options => true

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/editor/auth_feature.rb
Expand Up @@ -440,7 +440,7 @@ def enter_vip_feature(data)

def email_list_feature(data)
webiva_feature(:email_list,data) do |c|
c.form_for_tag('form','email_list_signup') { !data[:submitted] ? data[:email_list] : nil }
c.form_for_tag('form',"email_list_#{paragraph.id}") { !data[:submitted] ? data[:email_list] : nil }

c.define_form_error_tag('form:errors')

Expand Down
10 changes: 7 additions & 3 deletions app/controllers/editor/auth_renderer.rb
Expand Up @@ -670,8 +670,8 @@ def missing_password
def email_list
@options = paragraph_options(:email_list)

@user = EmailListUser.new(params[:email_list_signup])
if (request.post? || params[:get_post]) && params[:email_list_signup]
@user = EmailListUser.new(params["email_list_#{paragraph.id}"] || params[:email_list_signup])
if (request.post? || params[:get_post]) && (params["email_list_#{paragraph.id}"] || params[:email_list_signup])
@user.valid?

unless @options.partial_post == 'yes' && params[:partial_post]
Expand All @@ -685,9 +685,13 @@ def email_list
if !@target.registered?
@target.first_name = @user.first_name if !@user.first_name.blank? && @options.first_name != 'off'
@target.last_name = @user.last_name if !@user.last_name.blank? && @options.last_name != 'off'
@target.lead_source = @options.user_source unless @options.user_source.blank?
@target.source = 'website'
@target.user_level = 4
if @target.lead_source.blank?
conn_type,conn_id = page_connection
@target.lead_source = conn_id if conn_type == :source
@target.lead_source = @options.user_source if @target.lead_source.blank?
end
@target.save
if @options.zip != 'off'
adr = @target.address || EndUserAddress.new
Expand Down

0 comments on commit f20fdc7

Please sign in to comment.