mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-17 13:44:09 +00:00
Edit registration for admin
This commit is contained in:
parent
463430b3e8
commit
19b11a79ff
5 changed files with 113 additions and 2 deletions
|
|
@ -29,6 +29,30 @@ class Admin::RegistrationsController < ApplicationController
|
|||
flash[:notice] = "Updated '#{params[:view_field]}' for #{(Person.where("id = ?", @registration.person_id).first).email}"
|
||||
end
|
||||
|
||||
def edit
|
||||
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
||||
@person = Person.where("id = ?", @registration.person_id).first
|
||||
end
|
||||
|
||||
def update
|
||||
reg_id = params[:format]
|
||||
@registration = @conference.registrations.where("id = ?", reg_id).first
|
||||
@person = Person.where("id = ?", @registration.person_id).first
|
||||
begin
|
||||
@person.update_attributes!(params[:registration][:person_attributes])
|
||||
params[:registration].delete :person_attributes
|
||||
@registration.supporter_registration = @conference.supporter_registrations.new(params[:registration][:supporter_registration_attributes])
|
||||
params[:registration].delete :supporter_registration_attributes
|
||||
@registration.update_attributes!(params[:registration])
|
||||
flash[:notice] = "Successfully updated Registration for #{@person.public_name} #{@person.email}"
|
||||
redirect_to(admin_conference_registrations_path(@conference.short_title))
|
||||
rescue Exception => e
|
||||
Rails.logger.debug e.backtrace.join("\n")
|
||||
redirect_to(admin_conference_registrations_path(@conference.short_title), :alert => 'Failed to update registration:' + e.message)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if has_role?(current_user, "Admin")
|
||||
registration = @conference.registrations.where(:id => params[:id]).first
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue