Commit 9a44d661 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

index_list: now works + clean console message

parent 1a85fb74
......@@ -34,13 +34,9 @@
.declareMethod('setForm', function () {
return that.declareGadget('./property.html')
.then(function(gadget){
console.log('prepared property');
property = gadget;
console.log(property);
property_context = $('.property_a_safe').last();
editor_context = $('.editor_a').last();
console.log('property:');
console.log(property);
property_context[0].appendChild(property.element);
})
.fail(function(error){
......@@ -66,7 +62,6 @@
});
gk.ready(function (g) {
console.log('prepare form');
that = g;
});
}(window, rJS, jQuery, RSVP));
\ No newline at end of file
......@@ -7,22 +7,27 @@
var gk = rJS(window);
/* Initialize Page List */
gk.declareMethod('setDocumentList', function (document_list, editor, editor_callback, property, property_callback) {
gk.declareMethod('setDocumentList',
function (document_list,
form, form_callback,
io, io_callback) {
var i,
document,
index_list_panel = $('#index_list');
for (i = 0; i < document_list.length; i += 1) {
document = $.extend({}, document_list[i].doc);
index_list_panel.append(
"<li><a href=#>"
"<li><a href='#"
+ document._id + "'>"
+ document.title
+ "</a></li>");
index_list_panel.find('a').last().click(function(){
RSVP.all([
editor_callback.apply(editor,[document.text_content]),
property_callback.apply(property, [document])
])}
);
var current_id = this.hash.substr(1);
return io_callback.apply(io, [current_id])
.then( function (data) {
form_callback.apply(form, [data])
})
});
}
});
}(window, rJS, jQuery, RSVP));
\ No newline at end of file
......@@ -29,16 +29,15 @@
return gadget.jio.put(document);
})
.declareMethod('configureDataSourceCallback', function (editor, editor_callback, property, property_callback, key) {
.declareMethod('configureDataSourceCallback',
function (form, form_callback) {
var g = this;
$(g.element).find('a').unbind('click').click(function () {
RSVP.all([
editor_callback.apply(editor),
property_callback.apply(property)
form_callback.apply(form),
])
.then(function (result_list) {
var document = result_list[1];
document.text_content = result_list[0];
var document = result_list[0];
return g.setIO(document);
});
});
......
......@@ -25,7 +25,6 @@
});
})
.then(function (document_list) {
console.log(document_list);
return RSVP.all([
form.setContent(document_list[0].doc),
index.setDocumentList(
......@@ -127,7 +126,6 @@
.then(function (catalog) {
// Fetch the list of editor and io gadgets
// This is done in 2 different queries to the catalog
console.log('catalog ready');
return RSVP.all([
catalog.allDocs(
{query: 'interface: "http://www.renderjs.org/interface/editor"'}
......@@ -158,7 +156,6 @@
index_definition = index_list[0].path,
i;
// Load 1 editor and 1 IO and plug them
console.log('Ready to prepare');
return RSVP.all([
g.declareGadget(
blog_list[0].path,
......@@ -168,13 +165,11 @@
"officejs"
])
.then(function (all_param) {
console.log('setting blog');
io_blog_a_context.empty();
return attachIOToBlog(all_param);
})
.then(function () {
// Fill the panel
console.log('fill panel');
for (i = 0; i < blog_list.length; i += 1) {
blog_definition = blog_list[i];
panel_context.append(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment