Permalink
Browse files

Flashing in exceptions too

  • Loading branch information...
1 parent 4bb9676 commit c75e6f716a477857e59752c4898430a1b94ffe4a @Artazor Artazor committed May 25, 2012
Showing with 22 additions and 4 deletions.
  1. +14 −4 common/application/flash.js
  2. +4 −0 common/application/flash.less
  3. +4 −0 exception/view.php
@@ -1,7 +1,7 @@
$this.flash = function(d) {
if(d.type != 'debug') {
var color = ({info:'#CEF',error:'#F44',warning:'#FF0'})[d.type] || '#FFF';
- $('<li>').hide().text(d.message).appendTo($this)
+ $('<li>').hide().html(d.message).appendTo($this)
.fadeIn(200)
.delay(1000)
.animate({backgroundColor:color})
@@ -17,13 +17,23 @@ $this.flash = function(d) {
}
}
+o.flash = function(message,type){
+ $this.flash({type:type,message:message});
+}
+
$this.updateFlash = function () {
$this.remote('getFlash', function(err,data){
var clear = false;
- _.each(data,function(d){
+ if(err) {
+ $this.flash({message:err,type:'error'});
clear = true;
- $this.flash(d);
- });
+ } else {
+ _.each(data,function(d){
+ clear = true;
+ $this.flash(d);
+ });
+ }
+
if(clear) $this.remote('clearFlash',function(){}, false);
}, false);
}
@@ -1,4 +1,5 @@
position: absolute;
+z-index: 999;
left: 35%;
width: 300px;
@@ -11,4 +12,7 @@ width: 300px;
border-radius: 8px;
box-shadow: 3px 3px 10px #444;
border: 3px solid #DCB;
+ font-family: sans-serif;
+ font-size: 13px;
+ line-height: 1.3em;
}
View
@@ -1,4 +1,8 @@
<div class="<?=$this->getTemplateClass()?>">
+<pre style="width:400px;font-size:10px">
+<?print_r($this->scope->SESSION->get('oxygen-flash-messages',array()));
+$this->scope->SESSION['oxygen-flash-messages']=array()?>
+</pre>
<h1>Exception: <?=$this->getName()?></h1>
<?$this->put_details()?>
<?$this->put_stack_trace()?>

0 comments on commit c75e6f7

Please sign in to comment.