Policy 1707 commit to LF
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / CSS / bootstrap / docs / _includes / js / alerts.html
1 <div class="bs-docs-section">
2   <h1 id="alerts" class="page-header">Alert messages <small>alert.js</small></h1>
3
4   <h2 id="alerts-examples">Example alerts</h2>
5   <p>Add dismiss functionality to all alert messages with this plugin.</p>
6   <p>When using a <code>.close</code> button, it must be the first child of the <code>.alert-dismissible</code> and no text content may come before it in the markup.</p>
7   <div class="bs-example bs-example-standalone" data-example-id="dismissible-alert-js">
8     <div class="alert alert-warning alert-dismissible fade in" role="alert">
9       <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
10       <strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
11     </div>
12
13     <div class="alert alert-danger alert-dismissible fade in" role="alert">
14       <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
15       <h4>Oh snap! You got an error!</h4>
16       <p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
17       <p>
18         <button type="button" class="btn btn-danger">Take this action</button>
19         <button type="button" class="btn btn-default">Or do this</button>
20       </p>
21     </div>
22   </div><!-- /example -->
23
24
25   <h2 id="alerts-usage">Usage</h2>
26
27   <p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality. Closing an alert removes it from the DOM.</p>
28
29 {% highlight html %}
30 <button type="button" class="close" data-dismiss="alert" aria-label="Close">
31   <span aria-hidden="true">&times;</span>
32 </button>
33 {% endhighlight %}
34
35   <p>To have your alerts use animation when closing, make sure they have the <code>.fade</code> and <code>.in</code> classes already applied to them.</p>
36
37   <h3 id="alerts-methods">Methods</h3>
38
39   <h4><code>$().alert()</code></h4>
40   <p>Makes an alert listen for click events on descendant elements which have the <code>data-dismiss="alert"</code> attribute. (Not necessary when using the data-api's auto-initialization.)</p>
41
42   <h4><code>$().alert('close')</code></h4>
43   <p>Closes an alert by removing it from the DOM. If the <code>.fade</code> and <code>.in</code> classes are present on the element, the alert will fade out before it is removed.</p>
44
45
46   <h3 id="alerts-events">Events</h3>
47   <p>Bootstrap's alert plugin exposes a few events for hooking into alert functionality.</p>
48   <div class="table-responsive">
49     <table class="table table-bordered table-striped bs-events-table">
50       <thead>
51         <tr>
52           <th>Event Type</th>
53           <th>Description</th>
54         </tr>
55       </thead>
56       <tbody>
57         <tr>
58           <td>close.bs.alert</td>
59           <td>This event fires immediately when the <code>close</code> instance method is called.</td>
60         </tr>
61         <tr>
62           <td>closed.bs.alert</td>
63           <td>This event is fired when the alert has been closed (will wait for CSS transitions to complete).</td>
64         </tr>
65       </tbody>
66     </table>
67   </div><!-- /.table-responsive -->
68 {% highlight js %}
69 $('#myAlert').on('closed.bs.alert', function () {
70   // do something…
71 })
72 {% endhighlight %}
73 </div>