mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add flash type error.Rewrite controllers to use common flash style with redirect_to
This commit is contained in:
parent
dcdceb7c6d
commit
434eb90b76
16 changed files with 81 additions and 85 deletions
|
|
@ -15,8 +15,8 @@ module Admin
|
|||
def create
|
||||
@room = @venue.rooms.new(room_params)
|
||||
if @room.save
|
||||
flash[:notice] = 'Room successfully created.'
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title),
|
||||
notice: 'Room successfully created.')
|
||||
else
|
||||
flash[:error] = "Creating Room failed: #{@room.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
|
|
@ -25,8 +25,8 @@ module Admin
|
|||
|
||||
def update
|
||||
if @room.update_attributes(room_params)
|
||||
flash[:notice] = 'Room successfully updated.'
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title),
|
||||
notice: 'Room successfully updated.')
|
||||
else
|
||||
flash[:error] = "Update Room failed: #{@room.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
|
|
@ -35,11 +35,11 @@ module Admin
|
|||
|
||||
def destroy
|
||||
if @room.destroy
|
||||
flash[:notice] = 'Room successfully deleted.'
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title),
|
||||
notice: 'Room successfully deleted.')
|
||||
else
|
||||
flash[:error] = "Destroying room failed! #{@room.errors.full_messages.join('. ')}."
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title),
|
||||
error: "Destroying room failed! #{@room.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue