Skip to content

Commit

Permalink
Flashing in exceptions too
Browse files Browse the repository at this point in the history
  • Loading branch information
Artazor committed May 25, 2012
1 parent 4bb9676 commit c75e6f7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
18 changes: 14 additions & 4 deletions common/application/flash.js
Original file line number Diff line number Diff line change
@@ -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})
Expand All @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions common/application/flash.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
position: absolute;
z-index: 999;
left: 35%;
width: 300px;

Expand All @@ -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;
}
4 changes: 4 additions & 0 deletions exception/view.php
Original file line number Diff line number Diff line change
@@ -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()?>
Expand Down

0 comments on commit c75e6f7

Please sign in to comment.