Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% if type == 'standard' %}
- <div id='{{alertid}}' class="alert alert-{{ alertclass }} alert-dismissible" role="alert" style="">
- <span onclick="cciwDismissibleAlert()" type="button" class="close" data-dismiss="alert" aria-label="Close"><span
- aria-hidden="true">×</span></span>
- <strong>{{ title }}</strong>
- <p>{{ message }}</p>
- </div>
- <script>
- $(document).ready(function () {
- var alerted = localStorage.getItem('{{alertid}}') || '';
- // hide the alert if a keyvalue pair of alertid,dismissed is found in local storage
- if (alerted == 'dismissed') {
- $('#{{alertid}}').toggle();
- }
- });
- function cciwDismissibleAlert() {
- localStorage.setItem("{{alertid}}", "dismissed");
- }
- </script>
- {% elseif type == 'modal' %}
- <!-- Modal -->
- <div class="modal" id="CCIWModal" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title">{{ title }}</h4>
- </div>
- <div class="modal-body">
- {{ message }}
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">Dismiss Notification</button>
- </div>
- </div>
- </div>
- </div>
- {% javascript %}
- $(document).ready(function() {
- var storageItemID = '{{alertid}}';
- // if the modal has not been previously dismissed display it
- if(localStorage.getItem('{{alertid}}') != 'dismiss'){
- //https://getbootstrap.com/docs/4.0/components/modal/#via-javascript
- $("#CCIWModal").modal();
- }
- $('#CCIWModal button').click(function(e) // if the close or dismiss button are clicked
- {
- // remember they dismissed an alert with the specified id
- localStorage.setItem('{{alertid}}' ,'dismiss')
- });
- });
- {% endjavascript %}
- {% else %}
- Please specify either 'standard' or 'modal' in the type parameter for this lava shortcode
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement