From 8d84bbb0a6b11566cc81ffdf791ff9854c0ed828 Mon Sep 17 00:00:00 2001 From: Mantas Date: Wed, 30 Jan 2019 13:53:46 +0200 Subject: [PATCH] ControllerModal gets method for displaying inline alerts --- .../app/controllers/_application_controller.coffee | 11 +++++++++++ app/assets/javascripts/app/views/modal.jst.eco | 1 + app/assets/stylesheets/zammad.scss | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index eb08b8509..f8fcd6092 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -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 = $('
') + .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 diff --git a/app/assets/javascripts/app/views/modal.jst.eco b/app/assets/javascripts/app/views/modal.jst.eco index 840f2c27e..23bae4881 100644 --- a/app/assets/javascripts/app/views/modal.jst.eco +++ b/app/assets/javascripts/app/views/modal.jst.eco @@ -11,6 +11,7 @@

<% if @headPrefix: %><%- @T(@headPrefix) %>: <% end %><%- @T(@head) %>

<% end %>
+ diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index d392b8b77..80785e223 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -6516,6 +6516,10 @@ footer { opacity: 0.18; } + .modal-alerts-container { + padding: 0 23px; + } + .modal-body { padding: 0 23px;