From f04129771b56948e7b9820cf5ff50897777d6b1d Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Tue, 31 Mar 2015 11:32:45 +0200 Subject: [PATCH] removed server side stuff --- .gitignore | 7 ++----- .npmignore | 3 --- client/bower.json => bower.json | 0 index.html | 15 +++++++++++++++ package.json | 32 -------------------------------- client/index.html => pert.html | 11 +++-------- scripts/build.sh | 9 +++------ scripts/clean.sh | 2 +- src/index.coffee | 7 +++++++ src/pert-ui.coffee | 13 +++++++++---- src/pert.coffee | 7 +++---- style.css | 6 ++++++ 12 files changed, 49 insertions(+), 63 deletions(-) delete mode 100644 .npmignore rename client/bower.json => bower.json (100%) create mode 100644 index.html delete mode 100644 package.json rename client/index.html => pert.html (74%) create mode 100644 src/index.coffee create mode 100644 style.css diff --git a/.gitignore b/.gitignore index 0dd51f0..9d28931 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -node_modules/ -client/pert.js -client/pert-ui.js -client/bower_components/ +bower_components/ test/ lib/ -bin/ +*.js diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 00b7ffc..0000000 --- a/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src/ -client/bower_components/ -test/ diff --git a/client/bower.json b/bower.json similarity index 100% rename from client/bower.json rename to bower.json diff --git a/index.html b/index.html new file mode 100644 index 0000000..56bbea6 --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + Pert + + + + + + + view pert + + + + diff --git a/package.json b/package.json deleted file mode 100644 index 7e210ca..0000000 --- a/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "pert", - "version": "0.1.0", - "description": "pert diagram calculator", - "main": "lib/pert.js", - "bin": { - "pert": "./bin/pert" - }, - "scripts": { - "prepublish": "scripts/build.sh", - "build": "scripts/build.sh", - "clean": "scripts/clean.sh" - }, - "repository": { - "type": "git", - "url": "http://github.com/fazo96/pert.git" - }, - "author": "Enrico Fasoli (fazo96)", - "license": "MIT", - "bugs": { - "url": "https://github.com/fazo96/pert/issues" - }, - "homepage": "https://github.com/fazo96/pert", - "dependencies": { - "chalk": "^1.0.0", - "commander": "^2.6.0", - "express": "^4.12.2" - }, - "devDependencies": { - "coffee-script": "^1.9.1" - } -} diff --git a/client/index.html b/pert.html similarity index 74% rename from client/index.html rename to pert.html index 2b5d164..136c01f 100644 --- a/client/index.html +++ b/pert.html @@ -3,21 +3,16 @@ Pert - +
+ edit data + diff --git a/scripts/build.sh b/scripts/build.sh index cfc4f43..330d29e 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,6 +1,3 @@ -mkdir -p bin lib -echo '#!/usr/bin/env node' > bin/pert -coffee -b -c --no-header -p src/pert-cli.coffee >> bin/pert -chmod +x bin/pert -coffee -b -c --no-header -p src/pert.coffee > lib/pert.js -coffee -b -c --no-header -p src/pert-ui.coffee > client/pert-ui.js +coffee -b -c --no-header -p src/pert.coffee > pert.js +coffee -b -c --no-header -p src/pert-ui.coffee > pert-ui.js +coffee -b -c --no-header -p src/index.coffee > index.js diff --git a/scripts/clean.sh b/scripts/clean.sh index 3263499..4f3ced6 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -1,2 +1,2 @@ #!/bin/bash -rm -rf bin lib +rm -r *.js diff --git a/src/index.coffee b/src/index.coffee new file mode 100644 index 0000000..7b65057 --- /dev/null +++ b/src/index.coffee @@ -0,0 +1,7 @@ +console.log 'Pert ui' + +$('#ta').val localStorage.getItem 'ganttpert' + +$('#save').click -> + console.log 'save' + localStorage.setItem 'ganttpert', $('#ta').val() diff --git a/src/pert-ui.coffee b/src/pert-ui.coffee index 0f10f35..1cd6afb 100644 --- a/src/pert-ui.coffee +++ b/src/pert-ui.coffee @@ -1,7 +1,4 @@ -$.get 'data', (d) -> - # Serve the server data - buildTimeline d - buildGraph d +console.log 'Pert ui' toDates = (list, startDay) -> list.map (i) -> @@ -37,3 +34,11 @@ buildGraph = (data) -> edges: style: 'arrow' network = new vis.Network (document.getElementById 'pert'), { nodes: nodes, edges: connections }, options + +data = localStorage.getItem 'ganttpert' +if data + jdata = JSON.parse data + if jdata + buildGraph new Pert(jdata).calculate() + else console.log 'error parsing json:\n'+data +else console.log 'no data' diff --git a/src/pert.coffee b/src/pert.coffee index 374cc12..8c025f7 100755 --- a/src/pert.coffee +++ b/src/pert.coffee @@ -1,7 +1,4 @@ -chalk = require 'chalk' -fs = require 'fs' - -module.exports = class Pert +class Pert constructor: (@list, @verbose) -> @days = [] @@ -75,3 +72,5 @@ module.exports = class Pert else if cb? then cb(results) results + +if module? then module.exports = Pert diff --git a/style.css b/style.css new file mode 100644 index 0000000..4030162 --- /dev/null +++ b/style.css @@ -0,0 +1,6 @@ +body { height: 100%; } +#pert { + height: 600px; + width: 100%; + border: 1px solid lightgray; +}