Permalink
Browse files

ControllerModal gets method for displaying inline alerts

  • Loading branch information...
mantas authored and znuny-robo committed Jan 30, 2019
1 parent 0b472fa commit 8d84bbb0a6b11566cc81ffdf791ff9854c0ed828
@@ -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;

0 comments on commit 8d84bbb

Please sign in to comment.