Skip to content

Commit 530a815

Browse files
author
Nick Jonas
committed
added queue
1 parent 6c55eb3 commit 530a815

File tree

8 files changed

+132
-6
lines changed

8 files changed

+132
-6
lines changed

coder-apps/common/coderlib/static/css/index.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ H2 {
5555
text-transform: uppercase;
5656
}
5757

58+
.queue_mode #coder_basicnav{
59+
display:none;
60+
}
61+
5862
#coder_basicnav {
5963
position: fixed;
6064
top:0;
@@ -97,10 +101,6 @@ H2 {
97101
transform: rotate(-90deg);
98102
}
99103

100-
.pi #coder_basicnav, .RPi #coder_basicnav, .raspi #coder_basicnav, .rasberrypi #coder_basicnav, .rpi #coder_basicnav{
101-
display:none;
102-
}
103-
104104
#coder_basicnav .coder_editbutton {
105105
position: absolute;
106106
right: 0px;

coder-apps/drinabox/queue/app/app.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
var path = require('path');
2+
var config = require('../../config');
3+
4+
exports.settings={};
5+
//These are dynamically updated by the runtime
6+
//settings.appname - the app id (folder) where your app is installed
7+
//settings.viewpath - prefix to where your view html files are located
8+
//settings.staticurl - base url path to static assets /static/apps/appname
9+
//settings.appurl - base url path to this app /app/appname
10+
//settings.device_name - name given to this coder by the user, Ie."Billy's Coder"
11+
//settings.coder_owner - name of the user, Ie. "Suzie Q."
12+
//settings.coder_color - hex css color given to this coder.
13+
14+
exports.get_routes = [
15+
{ path:'/', handler:'index_handler' },
16+
];
17+
18+
exports.post_routes = [
19+
];
20+
21+
22+
exports.index_handler = function( req, res ) {
23+
var tmplvars = {};
24+
25+
var appdir = path.join(__dirname, '../../apps/');
26+
var staticdir = '/static/apps/';
27+
var viewdir = 'apps/';
28+
29+
var appqueue = ['weather'];
30+
var appname = appqueue[0];
31+
32+
var userapp = loadApp( appdir + appname + "/app" );
33+
userapp.settings.appname = appname;
34+
userapp.settings.viewpath="apps/" + appname;
35+
userapp.settings.appurl= "/app/" + appname;
36+
userapp.settings.staticurl = staticdir + appname;
37+
userapp.settings.device_name = exports.settings.device_name;
38+
userapp.settings.body_classes = 'queue_mode';
39+
40+
// get index route for next app
41+
var route = null;
42+
for(var i in userapp.get_routes){
43+
if(userapp.get_routes[i].path === '/'){
44+
route = userapp.get_routes[i];
45+
}
46+
}
47+
if(!route){
48+
res.status( 404 );
49+
res.render('404', {
50+
title: 'error'
51+
});
52+
return;
53+
}
54+
userapp[route['handler']]( req, res );
55+
};
56+
57+
exports.on_destroy = function() {
58+
};
59+
60+
var loadApp = function( loadpath ) {
61+
var userapp = null;
62+
if ( config.cacheApps ) {
63+
userapp = require(loadpath);
64+
} else {
65+
66+
var cached = require.cache[loadpath + '.js'];
67+
if ( cached ) {
68+
userapp = require(loadpath);
69+
if ( userapp.on_destroy ) {
70+
userapp.on_destroy();
71+
}
72+
delete require.cache[loadpath + ".js"];
73+
}
74+
userapp = require(loadpath);
75+
}
76+
return userapp;
77+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"created": "2014-10-21",
3+
"modified": "2014-10-21",
4+
"color": "#2ecc71",
5+
"author": "",
6+
"name": "Queue",
7+
"hidden": true
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
.pagecontent {
3+
padding: 24px;
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
$(document).ready( function() {
3+
4+
//This code will run after your page loads
5+
6+
});

coder-apps/drinabox/queue/static/media/.gitignore

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Coder</title>
5+
<meta charset="utf-8">
6+
<!-- Standard Coder Includes -->
7+
<script>
8+
var appname = "{{app_name}}"; //app name (id) of this app
9+
var appurl = "{{&app_url}}";
10+
var staticurl = "{{&static_url}}"; //base path to your static files /static/apps/yourapp
11+
</script>
12+
<link href="/static/apps/coderlib/css/index.css" media="screen" rel="stylesheet" type="text/css"/>
13+
<script src="/static/common/js/jquery.min.js"></script>
14+
<script src="/static/common/ace-min/ace.js" type="text/javascript" charset="utf-8"></script>
15+
<script src="/static/apps/coderlib/js/index.js"></script>
16+
<script>
17+
Coder.addBasicNav();
18+
</script>
19+
<!-- End Coder Includes -->
20+
21+
<!-- This app's includes -->
22+
<link href="{{&static_url}}/css/index.css" media="screen" rel="stylesheet" type="text/css"/>
23+
<script src="{{&static_url}}/js/index.js"></script>
24+
<!-- End apps includes -->
25+
</head>
26+
<body class="">
27+
<div class="pagecontent">
28+
<h1>Hello World</h1>
29+
<p>Your html goes here.</p>
30+
</div>
31+
</body>
32+
</html>

coder-base/localserver.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ var apphandler = function( req, res, appdir ) {
6464
var apppath = req.params[1];
6565
var modpath = appdir + appname;
6666
var userapp = loadApp( modpath + "/app" );
67-
6867

6968
util.log( "GET: " + apppath + " " + appname );
7069

7170
//Redirect to sign-in for unauthenticated users
72-
publicAllowed = ["auth", "weather"]; //apps that are exempt from any login (should only be auth)
71+
publicAllowed = ["auth", "queue"]; //apps that are exempt from any login (should only be auth)
7372
auth = require(appdir + "auth" + "/app");
7473
user = auth.isAuthenticated(req, res);
7574
if ( !user && publicAllowed.indexOf( appname ) < 0) {

0 commit comments

Comments
 (0)