Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
5a9e077e
Verified
Commit
5a9e077e
authored
Feb 01, 2018
by
Kaspar Vollenweider
👻
Browse files
fix notification allert thing and start with helper
parent
1c558cdb
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/controllers/clients_controller.rb
View file @
5a9e077e
...
...
@@ -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
...
...
app/helpers/notification_helper.rb
0 → 100644
View file @
5a9e077e
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
(
'×'
,
aria:
{
hidden:
'true'
})
end
end
end
end
app/views/application/_notification.html.slim
View file @
5a9e077e
-
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'
×
=
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
app/views/application/_notification_alert_with_action.html.slim
0 → 100644
View file @
5a9e077e
.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'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment