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
|
|
@ -20,8 +20,8 @@ module Admin
|
|||
def create
|
||||
@track = @program.tracks.new(track_params)
|
||||
if @track.save
|
||||
flash[:notice] = 'Track successfully created.'
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully created.')
|
||||
else
|
||||
flash[:error] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
|
|
@ -32,8 +32,8 @@ module Admin
|
|||
|
||||
def update
|
||||
if @track.update_attributes(track_params)
|
||||
flash[:notice] = 'Track successfully updated.'
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully updated.')
|
||||
else
|
||||
flash[:error] = "Track update failed: #{@track.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
|
|
@ -42,11 +42,11 @@ module Admin
|
|||
|
||||
def destroy
|
||||
if @track.destroy
|
||||
flash[:notice] = 'Track successfully deleted.'
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully deleted.')
|
||||
else
|
||||
flash[:error] = "Track couldn't be deleted. #{@track.errors.full_messages.join('. ')}."
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
||||
error: "Track couldn't be deleted. #{@track.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue