[Bese-devel] ucw-core + ajax + jQuery

burban at opopop.net burban at opopop.net
Mon Apr 27 23:44:08 UTC 2009


burban at opopop.net writes:

> Well, I am so far as to use ucw-core, augmented with ajax stuff and
> along with jQuery!
> 
> It's not polished at all yet, the replaced component renders slightly
> misplaced, and it's dirtyness has to be set by hand.
> 
> The modified ucw-core:
> http://lisp.opopop.net/files/ucw-core-ajax.tgz
> 
> The modified web site, with a jquery copy:
> http://lisp.opopop.net/files/core-lisp-app.tgz
> 
> Files of interest are:
> lisp-app/main-ajax/application-ajax.lisp
> lisp-app/static/scripts/ajaxify.js
> 
> (The last file is a bit too specific currently)
> 
> So yes, that road seems interesting to follow.

Hi,

Sensible progress on the front of ucw-core + ajax + jQuery. The only
annoying problem remaining is the not automatic dirtyness setting.
But rendering is proper now and the javascript is general enough for
all actions on anchors clicks. Can't resist giving it here, as it's
so simple:

/* Inspired from http://www.chazzuka.com/blog/?p=88 */
$(function(){
  
function ajaxify(file){
  $('<div id="ucw-progress-container" class="ucw-progress-indicator"></div>')
           .html("Loading Content...").prependTo('body').fadeIn();
  
 var data = $.ajax({
      url: file,
      dataType: "html",
      success: function(msg){
	$(msg).children().each(function(i) {
	  var att = $(this).attr('id');
          /*alert("Original: "+att+" "+$("div[id="+att+"]").html());
          alert("New: "+att+" "+$(this).html());*/
	  $("div[id="+att+"]").html($(this).html());
        });	
	/*alert($('*').html());*/
      }}).responseText;

   $('#ucw-progress-container').fadeOut('slow',function(){$(this).remove();});
}

$("a").live('click',function(){
  var isajax = new Array();
  isajax = $(this).attr('href').split('/');
  if (isajax[1] == 'ajax') {
    ajaxify($(this).attr('href'));
    return false;
  }
});

});

Will provide full proper patches soon.

Regards.

-- 

B. Urban





More information about the bese-devel mailing list