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