Skip to content
This repository was archived by the owner on Jan 30, 2022. It is now read-only.

Commit 18d4427

Browse files
committed
spaces to tabs
1 parent be9e873 commit 18d4427

File tree

8 files changed

+255
-254
lines changed

8 files changed

+255
-254
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var express = require('express'),
2-
bodyParser = require('body-parser'),
3-
talksCtrl = require('./talks-ctrl.js'),
4-
morgan = require('morgan'),
5-
requestIp = require('request-ip');
2+
bodyParser = require('body-parser'),
3+
talksCtrl = require('./talks-ctrl.js'),
4+
morgan = require('morgan'),
5+
requestIp = require('request-ip');
66

77
var app = express();
88

@@ -45,5 +45,5 @@ app.post('/api/unhideTalk', talksCtrl.updateTalk);
4545

4646
// start the server
4747
app.listen(3000, () => {
48-
console.log('Server listening on port 3000, press ctrl-C to quit...');
48+
console.log('Server listening on port 3000, press ctrl-C to quit...');
4949
});

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"name": "node-talks",
3-
"version": "1.0.0",
4-
"description": "A clone of the COSI talks flask app",
5-
"main": "index.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
9-
"author": "Benjamin Lannon",
10-
"license": "MIT",
11-
"dependencies": {
12-
"body-parser": "^1.15.0",
13-
"express": "^4.13.4",
14-
"gulp": "^3.9.1",
15-
"gulp-jshint": "^2.0.0",
16-
"insubnet": "0.0.8",
17-
"jshint": "^2.9.1",
18-
"jshint-stylish": "^2.1.0",
19-
"morgan": "^1.7.0",
20-
"promise": "^7.1.1",
21-
"pug": "^2.0.0-alpha7",
22-
"request-ip": "^1.2.2",
23-
"sequelize": "^3.19.3",
24-
"sqlite3": "^3.1.1"
25-
}
2+
"name": "node-talks",
3+
"version": "1.0.0",
4+
"description": "A clone of the COSI talks flask app",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "Benjamin Lannon",
10+
"license": "MIT",
11+
"dependencies": {
12+
"body-parser": "^1.15.0",
13+
"express": "^4.13.4",
14+
"gulp": "^3.9.1",
15+
"gulp-jshint": "^2.0.0",
16+
"insubnet": "0.0.8",
17+
"jshint": "^2.9.1",
18+
"jshint-stylish": "^2.1.0",
19+
"morgan": "^1.7.0",
20+
"promise": "^7.1.1",
21+
"pug": "^2.0.0-alpha7",
22+
"request-ip": "^1.2.2",
23+
"sequelize": "^3.19.3",
24+
"sqlite3": "^3.1.1"
25+
}
2626
}

public/css/app.css

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import url("https://fonts.googleapis.com/css?family=Open+Sans");
22

33
body {
4-
font-family: "Open Sans";
4+
font-family: "Open Sans";
55
background-color: #78909c;
66
color: white;
77
margin: 0;
@@ -12,25 +12,25 @@ body {
1212
h1 {
1313
font-size: 48px;
1414
text-align: center;
15-
margin-bottom: 0px;
15+
margin-bottom: 0px;
1616
}
1717

1818
td.hides {
19-
clear: both;
19+
clear: both;
2020
}
2121

2222
td.hides button {
23-
display: inline;
24-
float: left;
25-
background: 0;
26-
/*border: 0;
27-
outline: 0;*/
28-
color: white;
23+
display: inline;
24+
float: left;
25+
background: 0;
26+
/*border: 0;
27+
outline: 0;*/
28+
color: white;
2929

30-
&:hover {
31-
background: white;
32-
color: #78909c;
33-
}
30+
&:hover {
31+
background: white;
32+
color: #78909c;
33+
}
3434
}
3535

3636
h3 {
@@ -39,9 +39,9 @@ h3 {
3939
}
4040

4141
h5 {
42-
font-size: 16px;
43-
font-weight: bolder;
44-
text-align: center;
42+
font-size: 16px;
43+
font-weight: bolder;
44+
text-align: center;
4545
}
4646

4747
#nav {
@@ -70,6 +70,7 @@ h5 {
7070
}
7171

7272
#talks-table {
73+
color: white;
7374
width: 80%;
7475
margin: 0 auto;
7576
font-size: 120%;

public/js/app.js

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
var app = angular.module('talksApp', []);
22

33
function getTalks($scope, $http) {
4-
// send the GET request
5-
$http.get("/api/talks").success(data => {
6-
$scope.talks = data; // Set the scope's talks to be the output of the api call
7-
});
4+
// send the GET request
5+
$http.get("/api/talks").success(data => {
6+
$scope.talks = data; // Set the scope's talks to be the output of the api call
7+
});
88
}
99

1010
function postTalk($scope, $http) {
11-
// Set the data to be sent through the request to be the newTalk object
12-
var data = $scope.newTalk;
11+
// Set the data to be sent through the request to be the newTalk object
12+
var data = $scope.newTalk;
1313

14-
// Send the POST request
15-
$http.post("/api/postTalk", data).then(response => {
16-
$scope.talks = response.data; // Set the scope's talks to be the output of the api call
17-
}, error => {
18-
alert("Talk submissions are only allowed in the 128.153.0.0/16 subnet");
19-
});
14+
// Send the POST request
15+
$http.post("/api/postTalk", data).then(response => {
16+
$scope.talks = response.data; // Set the scope's talks to be the output of the api call
17+
}, error => {
18+
alert("Talk submissions are only allowed in the 128.153.0.0/16 subnet");
19+
});
2020
}
2121

2222
function hideTalk($scope, $http) {
23-
var data = {
24-
talkId: $scope.id,
25-
hiddenStatus: true
26-
};
23+
var data = {
24+
talkId: $scope.id,
25+
hiddenStatus: true
26+
};
2727

28-
$http.post("/api/hideTalk", data).then(response => {
29-
$scope.talks = response.data;
30-
}, error => {
31-
alert("Talk modifications are only allowed in the 128.153.0.0/16 subnet");
32-
});
28+
$http.post("/api/hideTalk", data).then(response => {
29+
$scope.talks = response.data;
30+
}, error => {
31+
alert("Talk modifications are only allowed in the 128.153.0.0/16 subnet");
32+
});
3333
}
3434

3535
function unhideTalk($scope, $http) {
36-
var data = {
37-
talkId: $scope.id,
38-
hiddenStatus: false
39-
};
36+
var data = {
37+
talkId: $scope.id,
38+
hiddenStatus: false
39+
};
4040

41-
$http.post("/api/unhideTalk", data).then(response => {
42-
$scope.talks = response.data;
43-
}, error => {
44-
alert("Talk modifications are only allowed in the 128.153.0.0/16 subnet");
45-
});
41+
$http.post("/api/unhideTalk", data).then(response => {
42+
$scope.talks = response.data;
43+
}, error => {
44+
alert("Talk modifications are only allowed in the 128.153.0.0/16 subnet");
45+
});
4646
}
4747

4848
// The main controller for the page
4949
app.controller('talksController', ($scope, $http) => {
50-
getTalks($scope, $http); // Always load in talks at startup
50+
getTalks($scope, $http); // Always load in talks at startup
5151

52-
// Send a http POST request to create a new talk
53-
$scope.createTalk = () => {
54-
postTalk($scope, $http);
55-
$scope.newTalk = {}; // Clear out the input boxes
56-
};
52+
// Send a http POST request to create a new talk
53+
$scope.createTalk = () => {
54+
postTalk($scope, $http);
55+
$scope.newTalk = {}; // Clear out the input boxes
56+
};
5757

58-
// Hide a certain talk
59-
$scope.hide = (id) => {
60-
$scope.id = id;
61-
hideTalk($scope, $http);
62-
};
58+
// Hide a certain talk
59+
$scope.hide = (id) => {
60+
$scope.id = id;
61+
hideTalk($scope, $http);
62+
};
6363

64-
// unhide a certain talk
65-
$scope.unhide = (id) => {
66-
$scope.id = id;
67-
unhideTalk($scope, $http);
68-
};
64+
// unhide a certain talk
65+
$scope.unhide = (id) => {
66+
$scope.id = id;
67+
unhideTalk($scope, $http);
68+
};
6969
});

talks-ctrl.js

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,78 +2,78 @@ var Sequelize = require('sequelize');
22
var inSubnet = require('insubnet');
33

44
module.exports.getTalks = (req, res) => {
5-
let sequelize = connectToServer();
6-
let talksModel = sequelize.import(__dirname + "/talks-model.js");
7-
loadTalks(talksModel, res);
5+
let sequelize = connectToServer();
6+
let talksModel = sequelize.import(__dirname + "/talks-model.js");
7+
loadTalks(talksModel, res);
88
};
99

1010
module.exports.getVisibleTalks = (req, res) => {
11-
let sequelize = connectToServer();
12-
let talksModel = sequelize.import(__dirname + "/talks-model.js");
13-
loadVisibleTalks(talksModel, res);
11+
let sequelize = connectToServer();
12+
let talksModel = sequelize.import(__dirname + "/talks-model.js");
13+
loadVisibleTalks(talksModel, res);
1414
}
1515

1616
module.exports.createTalk = (req, res) => {
17-
if(!inSubnet.IPv4(req.clientIp, '128.153.0.0/16')) {
18-
res.sendStatus(500);
19-
return;
20-
}
17+
if(!inSubnet.IPv4(req.clientIp, '128.153.0.0/16')) {
18+
res.sendStatus(500);
19+
return;
20+
}
2121

22-
let sequelize = connectToServer();
23-
let talksModel = sequelize.import(__dirname + "/talks-model.js");
22+
let sequelize = connectToServer();
23+
let talksModel = sequelize.import(__dirname + "/talks-model.js");
2424

25-
// write the new talk to the server
26-
return talksModel.sync().then(() => {
27-
// create an instance of the model and save to the db
28-
talksModel.create({name: req.body.name, type: req.body.type, desc: req.body.desc}, {
29-
fields: ['id', 'name', 'type', 'desc']
30-
}).then(data => {
31-
// reload the talks
32-
loadTalks(talksModel, res);
33-
});
34-
});
25+
// write the new talk to the server
26+
return talksModel.sync().then(() => {
27+
// create an instance of the model and save to the db
28+
talksModel.create({name: req.body.name, type: req.body.type, desc: req.body.desc}, {
29+
fields: ['id', 'name', 'type', 'desc']
30+
}).then(data => {
31+
// reload the talks
32+
loadTalks(talksModel, res);
33+
});
34+
});
3535
};
3636

3737
module.exports.updateTalk = (req, res) => {
38-
if(!inSubnet.IPv4(req.clientIp, '128.153.0.0/16')) {
39-
res.sendStatus(500);
40-
return;
41-
}
38+
if(!inSubnet.IPv4(req.clientIp, '128.153.0.0/16')) {
39+
res.sendStatus(500);
40+
return;
41+
}
4242

43-
let sequelize = connectToServer();
44-
let talksModel = sequelize.import(__dirname + "/talks-model.js");
43+
let sequelize = connectToServer();
44+
let talksModel = sequelize.import(__dirname + "/talks-model.js");
4545

46-
return talksModel.sync().then(() => {
47-
return talksModel.update(
48-
{ hidden: req.body.hiddenStatus },
49-
{ where: { id: req.body.talkId }}
50-
);
51-
}).then(() => {
52-
loadTalks(talksModel, res);
53-
});
46+
return talksModel.sync().then(() => {
47+
return talksModel.update(
48+
{ hidden: req.body.hiddenStatus },
49+
{ where: { id: req.body.talkId }}
50+
);
51+
}).then(() => {
52+
loadTalks(talksModel, res);
53+
});
5454
};
5555

5656
// Send a SELECT query to the database and return the response as JSON
5757
function loadTalks(model, res) {
58-
return model.findAll({
59-
attributes: ['id', 'name', 'type', 'desc', 'hidden']
60-
}).then(result => {
61-
return res.json(result);
62-
});
58+
return model.findAll({
59+
attributes: ['id', 'name', 'type', 'desc', 'hidden']
60+
}).then(result => {
61+
return res.json(result);
62+
});
6363
}
6464

6565
function loadVisibleTalks(model, res) {
66-
return model.findAll({
67-
attributes: ['id', 'name', 'type', 'desc', 'hidden'],
68-
where: {hidden: false}
69-
}).then(result => {
70-
return res.json(result);
71-
});
66+
return model.findAll({
67+
attributes: ['id', 'name', 'type', 'desc', 'hidden'],
68+
where: {hidden: false}
69+
}).then(result => {
70+
return res.json(result);
71+
});
7272
}
7373

7474
function connectToServer() {
75-
return new Sequelize('database', 'username', 'password', {
76-
dialect: 'sqlite',
77-
storage: './talks.db'
78-
});
75+
return new Sequelize('database', 'username', 'password', {
76+
dialect: 'sqlite',
77+
storage: './talks.db'
78+
});
7979
}

0 commit comments

Comments
 (0)