Skip to content

Commit 5050da4

Browse files
author
Jonathan Harper
committed
Updated angular code to use commonjs module format and browserify
1 parent 93f0bfe commit 5050da4

13 files changed

+89
-89
lines changed

Gruntfile.js

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ module.exports = function(grunt) {
77
injected: {
88
src: ['js/injected.js'],
99
dest: 'dist/injected.js'
10+
},
11+
ngapp: {
12+
src: ['js/app.js'],
13+
dest: 'dist/app.js'
1014
}
1115
},
1216
watch: {

display.css

+2-8
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,7 @@ tr.selectedRow {
9999
table tr th span.rowHead {
100100
color: #000;
101101
display: block;
102-
/*Firefox*/
103-
-moz-transform: rotate(-90deg);
104-
/*Safari*/
105102
-webkit-transform: rotate(-90deg);
106-
/*Opera*/
107-
-o-transform: rotate(-90deg);
108-
/*IE*/
109103
writing-mode: tb-rl;
110104
filter: flipv fliph;
111105
border:0px black solid;
@@ -144,8 +138,8 @@ table tr th span.rowHead {
144138
}
145139

146140
td {
147-
padding: 0px;
148-
margin: 0px;
141+
padding: 0;
142+
margin: 0;
149143
}
150144

151145
button {

display.html

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html lang="en" ng-app="restylingApp">
2+
<html lang="en" ng-app="deconApp" ng-csp>
33
<head>
44
<meta charset="utf-8">
55
<title>D3 Deconstructor</title>
@@ -8,20 +8,7 @@
88
<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.css"/>
99
<script src="node_modules/jquery/dist/jquery.js"></script>
1010
<script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
11-
<script src="lib/angular.js"></script>
12-
<script src="node_modules/filesaver.js/FileSaver.js"></script>
13-
<script src="node_modules/underscore/underscore.js"></script>
14-
<script src="node_modules/d3/d3.js"></script>
15-
<script src="node_modules/d3deconstructor/deconstructor.js"></script>
16-
17-
<script src="js/app.js"></script>
18-
<script src="js/DataTableController.js"></script>
19-
<script src="js/MappingsListController.js"></script>
20-
<script src="js/DataLoadingController.js"></script>
21-
<script src="js/SchemaModel.js"></script>
22-
<script src="js/services.js"></script>
23-
<script src="js/directives.js"></script>
24-
<script src="js/filters.js"></script>
11+
<script src="dist/app.js"></script>
2512

2613
</head>
2714
<body>

js/DataLoadingController.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
22

3-
restylingApp.controller('DataLoadingController', ['$scope', 'VisDataService',
3+
var deconApp = angular.module('deconApp');
4+
5+
deconApp.controller('DataLoadingController', ['$scope', 'VisDataService',
46
function($scope, visDataService) {
57
$scope.visDataService = visDataService;
68
}

js/DataTableController.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
2+
var _ = require('underscore');
3+
var VisDeconstruct = require('d3deconstructor');
4+
var saveAs = require('FileSaver.js');
25

3-
restylingApp.controller('DataTableController', ['$scope', 'orderByFilter', 'VisDataService',
6+
var deconApp = angular.module('deconApp');
7+
8+
deconApp.controller('DataTableController', ['$scope', 'orderByFilter', 'VisDataService',
49
function($scope, orderByFilter, visDataService) {
510

611
$scope.selectedVis = visDataService.selectedVis;

js/MappingsListController.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
2+
var deconApp = angular.module('deconApp');
23

3-
restylingApp.controller('MappingsListController', ['$scope', 'VisDataService',
4+
deconApp.controller('MappingsListController', ['$scope', 'VisDataService',
45
function($scope, visDataService) {
56
$scope.data = visDataService.visData;
67
$scope.ids = visDataService.ids;

js/SchemaModel.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
2+
var _ = require('underscore');
3+
var deconApp = angular.module('deconApp');
24

35
function Schema(data, attrs, nodeAttrs, ids, mappings) {
46
this.data = data;
@@ -98,6 +100,6 @@ Schema.fromDeconData = function(deconData) {
98100
};
99101

100102

101-
restylingApp.factory('Schema', function () {
103+
deconApp.factory('Schema', function () {
102104
return Schema;
103105
});

js/app-common.js

-11
This file was deleted.

js/app.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
var restylingApp = angular.module('restylingApp', []);
1+
var angular = require('angular');
2+
3+
var deconApp = angular.module('deconApp', []);
4+
5+
require('./DataTableController');
6+
require('./MappingsListController');
7+
require('./DataLoadingController');
8+
require('./SchemaModel');
9+
require('./services');
10+
require('./directives');
11+
require('./filters');

js/directives.js

+44-41
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
2+
var deconApp = angular.module('deconApp');
3+
var d3 = require('d3');
4+
var _ = require('underscore');
25

3-
restylingApp.directive('ngRightClick', function($parse) {
6+
deconApp.directive('ngRightClick', function($parse) {
47
return function(scope, element, attrs) {
58
var fn = $parse(attrs.ngRightClick);
69
element.bind('contextmenu', function(event) {
@@ -11,45 +14,45 @@ restylingApp.directive('ngRightClick', function($parse) {
1114
});
1215
};
1316
});
14-
15-
restylingApp.directive('fileUpload', [function() {
16-
return {
17-
scope: {
18-
fileUpload: "="
19-
},
20-
link: function(scope, element, attrs) {
21-
element.bind("change", function (event) {
22-
var schemaData = {};
23-
var schemaDataLength = 0;
24-
Papa.parse(event.target.files[0], {
25-
dynamicTyping: true,
26-
complete: function (csv) {
27-
console.log(csv);
28-
schemaDataLength = csv.data.length;
29-
for (var i = 1; i < csv.data.length; ++i) {
30-
for (var j = 0; j < csv.data[0].length; ++j) {
31-
var key = csv.data[0][j];
32-
if (schemaData[key]) {
33-
schemaData[key].push(csv.data[i][j]);
34-
}
35-
else {
36-
schemaData[key] = [csv.data[i][j]];
37-
}
38-
}
39-
}
40-
console.log(schemaData);
41-
scope.$apply(function() {
42-
scope.$parent.loadedSchemaData = schemaData;
43-
scope.$parent.loadedSchemaDataLength = schemaDataLength;
44-
});
45-
}
46-
});
47-
});
48-
}
49-
}
50-
}]);
51-
52-
restylingApp.directive('svgInject', function($compile) {
17+
//
18+
//deconApp.directive('fileUpload', [function() {
19+
// return {
20+
// scope: {
21+
// fileUpload: "="
22+
// },
23+
// link: function(scope, element, attrs) {
24+
// element.bind("change", function (event) {
25+
// var schemaData = {};
26+
// var schemaDataLength = 0;
27+
// Papa.parse(event.target.files[0], {
28+
// dynamicTyping: true,
29+
// complete: function (csv) {
30+
// console.log(csv);
31+
// schemaDataLength = csv.data.length;
32+
// for (var i = 1; i < csv.data.length; ++i) {
33+
// for (var j = 0; j < csv.data[0].length; ++j) {
34+
// var key = csv.data[0][j];
35+
// if (schemaData[key]) {
36+
// schemaData[key].push(csv.data[i][j]);
37+
// }
38+
// else {
39+
// schemaData[key] = [csv.data[i][j]];
40+
// }
41+
// }
42+
// }
43+
// console.log(schemaData);
44+
// scope.$apply(function() {
45+
// scope.$parent.loadedSchemaData = schemaData;
46+
// scope.$parent.loadedSchemaDataLength = schemaDataLength;
47+
// });
48+
// }
49+
// });
50+
// });
51+
// }
52+
// }
53+
//}]);
54+
55+
deconApp.directive('svgInject', function($compile) {
5356
return {
5457
scope: {
5558
schema: "=schema",

js/filters.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
2+
var deconApp = angular.module('deconApp');
23

3-
restylingApp.filter('range', function() {
4+
deconApp.filter('range', function() {
45
return function(input, total) {
56
total = parseInt(total);
67
for (var i=0; i<total; i++)

js/services.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
var restylingApp = angular.module('restylingApp');
1+
var angular = require('angular');
2+
var _ = require('underscore');
3+
var deconApp = angular.module('deconApp');
24

3-
restylingApp.service('VisDataService', ['Schema', '$rootScope', '$timeout', function(Schema, $rootScope, timer) {
5+
deconApp.service('VisDataService', ['Schema', '$rootScope', '$timeout', function(Schema, $rootScope, timer) {
46
var port;
57
var pageData = [];
68
var visData = [];

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "decon-plugin",
33
"description": "",
44
"version": "0.0.0",
5-
"main": "./js/app-common.js",
5+
"main": "./js/app.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},

0 commit comments

Comments
 (0)