Commit e9454c02 authored by Romain Courteaud's avatar Romain Courteaud

WIP jio drive which support URL handling.

parent fb7add3f
...@@ -7,40 +7,38 @@ ...@@ -7,40 +7,38 @@
.ready(function (gadget) { .ready(function (gadget) {
// Initialize the gadget local parameters // Initialize the gadget local parameters
gadget.state_parameter_dict = {}; gadget.state_parameter_dict = {};
gadget.state_parameter_dict.jio_storage = jIO.createJIO({ })
"type": "localstorage"
}); .declareMethod('createJio', function (jio_options) {
// }) this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);
//
// .declareMethod('render', function () {
// var gadget = this;
// // Create the Jio storage only the first time
// if (!gadget.state_parameter_dict.hasOwnProperty("jio_storage")) {
// }
}) })
.declareMethod('allDocs', function () { .declareMethod('allDocs', function () {
var storage = this.state_parameter_dict.jio_storage; var storage = this.state_parameter_dict.jio_storage;
console.log("allDocs");
return storage.allDocs.apply(storage, arguments); return storage.allDocs.apply(storage, arguments);
}) })
.declareMethod('get', function () { .declareMethod('get', function () {
var storage = this.state_parameter_dict.jio_storage; var storage = this.state_parameter_dict.jio_storage;
console.log("get");
return storage.get.apply(storage, arguments); return storage.get.apply(storage, arguments);
})
.declareMethod('getAttachment', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.getAttachment.apply(storage, arguments)
// XXX Where to put this &@! blob reading
.then(function (response) {
return jIO.util.readBlobAsText(response.data);
})
.then(function (lala) {
console.log(lala.target.result);
return lala.target.result;
});
})
.declareMethod('putAttachment', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.putAttachment.apply(storage, arguments);
})
.declareMethod('post', function () {
var storage = this.state_parameter_dict.jio_storage;
return storage.post.apply(storage, arguments);
}); });
// return jio_storage.allDocs({"query": '__root__'})
// // XXX How to get root information?
// return jio_storage.get({"_id": undefined});
// return jio_storage.get(
// {"_id": options.jio_key},
// {"_view": options.action_view}
// );
// jio_storage.get(
// {"_id": uri.segment(2)},
// {"_view": options.action_view}
// )
//
// window.jio_storage = jio_storage;
}(rJS, jIO)); }(rJS, jIO));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>About Jio Drive</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
</head>
<body>
<h2>About OfficeJS</h2>
<p>
OfficeJS is designed by the ERP5 company Nexedi.
</p>
<h3>License</h3>
<p>
Under the ? license.
</p>
<h3>See</h3>
<ul>
<li><a href="http://jquery.com/">jQuery</a></li>
<li><a href="http://twitter.github.com/bootstrap/">Bootstrap</a></li>
<li><a href="https://code.google.com/p/svg-edit/">svg-edit</a></li>
<li><a href="http://elrte.org/">elRTE</a></li>
<li><a href="https://github.com/mleibman/SlickGrid/wiki">SlickGrid</a></li>
</ul>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>About Jio Drive</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
</head>
<body>
<h2>Contact us</h2>
<h3>E-mail</h3>
<p>
Jean-Paul Smets &lt;<a>jp@nexedi.com</a>&gt;
</p>
<h3>Address</h3>
<p>
Nexedi<br />
270, Boulevard Georges Clemenceau<br />
59700 MARCQ EN BAROEUL<br />
FRANCE
</p>
</body>
</html>
...@@ -9,53 +9,23 @@ ...@@ -9,53 +9,23 @@
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script> <script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script> <script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="../<%= curl.jquery.relative_dest %>" type="text/javascript"></script> <script src="../<%= curl.jquery.relative_dest %>" type="text/javascript"></script>
<script src="jio_drive.js" type="text/javascript"></script>
<script src="../<%= curl.jquerymobilejs.relative_dest %>" type="text/javascript"></script> <script src="../<%= curl.jquerymobilejs.relative_dest %>" type="text/javascript"></script>
<link rel="http://www.renderjs.org/rel/interface" <script src="jio_drive.js" type="text/javascript"></script>
href="http://www.renderjs.org/interface/officejs"/>
</head> </head>
<body> <body>
<div data-role="page" id="index"> <header data-role="header">
<a class="home_link">Home</a>
<!-- header -->
<div data-role="header">
<a href="#menu"
data-rel="panel"
data-role="button"
data-icon="bars"
data-iconpos="notext"
data-dismissable="false">Menu</a>
<h1>Office JS</h1> <h1>Office JS</h1>
</div> <a class="about_link">About</a>
</header>
<!-- panel -->
<div data-role="panel" id="menu" data-theme="a" class="bare_panel"></div>
<!--div class="catalog_location"></div-->
<!-- content -->
<div data-role="content">
<!-- editor A -->
<div class="editor_a">
<div data-role="fieldcontain" class="editor_a_safe">
</div>
<div data-role="fieldcontain" class="editor_a">
</div>
</div>
<!-- editor B -->
<div class="editor_b">
<div data-role="fieldcontain" class="editor_b_safe">
</div>
<div data-role="fieldcontain" class="editor_b"> <article class="gadget_container"></article>
</div>
</div>
</div> <aside>
</div> <section data-gadget-url="../catalog_static/index.html"
data-gadget-scope="catalog"></section>
<section data-gadget-url="../jio_bridge/index.html"
data-gadget-scope="jio"></section>
</aside>
</body> </body>
</html> </html>
/*global console, jQuery, rJS, RSVP */ /*global console, jQuery, rJS, RSVP, alert */
/*jslint nomen: true*/
(function (window, $, rJS, RSVP) { (function (window, $, rJS, RSVP) {
"use strict"; "use strict";
function attachIOToEditor(all_param) { /////////////////////////////////////////////////////////////////
var editor = all_param[0], // Desactivate jQuery Mobile URL management
io = all_param[1], /////////////////////////////////////////////////////////////////
id = all_param[2]; $.mobile.ajaxEnabled = false;
$(io.__element).trigger('create'); $.mobile.linkBindingEnabled = false;
$(editor.__element).trigger('create'); $.mobile.hashListeningEnabled = false;
// .then(function (element) { $.mobile.pushStateEnabled = false;
// element.trigger('create');
// function attachIOToEditor(all_param) {
// var editor = all_param[0],
// io = all_param[1],
// id = all_param[2];
// $(io.__element).trigger('create');
// $(editor.__element).trigger('create');
// // .then(function (element) {
// // element.trigger('create');
// // });
// // io.getElement()
// // .then(function (element) {
// // element.trigger('create');
// // });
//
// return io.configureIO(id)
// .then(function () {
// return io.configureDataSourceCallback(editor, editor.getContent);
// })
// .then(function () {
// return io.getIO().fail(function (error) {
// if (error.status === 404) {
// return "";
// }
// throw error;
// }); // });
// io.getElement() // })
// .then(function (element) { // .then(function (value) {
// element.trigger('create'); // return editor.setContent(value);
// }); // });
// }
//
// function handleError(rejectedReason) {
// var word_list;
// console.warn(rejectedReason);
// if (rejectedReason instanceof Error) {
// word_list = rejectedReason.toString();
// } else {
// word_list = JSON.stringify(rejectedReason);
// }
// // XXX Escape text
// document.getElementsByTagName('body')[0].innerHTML = word_list;
// throw rejectedReason;
// }
//
// function createLoadNewEditorCallback(g, editor_path, e_c, io_path, i_c) {
// return function () {
// e_c.empty();
// return RSVP.all([
// g.declareGadget(editor_path, {element: e_c[0], sandbox: 'iframe'}),
// g.declareGadget(io_path),
// "officejs"
// ])
// .then(function (all_param) {
// console.log(all_param);
// i_c.empty();
// i_c[0].appendChild(all_param[1].__element);
// return attachIOToEditor(all_param);
// })
// .fail(handleError);
// };
// }
//
// rJS(window).ready(function (g) {
// var editor_a_context = $(g.__element).find(".editor_a").last(),
// io_a_context = $(g.__element).find(".editor_a_safe").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
// g.getDeclaredGadget('catalog')
// .then(function (catalog) {
// // Fetch the list of editor and io gadgets
// // This is done in 2 different queries to the catalog
// return RSVP.all([
// catalog.allDocs(
// {query: 'interface: "http://www.renderjs.org/interface/editor"'}
// ),
// catalog.allDocs(
// {query: 'interface: "http://www.renderjs.org/interface/io"'}
// )
// ]);
// })
// .then(function (all_list) {
// var panel_context = $(g.__element).find(".bare_panel"),
// editor_list = all_list[0],
// io_list = all_list[1],
// editor_definition,
// i;
//
// // Load 1 editor and 1 IO and plug them
// editor_a_context.empty();
// console.log(editor_list[0].path);
// console.log(io_list[0].path);
// return RSVP.all([
// g.declareGadget(
// editor_list[0].path,
// {element: editor_a_context[0], sandbox: 'iframe'}
// ),
// g.declareGadget(
// io_list[0].path,
// {element: io_a_context[0]}
// ),// io_a_context),
// "officejs"
// ])
// .then(function (all_param) {
// console.log(all_param[0]);
// console.log(all_param[1]);
// // io_a_context.empty();
// // io_a_context[0].appendChild(all_param[1].__element);
// return attachIOToEditor(all_param);
// })
// .then(function () {
// // Fill the panel
// for (i = 0; i < editor_list.length; i += 1) {
// editor_definition = editor_list[i];
// panel_context.append(
// '<a href="#" data-role="button" data-icon="edit" ' +
// 'data-iconpos="left">' + editor_definition.title + '</a>'
// );
// // $(editor_definition.element).click(
// panel_context.find('a').last().click(
// createLoadNewEditorCallback(g, editor_definition.path,
// 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');
// });
//
//
// })
//
// .fail(handleError);
// // $.when(
// // g.declareGadget('./jqteditor.html', editor_a_context),
// // g.declareGadget('./io.html', io_a_context),
// // "officejs_a").done(attachIOToEditor);
//
// // $.when(
// // g.declareGadget('./editor.html', editor_b_context),
// // g.declareGadget('./io.html', io_b_context),
// // "officejs_b").done(attachIOToEditor);
return io.configureIO(id)
.then(function () {
return io.configureDataSourceCallback(editor, editor.getContent);
})
.then(function () {
return io.getIO().fail(function (error) {
if (error.status === 404) {
return "";
}
throw error;
});
})
.then(function (value) {
return editor.setContent(value);
});
}
function handleError(rejectedReason) { rJS(window)
var word_list;
console.warn(rejectedReason);
if (rejectedReason instanceof Error) {
word_list = rejectedReason.toString();
} else {
word_list = JSON.stringify(rejectedReason);
}
// XXX Escape text
document.getElementsByTagName('body')[0].innerHTML = word_list;
throw rejectedReason;
}
function createLoadNewEditorCallback(g, editor_path, e_c, io_path, i_c) { // Assign the element to a variable
return function () { .ready(function (g) {
e_c.empty(); return g.getElement()
return RSVP.all([ .push(function (element) {
g.declareGadget(editor_path, {element: e_c[0], sandbox: 'iframe'}), g.element = element;
g.declareGadget(io_path), });
"officejs"
])
.then(function (all_param) {
i_c.empty();
i_c[0].appendChild(all_param[1].__element);
return attachIOToEditor(all_param);
}) })
.fail(handleError);
};
}
rJS(window).ready(function (g) { // Configure jIO to use indexedDB
var editor_a_context = $(g.__element).find(".editor_a").last(), .ready(function (g) {
io_a_context = $(g.__element).find(".editor_a_safe").last(); return g.getDeclaredGadget("jio")
// editor_b_context = g.context.find(".editor_b").last(), .push(function (jio_gadget) {
// io_b_context = g.context.find(".editor_b_safe").last(); return jio_gadget.createJio({
// "type": "indexeddb",
// "database": "jio_drive"
"type": "local",
"username": "default",
"application_name": "jio_drive"
});
});
})
// First, load the catalog gadget // Create some link on the page
g.declareGadget('../catalog_static/index.html') .ready(function (g) {
.then(function (catalog) { return RSVP.Queue()
// Fetch the list of editor and io gadgets .push(function () {
// This is done in 2 different queries to the catalog
return RSVP.all([ return RSVP.all([
catalog.allDocs( g.aq_pleasePublishMyState({}),
{query: 'interface: "http://www.renderjs.org/interface/editor"'} g.aq_pleasePublishMyState({page: "about"})
),
catalog.allDocs(
{query: 'interface: "http://www.renderjs.org/interface/io"'}
)
]); ]);
}) })
.then(function (all_list) { .push(function (link_list) {
var panel_context = $(g.__element).find(".bare_panel"), g.element.getElementsByClassName("home_link")[0].href =
editor_list = all_list[0], link_list[0];
io_list = all_list[1], g.element.getElementsByClassName("about_link")[0].href =
editor_definition, link_list[1];
i; });
})
// Load 1 editor and 1 IO and plug them // Bridge to jio gadget
editor_a_context.empty(); .allowPublicAcquisition("allDocs", function (param_list) {
return RSVP.all([ return this.getDeclaredGadget("jio")
g.declareGadget( .push(function (jio_gadget) {
editor_list[0].path, return jio_gadget.allDocs.apply(jio_gadget, param_list);
{element: editor_a_context[0], sandbox: 'iframe'} });
),
g.declareGadget(io_list[0].path),// io_a_context),
"officejs"
])
.then(function (all_param) {
io_a_context.empty();
io_a_context[0].appendChild(all_param[1].__element);
return attachIOToEditor(all_param);
}) })
.then(function () { .allowPublicAcquisition("jio_get", function (param_list) {
// Fill the panel return this.getDeclaredGadget("jio")
for (i = 0; i < editor_list.length; i += 1) { .push(function (jio_gadget) {
editor_definition = editor_list[i]; return jio_gadget.get.apply(jio_gadget, param_list);
panel_context.append( });
'<a href="#" data-role="button" data-icon="edit" ' + })
'data-iconpos="left">' + editor_definition.title + '</a>' .allowPublicAcquisition("jio_getAttachment", function (param_list) {
); return this.getDeclaredGadget("jio")
// $(editor_definition.element).click( .push(function (jio_gadget) {
panel_context.find('a').last().click( return jio_gadget.getAttachment.apply(jio_gadget, param_list);
createLoadNewEditorCallback(g, editor_definition.path, });
editor_a_context, io_list[0].path, io_a_context) })
); .allowPublicAcquisition("jio_putAttachment", function (param_list) {
// XXX Handle links return this.getDeclaredGadget("jio")
// panel_context.find('a').last().click(function () { .push(function (jio_gadget) {
// $.when( return jio_gadget.putAttachment.apply(jio_gadget, param_list);
// g.declareGadget(editor_definition.path, });
// editor_a_context), })
// g.declareGadget(io_list[0].path, io_a_context), .allowPublicAcquisition("jio_post", function (param_list) {
// "officejs" return this.getDeclaredGadget("jio")
// ).done(attachIOToEditor); .push(function (jio_gadget) {
// }); return jio_gadget.post.apply(jio_gadget, param_list);
}
panel_context.trigger('create');
}); });
}) })
.fail(handleError); .allowPublicAcquisition("whoWantToDisplayThisPage", function (param_list) {
// $.when( // Hey, I want to display some URL
// g.declareGadget('./jqteditor.html', editor_a_context), return this.aq_pleasePublishMyState({page: param_list[0]});
// g.declareGadget('./io.html', io_a_context), })
// "officejs_a").done(attachIOToEditor);
// $.when( .allowPublicAcquisition("whoWantToDisplayThisDocument",
// g.declareGadget('./editor.html', editor_b_context), function (param_list) {
// g.declareGadget('./io.html', io_b_context), // Hey, I want to display some jIO document
// "officejs_b").done(attachIOToEditor); return this.aq_pleasePublishMyState({
page: "plumb",
id: param_list[0]
});
})
// Render the page
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")
.declareMethod("render", function (options) {
console.log(options);
var gadget = this,
element = gadget.element.getElementsByClassName("gadget_container")[0];
if (options.page === undefined) {
// Redirect to the about page
return gadget.aq_pleasePublishMyState({page: "list"})
.push(gadget.pleaseRedirectMyHash.bind(gadget));
}
// Clear the previous rendering
element.innerHTML = "";
return gadget.declareGadget(options.page + ".html", {
element: element
}).push(function (g) {
if (g.render !== undefined) {
return g.render(options);
}
});
}); });
}(window, jQuery, rJS, RSVP)); }(window, jQuery, rJS, RSVP));
...@@ -2,6 +2,6 @@ iframe { ...@@ -2,6 +2,6 @@ iframe {
border:0; border:0;
margin:0; margin:0;
padding:0; padding:0;
width:80%; width:90%;
height:300px; height:500px;
} }
/*global console, rJS, RSVP, Handlebars */
/*jslint nomen: true */
(function (window, rJS, RSVP, Handlebars) {
"use strict";
// Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window),
source = gadget_klass.__template_element
.getElementById("table-template")
.innerHTML,
table_template = Handlebars.compile(source);
gadget_klass
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.element = element;
});
})
.declareAcquiredMethod("aq_allDocs", "allDocs")
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")
.declareAcquiredMethod("whoWantToDisplayThisPage",
"whoWantToDisplayThisPage")
.declareAcquiredMethod("whoWantToDisplayThisDocument",
"whoWantToDisplayThisDocument")
.declareMethod("render", function (options) {
var gadget = this;
return gadget.aq_allDocs({"select_list": ["title"]})
.push(function (document_list) {
var result_list = [gadget.whoWantToDisplayThisPage("new")],
doc,
i;
for (i = 0; i < document_list.data.total_rows; i += 1) {
doc = document_list.data.rows[i];
result_list.push(RSVP.all([
gadget.whoWantToDisplayThisDocument(doc.id),
doc.value.title
]));
}
return RSVP.all(result_list);
})
.push(function (document_list) {
// Create new doc if nothing exists
if (document_list.length === 1) {
return gadget.pleaseRedirectMyHash(document_list[0]);
}
var i,
parameter_list = [],
doc;
for (i = 1; i < document_list.length; i += 1) {
doc = document_list[i];
parameter_list[i - 1] = {
link: doc[0],
title: doc[1]
};
}
gadget.element.querySelector('a').href = document_list[0];
gadget.element.querySelector('.document_list').innerHTML =
table_template({
documentlist: parameter_list
});
});
});
}(window, rJS, RSVP, Handlebars));
/*global console, rJS, RSVP */
(function (window, rJS, RSVP) {
"use strict";
function promiseEventListener(target, type, useCapture) {
//////////////////////////
// Resolve the promise as soon as the event is triggered
// eventListener is removed when promise is cancelled/resolved/rejected
//////////////////////////
var handle_event_callback;
function canceller() {
target.removeEventListener(type, handle_event_callback, useCapture);
}
function resolver(resolve) {
handle_event_callback = function (evt) {
canceller();
evt.stopPropagation();
evt.preventDefault();
resolve(evt);
return false;
};
target.addEventListener(type, handle_event_callback, useCapture);
}
return new RSVP.Promise(resolver, canceller);
}
rJS(window)
.declareAcquiredMethod("aq_post", "jio_post")
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")
.declareAcquiredMethod("whoWantToDisplayThisDocument",
"whoWantToDisplayThisDocument")
.declareMethod("render", function (options) {
var gadget = this,
filename;
return this.getElement()
.push(function (element) {
var input = element.getElementsByClassName("filename_input")[0];
input.focus();
input.select();
return promiseEventListener(
element.getElementsByClassName("new_web_page_form")[0],
'submit',
false
);
})
.push(function (evt) {
filename = evt.target[0].value;
var now = new Date();
return gadget.aq_post({
title: filename,
// type: "Spreadsheet",
// format: "application/json",
type: "WebPage",
format: "text/html",
date: now.getFullYear() + "-" + (now.getMonth() + 1) + "-" +
now.getDate()
});
})
.push(function (result) {
return gadget.whoWantToDisplayThisDocument(result.id);
})
.push(function (url) {
return gadget.pleaseRedirectMyHash(url);
});
// .push(undefined, function (error) {
// if (error.status === 404) {
// }
// console.error(error);
// throw error;
// // // Unexpected success! File is already there.
// // return gadget.aq_get(filename);
// });
});
}(window, rJS, RSVP));
/*global console, rJS, RSVP */
/*jslint nomen: true */
(function (window, rJS, RSVP) {
"use strict";
function loopEventListener(target, type, useCapture, callback) {
//////////////////////////
// Infinite event listener (promise is never resolved)
// eventListener is removed when promise is cancelled/rejected
//////////////////////////
var handle_event_callback,
callback_promise;
function cancelResolver() {
if ((callback_promise !== undefined) &&
(typeof callback_promise.cancel === "function")) {
callback_promise.cancel();
}
}
function canceller() {
if (handle_event_callback !== undefined) {
target.removeEventListener(type, handle_event_callback, useCapture);
}
cancelResolver();
}
function itsANonResolvableTrap(resolve, reject) {
handle_event_callback = function (evt) {
evt.stopPropagation();
evt.preventDefault();
cancelResolver();
callback_promise = new RSVP.Queue()
.push(function () {
return callback(evt);
})
.push(undefined, function (error) {
if (!(error instanceof RSVP.CancellationError)) {
canceller();
reject(error);
}
});
};
target.addEventListener(type, handle_event_callback, useCapture);
}
return new RSVP.Promise(itsANonResolvableTrap, canceller);
}
rJS(window)
// Assign the element to a variable
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.element = element;
});
})
.declareAcquiredMethod("aq_get", "jio_get")
.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("aq_putAttachment", "jio_putAttachment")
.declareMethod("render", function (options) {
var gadget = this,
editor_gadget,
doc;
return gadget.aq_get({"_id": options.id})
.push(function (result) {
var element = gadget.element.querySelector("div");
doc = result.data;
gadget.element.querySelector("h2").textContent = doc.title || "";
// XXX Non stateless
element.innerHTML = "";
if (doc.type === "WebPage") {
return gadget.declareGadget("../editor_jqte/index.html", {
element: element,
scope: "editor"
});
}
if (doc.type === "Spreadsheet") {
return gadget.declareGadget("../jquery_sheet/index.html", {
element: element,
scope: "editor"
// sandbox: "iframe"
});
}
throw new Error("Can not display " + JSON.stringify(result.data));
})
.push(function (new_gadget) {
editor_gadget = new_gadget;
return gadget.aq_getAttachment({
"_id": doc._id,
"_attachment": "body"
});
})
.push(function (attachment) {
console.log(attachment);
return editor_gadget.setContent(attachment);
}, function (error) {
if ((error.status === 404) && (error.method === "getAttachment")) {
return;
}
throw error;
})
.push(function () {
function formSubmit() {
return editor_gadget.getContent()
.then(function (value) {
return gadget.aq_putAttachment({
"_id": doc._id,
"_attachment": "body",
"_data": value,
"_mime_type": doc.format
});
});
}
return loopEventListener(
gadget.element.querySelector("form"),
'submit',
false,
formSubmit
);
});
});
}(window, rJS, RSVP));
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jio Drive | Document List</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.handlebars.relative_dest %>" type="text/javascript"></script>
<script id="table-template" type="text/x-handlebars-template">
<ul data-role="listview" data-inset="true" class="document-listview">
{{#documentlist}}
<li><a href="{{link}}">{{title}}</a></li>
{{/documentlist}}
</ul>
</script>
<script src="jio_drive_document_list.js" type="text/javascript"></script>
</head>
<body>
<h2>Document List</h2>
<section class="document_list"></section>
<a>New document</a>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jio Drive | Document List</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="jio_drive_new_document.js" type="text/javascript"></script>
</head>
<body>
<h2>New document</h2>
<form class="new_web_page_form">
<div data-role='fieldcontain'>
<label for="document_name">Filename</label>
<input name="document_name" type="text" spellcheck="false" required
value="my_first_page.html" class="filename_input"></input>
</div>
<input type="submit" value="Add web page" />
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jio Drive | Plumb</title>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="jio_drive_plumber.js" type="text/javascript"></script>
</head>
<body>
<h2></h2>
<form class="edit_form">
<input type="submit" value="Save" />
</form>
<div></div>
</body>
</html>
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