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/73066 to your computer and use it in GitHub Desktop.
Save swannodette/73066 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();
// this.manageElement(this.element);
// this.makeDraggable();
},
build: function() {
this.loadJSON();
console.log('cool2');
},
loadJSON : function(){
var buildInterface = function(images){
var gallery = $('gallery');
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) {
buildInterface(jsonObj.previews);
}
}).send();
}
/*
makeDraggable : function(){
this.element.makeDraggable({
'onComplete': function() {
this.save();
}.bind(this)
});
}
// encode: function() {
// var pos = this.element.getPosition();
// return {
//summary: this.messageValue,
//message: this.messageValue,
// position: pos
// };
// }
*/
});
var TestTwo = new TestTwoSpace(TestTwoShift);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment