mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-18 14:11:10 +00:00
Refactoring venue
This commit is contained in:
parent
c0cdf3e6e5
commit
9d08f52636
13 changed files with 108 additions and 57 deletions
|
|
@ -1,27 +0,0 @@
|
|||
module Admin
|
||||
class VenueController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :venue, through: :conference, singleton: true
|
||||
|
||||
def index; end
|
||||
|
||||
def update
|
||||
@venue = @conference.venue
|
||||
@venue.assign_attributes(params[:venue])
|
||||
send_mail = @venue.venue_notify?(@conference)
|
||||
if @venue.update_attributes(params[:venue])
|
||||
Mailbot.delay.send_email_on_venue_update(@conference) if send_mail
|
||||
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
|
||||
notice: 'Venue was successfully updated.')
|
||||
else
|
||||
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
|
||||
notice: 'Venue Updation Failed!')
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@venue = @conference.venue
|
||||
render :venue_info
|
||||
end
|
||||
end
|
||||
end
|
||||
18
app/controllers/admin/venues_controller.rb
Normal file
18
app/controllers/admin/venues_controller.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
module Admin
|
||||
class VenuesController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :venue, through: :conference, singleton: true
|
||||
|
||||
def edit; end
|
||||
|
||||
def update
|
||||
if @venue.update_attributes(params[:venue])
|
||||
redirect_to(edit_admin_conference_venue_path(conference_id: @conference.short_title),
|
||||
notice: 'Venue was successfully updated.')
|
||||
else
|
||||
flash[:error] = "Update venue failed: #{@venue.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue