Permalink
Browse files

Make notices dismissable.

  • Loading branch information...
toolstack authored and ocean90 committed Aug 16, 2017
1 parent 570a8ee commit 51724c339989dff120e13dac66d28bd143243784
Showing with 14 additions and 5 deletions.
  1. +11 −3 assets/css/style.css
  2. BIN assets/images/close.png
  3. +2 −1 assets/js/common.js
  4. +1 −1 gp-templates/header.php
View
@@ -454,23 +454,31 @@ span.morethan90 {
/*
* JavaScript, errors and notices.
*/
#gp-js-message {
.gp-js-message {
position: fixed;
top: 0;
padding: 0.5em;
padding: 1em;
display: none;
font-size: 85%;
z-index: 1001;
}
.gp-js-error, .error {
color: white;
background-color: red;
padding-right: 50px;
background-image: url( '../images/close.png' );
background-position: right center;
background-repeat: no-repeat;
background-size: 24px 24px;
}
.gp-js-notice, .notice {
color: #222;
background-color: #FDDF9D;
background-image: url( '../images/close.png' );
background-position: right center;
background-repeat: no-repeat;
background-size: 24px 24px;
}
.gp-js-success {
View
Binary file not shown.
View
@@ -3,6 +3,7 @@ var $gp = function($) { return {
element: null,
init: function() {
$gp.notices.element = $('#gp-js-message');
$gp.notices.element.on( 'click', $gp.notices.clear );
},
error: function(message) {
$gp.notices.generic_message('gp-js-error', message);
@@ -19,7 +20,7 @@ var $gp = function($) { return {
},
generic_message: function(css_class, message) {
// TODO: add close button, at least to errors
$gp.notices.element.removeClass().addClass(css_class).html(message);
$gp.notices.element.removeClass().addClass('gp-js-message').addClass(css_class).html(message);
$gp.notices.center();
$gp.notices.element.show();
},
View
@@ -42,7 +42,7 @@
<div class="gp-content">
<?php echo gp_breadcrumb(); ?>
<div id="gp-js-message"></div>
<div id="gp-js-message" class="gp-js-message"></div>
<?php if (gp_notice('error')): ?>
<div class="error">

0 comments on commit 51724c3

Please sign in to comment.