Skip to content

Commit 7b53984

Browse files
Resolved #282 - Create an Alert system to show alerts on UI for MVC applications
1 parent 8304bd0 commit 7b53984

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/AbpCompanyName.AbpProjectName.WebMpa/Views/Shared/_Layout.cshtml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
@using System.Threading
22
@using System.Web.Optimization
33
@using Abp.Timing
4+
@using Abp.Dependency
5+
@using Abp.Web.Mvc.Alerts
46
@{
57
SetAntiForgeryCookie();
8+
AlertList alerts = null;
9+
IocManager.Instance.Using<IAlertManager>(alertManager => alerts = alertManager.Alerts);
610
}
711
<!DOCTYPE html>
812
<html lang="en">
@@ -41,6 +45,24 @@
4145
@Html.Partial("_TopBar")
4246

4347
<div class="container">
48+
@if (alerts.Any())
49+
{
50+
<div id="AbpPageAlerts">
51+
@foreach (var alertMessage in alerts)
52+
{
53+
<div class="alert [email protected]().ToLower() @(alertMessage.Dismissible ? "alert-dismisable" : "")" role="alert">
54+
<h4 class="alert-heading">
55+
@alertMessage.Title
56+
@if (alertMessage.Dismissible)
57+
{
58+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
59+
}
60+
</h4>
61+
<p>@alertMessage.Text</p>
62+
</div>
63+
}
64+
</div>
65+
}
4466
@RenderBody()
4567
</div>
4668

0 commit comments

Comments
 (0)