cirandas.net

ref: master

plugins/escambo/controllers/myprofile/escambo_plugin_myprofile_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class EscamboPluginMyprofileController < MyProfileController

  def select_active_organization
    load_active_organization params[:profile_id]
  end

  def new_enterprise
    params[:enterprise_data] ||= {}
    @enterprise = Enterprise.new params[:enterprise_data].merge(:environment => environment)
    if request.post?
      @enterprise.identifier = @enterprise.name.to_slug
      if @enterprise.save
        @enterprise.add_admin profile
        redirect_to @enterprise.url
      end
    end
  end

  def add_member
    @roles = environment.roles.where(:key => 'profile_admin')
  end

end