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(@container.find('.modal form'))
|
||||||
return @formParam(@$('.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) =>
|
localOnShow: (e) =>
|
||||||
@onShow(e)
|
@onShow(e)
|
||||||
|
|
||||||
|
@ -650,6 +660,7 @@ class App.ControllerModal extends App.Controller
|
||||||
submit: (e) =>
|
submit: (e) =>
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@clearAlerts()
|
||||||
@onSubmit(e)
|
@onSubmit(e)
|
||||||
|
|
||||||
class App.SessionMessage extends App.ControllerModal
|
class App.SessionMessage extends App.ControllerModal
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<h1 class="modal-title"><% if @headPrefix: %><%- @T(@headPrefix) %>: <% end %><%- @T(@head) %></h1>
|
<h1 class="modal-title"><% if @headPrefix: %><%- @T(@headPrefix) %>: <% end %><%- @T(@head) %></h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-alerts-container"></div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<%- @content %>
|
<%- @content %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6516,6 +6516,10 @@ footer {
|
||||||
opacity: 0.18;
|
opacity: 0.18;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-alerts-container {
|
||||||
|
padding: 0 23px;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-body {
|
.modal-body {
|
||||||
padding: 0 23px;
|
padding: 0 23px;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue