Author: hannes
Date: 2009-01-14 14:36:02 +0100 (Wed, 14 Jan 2009)
New Revision: 9480
Modified:
helma-ng/trunk/apps/storage/config.js
helma-ng/trunk/apps/storage/main.js
Log:
Update config to use new url dispatching scheme and use req.params instead of req.data.
Details at http://dev.helma.org/trac/helma/changeset/9480
Modified: helma-ng/trunk/apps/storage/config.js
===================================================================
--- helma-ng/trunk/apps/storage/config.js 2009-01-14 11:43:48 UTC (rev 9479)
+++ helma-ng/trunk/apps/storage/config.js 2009-01-14 13:36:02 UTC (rev 9480)
@@ -1,5 +1,5 @@
var urls = [
- [ /^$/, 'main.index' ]
+ [ /^$/, 'main' ]
];
var charset = 'utf8';
Modified: helma-ng/trunk/apps/storage/main.js
===================================================================
--- helma-ng/trunk/apps/storage/main.js 2009-01-14 11:43:48 UTC (rev 9479)
+++ helma-ng/trunk/apps/storage/main.js 2009-01-14 13:36:02 UTC (rev 9480)
@@ -5,11 +5,11 @@
// the main action is invoked for http://localhost:8080/
// this also shows simple skin rendering
-function index(req, res) {
- if (req.data.save) {
+function index_action(req, res) {
+ if (req.params.save) {
createBook(req, res);
}
- if (req.data.remove) {
+ if (req.params.remove) {
removeBook(req, res);
}
var books = model.Book.all();
@@ -27,15 +27,15 @@
}
function createBook(req, res) {
- var author = new model.Author({name: req.data.author});
- var book = new model.Book({author: author, title: req.data.title});
+ var author = new model.Author({name: req.params.author});
+ var book = new model.Book({author: author, title: req.params.title});
// author is saved transitively
book.save();
res.redirect('/');
}
function removeBook(req, res) {
- var book = model.Book.get(req.data.remove);
+ var book = model.Book.get(req.params.remove);
// author is removed through cascading delete
book.remove();
res.redirect('/');
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.