Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
function deleteFavorite(url,id) { Element.show('systemWorking'); var pars = '&id='+id; var myAjax = new Ajax.Request(url, { method: 'post', parameters: pars, evalScripts: true, onComplete: afterStatus }); } function afterStatus(request,json) { Element.hide('systemWorking'); if(json.status == 'success') { $('item_'+json.id).innerHTML=''; } if (json.flash && $('flash')) { $('flash').innerHTML = json.flash; var className = (json.flashClass) ? json.flashClass : 'warning'; $('flash').className = 'flash '+className; $('flash').style.display = ''; if(!json.scroll) { scrollTo($('flash')); } } if(json.status == 'redirect') { window.location=json.url; } } public function executeJson(AgaviRequestDataHolder $rd) { if ($this->flash->hasFlash()) { $flash = $this->flash->read(); } $response = $this->getResponse(); $response->setHttpHeader('X-JSON', json_encode( array( 'status' => 'success', 'updated' => 'assessmentForm', 'scroll' => false, 'highlight' => true, 'flash' => $flash[0], 'flashClass' => $flash[1], 'id' => $rd->getParameter('id') ) ) ); $this->clearLayers(); return; }
This paste will be private.
From the Design Piracy series on my blog: