ControllerModal gets method for displaying inline alerts

This commit is contained in:
Mantas 2019-01-30 13:53:46 +02:00 committed by Martin Edenhofer
parent 0b472fae67
commit 8d84bbb0a6
3 changed files with 16 additions and 0 deletions

View file

@ -602,6 +602,16 @@ class App.ControllerModal extends App.Controller
return @formParam(@container.find('.modal form'))
return @formParam(@$('.modal form'))
showAlert: (message, suffix = 'danger') ->
alert = $('<div>')
.addClass("alert alert--#{suffix}")
.text(message)
@$('.modal-alerts-container').html(alert)
clearAlerts: ->
@$('.modal-alerts-container').empty()
localOnShow: (e) =>
@onShow(e)
@ -650,6 +660,7 @@ class App.ControllerModal extends App.Controller
submit: (e) =>
e.stopPropagation()
e.preventDefault()
@clearAlerts()
@onSubmit(e)
class App.SessionMessage extends App.ControllerModal

View file

@ -11,6 +11,7 @@
<h1 class="modal-title"><% if @headPrefix: %><%- @T(@headPrefix) %>: <% end %><%- @T(@head) %></h1>
<% end %>
</div>
<div class="modal-alerts-container"></div>
<div class="modal-body">
<%- @content %>
</div>

View file

@ -6516,6 +6516,10 @@ footer {
opacity: 0.18;
}
.modal-alerts-container {
padding: 0 23px;
}
.modal-body {
padding: 0 23px;