Class: Gluttonberg::Public::MembersController

Inherits:
BaseController show all
Defined in:
app/controllers/gluttonberg/public/members_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#locale, #page

Instance Method Summary collapse

Instance Method Details

#confirmObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 34

def confirm
  @member = Member.where(:confirmation_key => params[:key]).first
  if @member
    @member.profile_confirmed = true
    @member.save
    flash[:notice] = "Your registration is now complete."
    redirect_to root_path
  else
    flash[:notice] = "We're sorry, but we could not locate your account. " +
    "If you are having issues try copying and pasting the URL " +
    "from your email into your browser."
    redirect_to root_path
  end
end

#createObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 17

def create
  @member = Member.new(params[:gluttonberg_member])
  if @member && @member.save
    if Member.does_email_verification_required
      MemberNotifier.confirmation_instructions(@member.id,current_localization_slug).deliver
      flash[:notice] = "Please check your email for a confirmation."
    else
      flash[:notice] = "Your registration is now complete."
    end
    redirect_to root_path
  else
    @page_title = "Register"
    render :new
  end
end

#editObject



78
79
80
81
82
83
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 78

def edit
  @member = current_member
  respond_to do |format|
    format.html
  end
end

#newObject



9
10
11
12
13
14
15
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 9

def new
  @page_title = "Register"
  @member = Member.new
  respond_to do |format|
    format.html
  end
end

#resend_confirmationObject



49
50
51
52
53
54
55
56
57
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 49

def resend_confirmation
  if current_member.confirmation_key.blank?
    current_member.generate_confirmation_key
    current_member.save
  end
  MemberNotifier.confirmation_instructions(current_member.id,current_localization_slug).deliver if current_member && !current_member.profile_confirmed
  flash[:notice] = "Please check your email for a confirmation."
  redirect_to member_profile_path
end

#showObject



71
72
73
74
75
76
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 71

def show
  @member = current_member
  respond_to do |format|
    format.html
  end
end

#updateObject



59
60
61
62
63
64
65
66
67
68
69
# File 'app/controllers/gluttonberg/public/members_controller.rb', line 59

def update
  @member = current_member
  if @member.update_attributes(params[:gluttonberg_member])
    @member.save
    if params[:gluttonberg_member][:return_url]
      redirect_to params[:gluttonberg_member][:return_url]
    else
      redirect_to root_path
    end
  end
end