mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-14 04:04:03 +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
|
|
@ -12,8 +12,8 @@ module Admin
|
|||
@campaign.attributes = campaign_params
|
||||
|
||||
if @conference.save
|
||||
flash[:notice] = 'Campaign successfully created.'
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
notice: 'Campaign successfully created.')
|
||||
else
|
||||
flash[:error] = 'Campaign creation failed. ' + @campaign.errors.full_messages.to_sentence
|
||||
render action: 'new'
|
||||
|
|
@ -26,8 +26,8 @@ module Admin
|
|||
|
||||
def update
|
||||
if @campaign.update_attributes(campaign_params)
|
||||
flash[:notice] = "Campaign '#{@campaign.name}' successfully updated."
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
notice: "Campaign '#{@campaign.name}' successfully updated.")
|
||||
else
|
||||
flash[:error] = "Campaign update failed. #{@campaign.errors.full_messages.to_sentence}"
|
||||
render action: 'edit'
|
||||
|
|
@ -36,12 +36,12 @@ module Admin
|
|||
|
||||
def destroy
|
||||
if @campaign.destroy
|
||||
flash[:notice] = "Campaign '#{@campaign.name}' successfully deleted."
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
notice: "Campaign '#{@campaign.name}' successfully deleted.")
|
||||
else
|
||||
flash[:error] = "Delete of Campaign for #{@conference.short_title} failed." \
|
||||
"#{@campaign.errors.full_messages.join('. ')}."
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||
error: "Delete of Campaign for #{@conference.short_title} failed."\
|
||||
"#{@campaign.errors.full_messages.join('. ')}.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue