# -*- encoding : utf-8 -*-
class SurveyMails < ActionMailer::Base
  layout 'mail2'
  
  default from: "Jipe <contact@jipe.fr>"
  
  
  def thanks(survey_set, options = {})
    @options = options
    @survey_set = survey_set
    
    @social_url = SurveyType::SOCIAL_URL
    @title = SurveyType::FACEBOOK_TITLE
    @description = SurveyType::DESCRIPTION
    @facebook_desc = SurveyType::FACEBOOK_DESC
    @twitter_desc = SurveyType::TWITTER_DESC
    
    
    item = @survey_set.survey_type.items.find_by_slug("email")
    @email = @survey_set.question_sets.find_by_survey_item_id(item.id).content.to_s
    
    item = @survey_set.survey_type.items.find_by_slug("civilite")
    @civilite = @survey_set.question_sets.find_by_survey_item_id(item.id).content.to_s
    
    item = @survey_set.survey_type.items.find_by_slug("nom")
    @nom = @survey_set.question_sets.find_by_survey_item_id(item.id).content.to_s
    
    item = @survey_set.survey_type.items.find_by_slug("prenom")
    @prenom = @survey_set.question_sets.find_by_survey_item_id(item.id).content.to_s
    
    
    
    mail(:to => @email, :subject => "Merci pour votre participation")
    
      
  end


  
  
  
end
