cirandas.net

ref: master

app/helpers/memberships_helper.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
module MembershipsHelper

  def join_community_button options={:logged => false}
    url = options[:logged] ? profile.join_url : profile.join_not_logged_url

    if show_confirmation_modal? profile
      modal_button :add, _('Join this community'), url, class: 'join-community'
    elsif !options[:logged]
      modal_button :add, _('Join this community'), url, class: 'join-community'
    else
      button :add, _('Join this community'), url, class: 'join-community'
    end
  end

  def show_confirmation_modal? profile
    profile.requires_email? && current_person && !current_person.public_fields.include?("email")
  end

end