Permalink
Browse files

enable features to live in main dir

default is within the jade editor directory. use root argument for
sibling application directories
  • Loading branch information...
1 parent 8c46559 commit 1484b8de6c42f51c405b4fee1b69054bc4706baf @martypdx committed Dec 8, 2012
@@ -0,0 +1,13 @@
+.stylely {
+ background: steelblue;
+ color: white;
+ padding: 10px;
+}
+.edit {
+ float: left;
+ background: wheat;
+ padding: 10px;
+ margin: 5px;
+ width: 35%;
+ cursor: pointer;
+}
No changes.
@@ -0,0 +1 @@
+<div class="demo"><div class="stylely">Hello World!</div><p><3 Delight Editor</p><div class="stylely">editors</div><div class="edit">jade</div><div class="edit">css</div><div class="edit">json</div><div class="edit">javascript</div></div>
@@ -0,0 +1,6 @@
+.demo
+ .stylely Hello World!
+ p <3 #{name}
+ .stylely editors
+ each editor in list
+ .edit #{editor}
@@ -0,0 +1,4 @@
+template.find('.edit')
+.click(function(){
+ $(this).css('color', 'red')
+})
@@ -0,0 +1,9 @@
+{
+ "name": "Delight Editor",
+ "list": [
+ "jade",
+ "css",
+ "json",
+ "javascript"
+ ]
+}
No changes.
No changes.
@@ -0,0 +1 @@
+<ul><li>demo</li></ul>
@@ -0,0 +1,3 @@
+ul
+ each app in apps
+ li #{app}
No changes.
@@ -0,0 +1,5 @@
+{
+ "apps": [
+ "demo"
+ ]
+}
View
29 repl.js
@@ -1,28 +1 @@
-var __ = { lineno: 1, input: "p Hello #{place}\nscope true\n p Hello #{place}", filename: undefined };
-try {
- var buf = [];
- with (locals || {}) {
- var interp;
- __.lineno = 1;
- __.lineno = 1;
- buf.push('<p>Hello ' + escape((interp = place) == null ? '' : interp) + '');
- __.lineno = undefined;
- buf.push('</p>');
- __.lineno = 3;
- // scope true
- (function(){
- with (true) {
- __.lineno = 2;
- __.lineno = 3;
- buf.push('<p>Hello ' + escape((interp = place) == null ? '' : interp) + '');
- __.lineno = undefined;
- buf.push('</p>');
- }
- }).call(this);
-
- }
- return buf.join("");
-}
-catch (err) {
- rethrow(err, __.input, __.filename, __.lineno);
-}
+console.log('dir', __dirname)
View
@@ -7,27 +7,27 @@ app.use(express.static(path.join(__dirname, 'public')))
app.use(express.bodyParser())
app.set('view engine', 'jade')
-var appToEdit = process.argv.length > 2 ? process.argv[2] : 'jade-editor'
-console.log('Editing app', appToEdit)
-
app.get('/', function (request, response) {
- response.render('index', { layout: false, app: appToEdit });
+ //todo: make app chooser
+ response.redirect('/demo')
+})
+
+app.get('/:app', function (request, response) {
+ response.render('index', { layout: false, app: request.params.app });
})
var templateService = require('./lib/common/template-service')
services = {}
+var siblings = process.argv.length > 2 && process.argv[2][0] === 'r'
+
+var rootDir = siblings ? path.dirname(__dirname) : path.join(__dirname, 'apps')
+console.log('App root is', rootDir)
+
+
var getTemplateService = function(app) {
if(!services[app]) {
-
- var parentDir = path.dirname(__dirname)
- var appDir = path.join(parentDir, app)
-
-
- /*
- //for smart-machine
- var appDir = app === 'jade-editor' ? __dirname : path.join(__dirname, app)
- */
-
+ var root = (app === 'jade-editor') ? path.dirname(__dirname) : rootDir
+ var appDir = path.join(root, app)
services[app] = templateService.getApp(appDir)
}
return services[app]

0 comments on commit 1484b8d

Please sign in to comment.