Verified Commit 4a1f7235 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider
Browse files

fix update special form notice

parent 2a318f17
......@@ -62,7 +62,10 @@ class ClientsController < ApplicationController
if @client.save
redirect_to @client, create_update_redirect_notice
else
@custom_notice = resigned_fail_notice if @client.errors.messages[:acceptance].present?
if @client.errors.messages[:acceptance].present?
@custom_notice = resigned_fail_notice.stringify_keys
@custom_notice['action_link'].stringify_keys!
end
render :edit
end
end
......@@ -78,6 +81,16 @@ class ClientsController < ApplicationController
private
end
def create_update_redirect_notice
if @client.saved_change_to_acceptance?(to: :resigned)
{ notice: 'Klient/in wurde erfolgreich beendet.' }
else
make_notice
end
end
def resigned_fail_notice
{
message: 'Beenden fehlgeschlagen.', model_message: @client.errors.messages[:acceptance].first,
......@@ -95,14 +108,6 @@ class ClientsController < ApplicationController
end
end
def create_update_redirect_notice
if @client.saved_change_to_acceptance?(to: 'resigned')
{ notice: 'Klient/in wurde erfolgreich beendet.' }
else
make_notice
end
end
def set_client
@client = Client.find(params[:id])
authorize @client
......
- if notice.present? || alert.present? || @custom_notice.present?
- notice = @custom_notice.stringify_keys if @custom_notice.present?
- notice['action_link'].stringify_keys! if @custom_notice[:action_link].present?
- notice = @custom_notice if @custom_notice.present?
- if notice.is_a? String
.alert.alert-warning.alert-dismissible role='alert'
button.close aria-label='Close' data-dismiss='alert' type='button'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment