Skip to content

Instantly share code, notes, and snippets.

@swannodette
Forked from anonymous/gist:73038
Created March 2, 2009 23:19
Show Gist options
  • Save swannodette/73067 to your computer and use it in GitHub Desktop.
Save swannodette/73067 to your computer and use it in GitHub Desktop.
var TestTwoSpace = ShiftSpace.Space.extend({
attributes:
{
name: 'TestTwo',
icon: 'TestTwo.png'
}
});
var TestTwoShift = ShiftSpace.Shift.extend({
setup: function(json) {
console.log("Setup test two shift");
this.build();
this.save();
},
build: function()
{
this.loadJSON();
console.log('cool2');
},
loadJSON : function()
{
var buildInterface = function(images) {
var gallery = $('gallery');
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> printing images');
console.log(images);
images.each(function(image) {
var el = new ShiftSpace.Element('div', {'class': 'preview'});
var name = new ShiftSpace.Element('h3').setHTML(image.name).injectInside(el);
var img = new ShiftSpace.Element('img', {'src': + image.src}).injectAfter(name);
console.log('cool3');
el.inject(gallery);
console.log('cool4');
});
}
var url = 'http://localhost/~clintnewsom/shiftspace/spaces/TestTwo/TestTwo_data.js';
var request = new Json.Remote(url, {
onComplete: function(jsonObj) {
console.log(jsonObj); // changed by David
buildInterface(jsonObj.TestTwo);
}
}).send();
}
});
var TestTwo = new TestTwoSpace(TestTwoShift);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment