Commit 8955cfa0 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

fwi: blog is the default page

parent 07726f3b
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
}, },
blog_1_dict = { blog_1_dict = {
"path" : "./blog.html", "path" : "./blog.html",
"title" : "Blog Gadget", "title" : "Blog",
"interface" : "http://www.renderjs.org/interface/blog" "interface" : "http://www.renderjs.org/interface/blog"
}, },
catalog_list = [ catalog_list = [
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
data-iconpos="notext" data-iconpos="notext"
data-dismissable="false">Menu</a> data-dismissable="false">Menu</a>
<h1>Office JS</h1> <h1>FWI</h1>
</div> </div>
<!-- panel --> <!-- panel -->
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
function createLoadNewEditorCallback(g, editor_path, e_c, io_path, i_c) { function createLoadNewEditorCallback(g, editor_path, e_c, io_path, i_c) {
return function () { return function () {
e_c.empty(); e_c.empty();
$('.editor_a_safe').attr("style","");
return RSVP.all([ return RSVP.all([
g.declareGadget(editor_path, {element: e_c[0], sandbox: 'iframe'}), g.declareGadget(editor_path, {element: e_c[0], sandbox: 'iframe'}),
g.declareGadget(io_path), g.declareGadget(io_path),
...@@ -96,6 +97,7 @@ ...@@ -96,6 +97,7 @@
function createLoadNewBlogCallback(g, blog_path, e_c, io_path, i_c) { function createLoadNewBlogCallback(g, blog_path, e_c, io_path, i_c) {
return function () { return function () {
e_c.empty(); e_c.empty();
$('.editor_a_safe').attr("style","display:none");
return RSVP.all([ return RSVP.all([
g.declareGadget(blog_path, {element: e_c[0], sandbox: 'iframe'}), g.declareGadget(blog_path, {element: e_c[0], sandbox: 'iframe'}),
g.declareGadget(io_path), g.declareGadget(io_path),
...@@ -113,13 +115,10 @@ ...@@ -113,13 +115,10 @@
rJS(window).ready(function (g) { rJS(window).ready(function (g) {
var editor_a_context = $(g.element).find(".editor_a").last(), var editor_a_context = $(g.element).find(".editor_a").last(),
io_a_context = $(g.element).find(".editor_a_safe").last(), io_a_context = $(g.element).find(".editor_a_safe").last(),
io_blog_a_context = $(g.element).find(".blog_a_safe").last(), io_blog_a_context = $(g.element).find(".editor_a_safe").last(),
blog_a_context = $(g.element).find(".blog_a").last(); blog_a_context = $(g.element).find(".editor_a").last();
// editor_b_context = g.context.find(".editor_b").last(),
// io_b_context = g.context.find(".editor_b_safe").last();
// First, load the catalog gadget // First, load the catalog gadget
console.log('start');
g.declareGadget('./catalog.html') g.declareGadget('./catalog.html')
.then(function (catalog) { .then(function (catalog) {
// Fetch the list of editor and io gadgets // Fetch the list of editor and io gadgets
...@@ -143,60 +142,48 @@ ...@@ -143,60 +142,48 @@
io_list = all_list[1], io_list = all_list[1],
blog_list = all_list[2], blog_list = all_list[2],
editor_definition, editor_definition,
blog_definition,
i; i;
console.log('got Catalog Stuff');
// Load 1 editor and 1 IO and plug them // Load 1 editor and 1 IO and plug them
editor_a_context.empty(); editor_a_context.empty();
$('.editor_a_safe').attr("style","display:none");
return RSVP.all([ return RSVP.all([
g.declareGadget( g.declareGadget(
editor_list[0].path, blog_list[0].path,
{element: editor_a_context[0], sandbox: 'iframe'} {element: blog_a_context[0], sandbox: 'iframe'}
), ),
g.declareGadget(io_list[0].path),// io_a_context), g.declareGadget(io_list[0].path),// io_a_context),
"officejs" "officejs"
]) ])
.then(function (all_param) { .then(function (all_param) {
console.log('Editor Gadget Prepared'); console.log('Editor Gadget Prepared');
io_a_context.empty();
io_a_context[0].appendChild(all_param[1].element);
return attachIOToEditor(all_param);
})
.then(function (){
return RSVP.all([ // Load Blog
g.declareGadget(
blog_list[0].path,
{element: blog_a_context[0], sandbox: 'iframe'}
),
g.declareGadget(io_list[0].path),// io_blog_a_context),
"officejs"
])})
.then(function (all_param) {
io_blog_a_context.empty(); io_blog_a_context.empty();
io_blog_a_context[0].appendChild(all_param[1].element); io_blog_a_context[0].appendChild(all_param[1].element);
return attachIOToBlog(all_param); return attachIOToBlog(all_param);
}) })
.then(function () { .then(function () {
// Fill the panel // Fill the panel
for (i = 0; i < blog_list.length; i += 1) {
blog_definition = blog_list[i];
panel_context.append(
'<a href="#" data-role="button" data-icon="edit" ' +
'data-iconpos="left">' + blog_definition.title + '</a>'
);
panel_context.find('a').last().click(
createLoadNewBlogCallback(g, blog_definition.path,
blog_a_context, io_list[0].path, io_blog_a_context)
);
}
for (i = 0; i < editor_list.length; i += 1) { for (i = 0; i < editor_list.length; i += 1) {
editor_definition = editor_list[i]; editor_definition = editor_list[i];
panel_context.append( panel_context.append(
'<a href="#" data-role="button" data-icon="edit" ' + '<a href="#" data-role="button" data-icon="edit" ' +
'data-iconpos="left">' + editor_definition.title + '</a>' 'data-iconpos="left">' + editor_definition.title + '</a>'
); );
// $(editor_definition.element).click(
panel_context.find('a').last().click( panel_context.find('a').last().click(
createLoadNewEditorCallback(g, editor_definition.path, createLoadNewEditorCallback(g, editor_definition.path,
editor_a_context, io_list[0].path, io_a_context) editor_a_context, io_list[0].path, io_a_context)
); );
// XXX Handle links
// panel_context.find('a').last().click(function () {
// $.when(
// g.declareGadget(editor_definition.path,
// editor_a_context),
// g.declareGadget(io_list[0].path, io_a_context),
// "officejs"
// ).done(attachIOToEditor);
// });
} }
panel_context.trigger('create'); panel_context.trigger('create');
}); });
......
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