ControllerModal gets method for displaying inline alerts
This commit is contained in:
parent
0b472fae67
commit
8d84bbb0a6
3 changed files with 16 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -6516,6 +6516,10 @@ footer {
|
|||
opacity: 0.18;
|
||||
}
|
||||
|
||||
.modal-alerts-container {
|
||||
padding: 0 23px;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 0 23px;
|
||||
|
||||
|
|
Loading…
Reference in a new issue