id = dom_id(@lead) if params[:cancel].true? # <----------------- Hide [Edit Campaign] if called_from_landing_page? page.call "crm.flip_form", :edit_lead page.call "crm.set_title", :edit_lead, @lead.full_name else # Called from leads list item... page[id].replace :partial => "lead", :collection => [ @lead ] end else # <---------------------------------------- Show [Edit Campaign] form. if params[:cancel].blank? # Called from leads list item... if @previous # Hide open [Edit Lead] form if any. if @previous.is_a?(Lead) page[dom_id(@previous)].replace :partial => "lead", :collection => [ @previous ] else page.call "crm.flick", "lead_#{@previous}", :remove end end page.call "crm.highlight_off", id # Disable onMouseOver for the list item. page.call "crm.hide_form", :create_lead # Hide [Create Lead] form if any. page[id].replace_html :partial => "edit" # Show [Edit Lead] form. page.call "crm.init_chosen_fields" elsif params[:cancel].false? # Called from title of the lead landing page... page[:edit_lead].replace_html :partial => "edit" page.call "crm.init_chosen_fields" unless %w(converted rejected).include? @lead.status page.call "crm.hide_form", :convert_lead end page.call "crm.flip_form", :edit_lead page.call "crm.set_title", :edit_lead, "#{t :edit} #{@lead.full_name}" end page[:lead_first_name].focus end