Merge branch 'master' into user_openid_management
This commit is contained in:
commit
2e922650a7
22 changed files with 426 additions and 30 deletions
|
|
@ -76,7 +76,7 @@ module Admin
|
|||
|
||||
def create
|
||||
@conference = Conference.new(conference_params)
|
||||
|
||||
@conference.organization = Organization.find_or_create_by(name: 'organization')
|
||||
if @conference.save
|
||||
# user that creates the conference becomes organizer of that conference
|
||||
current_user.add_role :organizer, @conference
|
||||
|
|
@ -211,7 +211,7 @@ module Admin
|
|||
:vpositions_attributes, :use_volunteers, :color,
|
||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||
:targets, :targets_attributes,
|
||||
:campaigns, :campaigns_attributes, :registration_limit)
|
||||
:campaigns, :campaigns_attributes, :registration_limit, :organization_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
52
app/controllers/admin/organizations_controller.rb
Normal file
52
app/controllers/admin/organizations_controller.rb
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
module Admin
|
||||
class OrganizationsController < Admin::BaseController
|
||||
load_and_authorize_resource :organization
|
||||
|
||||
def index
|
||||
@organizations = Organization.all
|
||||
end
|
||||
|
||||
def create
|
||||
@organization = Organization.new(organization_params)
|
||||
if @organization.save
|
||||
redirect_to admin_organizations_path,
|
||||
notice: 'Organization successfully created'
|
||||
else
|
||||
redirect_to new_admin_organization_path,
|
||||
error: @organization.errors.full_messages.join(', ')
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@organization = Organization.new
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def update
|
||||
if @organization.update_attributes(organization_params)
|
||||
redirect_to admin_organizations_path,
|
||||
notice: 'Organization successfully updated'
|
||||
else
|
||||
redirect_to edit_admin_organization_path(@organization),
|
||||
error: @organization.errors.full_messages.join(', ')
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @organization.destroy
|
||||
redirect_to admin_organizations_path,
|
||||
notice: 'Organization successfully destroyed'
|
||||
else
|
||||
redirect_to admin_organizations_path,
|
||||
error: 'Organization cannot be destroyed'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def organization_params
|
||||
params.require(:organization).permit(:name, :description, :picture)
|
||||
end
|
||||
end
|
||||
end
|
||||
7
app/controllers/organizations_controller.rb
Normal file
7
app/controllers/organizations_controller.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class OrganizationsController < ApplicationController
|
||||
load_and_authorize_resource :organization
|
||||
|
||||
def index
|
||||
@organizations = Organization.all
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue