Skip to content

Commit 7b4294a

Browse files
committed
put scripts, styles in root-relative absolute directories; add demo of data persistence in datastore in webapp
1 parent a8f5b4b commit 7b4294a

5 files changed

Lines changed: 21 additions & 12 deletions

File tree

build/app/assets/simple/simple.html renamed to build/app/assets/htmldemos/simple/simple.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<html>
33
<head>
44
<title>SimpleHTML</title>
5-
<script src="../netc-lib.js"></script>
6-
<script src="../netc-app.js"></script>
7-
<link rel="stylesheet" href="../netc-app.css" type="text/css">
5+
<script src="/scripts/netc-lib.js"></script>
6+
<script src="/scripts/netc-app.js"></script>
7+
<link rel="stylesheet" href="/styles/netc-app.css" type="text/css">
88
</head>
99
<style>
1010
body {
@@ -20,6 +20,7 @@ <h2>Simple HTML in an IFRAME</h2>
2020
// demonstrate that NetCreate system libraries are available
2121
const STORE = require('system/datastore');
2222
STORE.Initialize();
23+
STORE.Increment();
2324
const $ = require('jquery');
2425
$('body').append('<p>JQUERY ADDED THIS</p>');
2526
</script>

build/app/assets/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
padding-top: 3.5rem;
1111
}
1212
</style>
13-
<script src="netc-lib.js"></script>
14-
<script src="netc-app.js"></script>
15-
<link rel="stylesheet" href="netc-app.css">
13+
<script src="/scripts/netc-lib.js"></script>
14+
<script src="/scripts/netc-app.js"></script>
15+
<link rel="stylesheet" href="/styles/netc-app.css" type="text/css">
1616
</head>
1717

1818
<body>

build/app/init-appshell.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ const AppDefault = require('view/AppDefault');
5353
// test component
5454
function HTML ( props, width, height ) {
5555
let loc = props.location.pathname.substring(1);
56-
loc = '/'+loc+'/'+loc+'.html';
57-
width = width || '100%';
56+
loc = '/htmldemos/'+loc+'/'+loc+'.html';
57+
width = width || '100%';
5858
height = height || '750px';
59-
console.log('HTML',loc,width+' x '+height,props);
6059
return (
6160
<div style={{ padding: '10px' }}>
6261
<iframe src={loc} height={height} width={width} />
@@ -80,6 +79,11 @@ module.exports = class AppShell extends React.Component {
8079
});
8180
}
8281
render() {
82+
83+
// demonstrate that STORE persists between clicks
84+
const STORE = require('system/datastore');
85+
STORE.Increment();
86+
8387
return (
8488
<div>
8589
<Navbar fixed="top" light expand="md" style={{ backgroundColor:'#f0f0f0' }}>

build/app/system/datastore.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ import SETTINGS from 'settings';
1010

1111
let MOD = { module_name : 'DATASTORE' };
1212
let time = SETTINGS.CurrentTime();
13+
let counter = 0;
1314
console.log(`> ${MOD.module_name} system module loaded ${time}`);
1415

1516
MOD.Initialize = () => {
1617
console.log(`${MOD.module_name} initializing`);
1718
if (SETTINGS('unisys')) console.log('SETTINGS unisys =',SETTINGS('unisys'));
1819
else (console.log('SETTINGS unisys is undefined'));
1920
};
21+
MOD.Increment = () => {
22+
console.log(`DATA COUNTER ${counter++}`);
23+
};
2024

2125
module.exports = MOD;

build/brunch-config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ module.exports = {
3636
/*/ files: {
3737
javascripts: {
3838
joinTo: {
39-
'netc-app.js' : /^app/,
40-
'netc-lib.js' : /^(?!app)/
39+
'scripts/netc-app.js' : /^app/,
40+
'scripts/netc-lib.js' : /^(?!app)/
4141
}
4242
},
4343
stylesheets: {
4444
joinTo : {
45-
'netc-app.css' : [
45+
'styles/netc-app.css' : [
4646
/^app/,
4747
/^node_modules/
4848
]

0 commit comments

Comments
 (0)