Verified Commit 5a9e077e authored by Kaspar Vollenweider's avatar Kaspar Vollenweider
Browse files

fix notification allert thing and start with helper

parent 1c558cdb
......@@ -58,10 +58,7 @@ class ClientsController < ApplicationController
if @client.save
redirect_to @client, create_update_redirect_notice
else
if @client.errors.messages[:acceptance].present?
@custom_notice = resigned_fail_notice.stringify_keys
@custom_notice['action_link'].stringify_keys!
end
@custom_notice = resigned_fail_notice if @client.errors.messages[:acceptance].present?
render :edit
end
end
......
module NotificationHelper
def notification_warning_bubble(text)
tag.div(class: 'alert alert-warning alert-dismissible', role: 'alert') do
concat notification_close_button
concat text
end
end
def notification_close_button(text = nil)
tag.button(
class: 'close', aria: { label: 'Schliessen' }, data: { dismiss: 'alert' }, type: 'button'
) do
if text.present?
concat text
else
tag.span('&times;', aria: { hidden: 'true' })
end
end
end
end
- if notice.present? || alert.present? || @custom_notice.present?
- notice = @custom_notice if @custom_notice.present?
- if alert.present?
= notification_warning_bubble(alert)
- elsif notice.present?
- if notice.is_a? String
.alert.alert-warning.alert-dismissible role='alert'
button.close aria-label='Close' data-dismiss='alert' type='button'
span aria-hidden='true' &times;
= notice || alert
= notification_warning_bubble(notice)
- elsif notice.is_a? Hash
.alert.alert-danger.alert-dismissible role='alert'
button.close aria-label='Close' data-dismiss='alert' type='button' X
h4= notice['message']
- if notice['model_message'].present?
p= notice['model_message']
p
button.btn.btn-default.m-r-10 aria-label='Close' data-dismiss='alert' type='button' Abbrechen
- if notice['action_link'].present?
= link_to(notice['action_link']['text'], notice['action_link']['path'], target: '_blank', class: 'btn btn-default')
= render 'notification_alert_with_action', notice: notice
- elsif @custom_notice.present?
- @custom_notice[:action_link].stringify_keys!
= render 'notification_alert_with_action', notice: @custom_notice.stringify_keys
.alert.alert-danger.alert-dismissible role='alert'
= notification_close_button
h4= notice['message']
- if notice['model_message'].present?
p= notice['model_message']
p
= notification_close_button('Abbrechen')
- if notice['action_link'].present?
= link_to(notice['action_link']['text'], notice['action_link']['path'], target: '_blank', class: 'btn btn-default')
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