Skip to content

Commit a9661d8

Browse files
author
Robert Reppel
committed
UI
1 parent 77a76b9 commit a9661d8

File tree

91 files changed

+291
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+291
-0
lines changed

.eslintrc.json

100644100755
File mode changed.

.gitignore

100644100755
File mode changed.

.idea/jsLibraryMappings.xml

100644100755
File mode changed.

.idea/misc.xml

100644100755
File mode changed.

.idea/modules.xml

100644100755
File mode changed.

.idea/nota.iml

100644100755
File mode changed.

.idea/vcs.xml

100644100755
File mode changed.

.vscode/launch.json

100644100755
File mode changed.

.vscode/settings.json

100644100755
File mode changed.

.vscode/tasks.json

100644100755
File mode changed.

LICENSE

100644100755
File mode changed.

README.md

100644100755
File mode changed.

config/local.json

100644100755
File mode changed.

jsconfig.json

100644100755
File mode changed.

local.postman_environment.json

100644100755
File mode changed.

noneoftheabove.postman_collection.json

100644100755
File mode changed.

nota-eventstorming.jpg

100644100755
File mode changed.

package.json

100644100755
File mode changed.

src/app.js

100644100755
File mode changed.

src/commands/CreateElectionAdmin.js

100644100755
File mode changed.

src/commands/CreateReferendum.js

100644100755
File mode changed.

src/commands/RegisterVoter.js

100644100755
File mode changed.

src/controllers/ElectionAdminController.js

100644100755
File mode changed.

src/controllers/ReferendumController.js

100644100755
File mode changed.

src/domain/ElectionAdmin.js

100644100755
File mode changed.

src/domain/Errors.js

100644100755
File mode changed.

src/domain/MonetaryAmount.js

100644100755
File mode changed.

src/domain/PostalAddress.js

100644100755
File mode changed.

src/domain/Referendum.js

100644100755
File mode changed.

src/domain/Voter.js

100644100755
File mode changed.

src/events/ElectionAdminCreated.js

100644100755
File mode changed.

src/events/ReferendumCreated.js

100644100755
File mode changed.

src/events/TODO/OrganizationCreated.js

100644100755
File mode changed.

src/events/TODO/PollsClosed.js

100644100755
File mode changed.

src/events/TODO/PollsOpened.js

100644100755
File mode changed.

src/events/TODO/ReferendumModified.js

100644100755
File mode changed.

src/events/TODO/VoteCast.js

Whitespace-only changes.

src/events/TODO/VoterAuthenticated.js

100644100755
File mode changed.

src/events/VoterRegistered.js

100644100755
File mode changed.

src/readModels/electionadmin.js

100644100755
File mode changed.

src/readModels/referendum.js

100644100755
File mode changed.

src/services/ReadModelGenericController.js

100644100755
File mode changed.

src/services/ReadRepository.js

100644100755
File mode changed.

src/services/commandHandler.js

100644100755
File mode changed.

src/services/logger.js

100644100755
File mode changed.

src/utils.js

100644100755
File mode changed.

test/electionadmin_test.js

100644100755
File mode changed.

test/referendum_test.js

100644100755
File mode changed.

test/voterregistered_test.js

100644100755
File mode changed.

typings.json

100644100755
File mode changed.

typings/globals/express/index.d.ts

100644100755
File mode changed.

typings/globals/express/typings.json

100644100755
File mode changed.

typings/index.d.ts

100644100755
File mode changed.

typings/modules/body-parser/index.d.ts

100644100755
File mode changed.

typings/modules/body-parser/typings.json

100644100755
File mode changed.

typings/modules/uuid/index.d.ts

100644100755
File mode changed.

typings/modules/uuid/typings.json

100644100755
File mode changed.

typings/modules/validator/index.d.ts

100644100755
File mode changed.

typings/modules/validator/typings.json

100644100755
File mode changed.

web/.eslintrc

100644100755
File mode changed.

web/.gitignore

100644100755
File mode changed.

web/app.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var express = require('express');
2+
var path = require('path');
3+
var favicon = require('serve-favicon');
4+
var logger = require('morgan');
5+
var cookieParser = require('cookie-parser');
6+
var bodyParser = require('body-parser');
7+
8+
var index = require('./routes/index');
9+
var register = require('./routes/register');
10+
11+
var app = express();
12+
13+
// view engine setup
14+
app.set('views', path.join(__dirname, 'views'));
15+
app.set('view engine', 'ejs');
16+
17+
// uncomment after placing your favicon in /public
18+
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
19+
app.use(logger('dev'));
20+
app.use(bodyParser.json());
21+
app.use(bodyParser.urlencoded({ extended: false }));
22+
app.use(cookieParser());
23+
app.use(express.static(path.join(__dirname, 'public')));
24+
25+
app.use('/', index);
26+
app.use('/register', register);
27+
28+
// catch 404 and forward to error handler
29+
app.use(function(req, res, next) {
30+
var err = new Error('Not Found');
31+
err.status = 404;
32+
next(err);
33+
});
34+
35+
// error handler
36+
app.use(function(err, req, res, next) {
37+
// set locals, only providing error in development
38+
res.locals.message = err.message;
39+
res.locals.error = req.app.get('env') === 'development' ? err : {};
40+
41+
// render the error page
42+
res.status(err.status || 500);
43+
res.render('error');
44+
});
45+
46+
module.exports = app;

web/bin/www

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Module dependencies.
5+
*/
6+
7+
var app = require('../app');
8+
var debug = require('debug')('nota:server');
9+
var http = require('http');
10+
11+
/**
12+
* Get port from environment and store in Express.
13+
*/
14+
15+
var port = normalizePort(process.env.PORT || '3000');
16+
app.set('port', port);
17+
18+
/**
19+
* Create HTTP server.
20+
*/
21+
22+
var server = http.createServer(app);
23+
24+
/**
25+
* Listen on provided port, on all network interfaces.
26+
*/
27+
28+
server.listen(port);
29+
server.on('error', onError);
30+
server.on('listening', onListening);
31+
32+
/**
33+
* Normalize a port into a number, string, or false.
34+
*/
35+
36+
function normalizePort(val) {
37+
var port = parseInt(val, 10);
38+
39+
if (isNaN(port)) {
40+
// named pipe
41+
return val;
42+
}
43+
44+
if (port >= 0) {
45+
// port number
46+
return port;
47+
}
48+
49+
return false;
50+
}
51+
52+
/**
53+
* Event listener for HTTP server "error" event.
54+
*/
55+
56+
function onError(error) {
57+
if (error.syscall !== 'listen') {
58+
throw error;
59+
}
60+
61+
var bind = typeof port === 'string'
62+
? 'Pipe ' + port
63+
: 'Port ' + port;
64+
65+
// handle specific listen errors with friendly messages
66+
switch (error.code) {
67+
case 'EACCES':
68+
console.error(bind + ' requires elevated privileges');
69+
process.exit(1);
70+
break;
71+
case 'EADDRINUSE':
72+
console.error(bind + ' is already in use');
73+
process.exit(1);
74+
break;
75+
default:
76+
throw error;
77+
}
78+
}
79+
80+
/**
81+
* Event listener for HTTP server "listening" event.
82+
*/
83+
84+
function onListening() {
85+
var addr = server.address();
86+
var bind = typeof addr === 'string'
87+
? 'pipe ' + addr
88+
: 'port ' + addr.port;
89+
debug('Listening on ' + bind);
90+
}

web/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "nota",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"start": "node ./bin/www"
7+
},
8+
"dependencies": {
9+
"body-parser": "~1.16.0",
10+
"cookie-parser": "~1.4.3",
11+
"debug": "~2.6.0",
12+
"ejs": "~2.5.5",
13+
"express": "~4.14.1",
14+
"morgan": "~1.7.0",
15+
"serve-favicon": "~2.3.2"
16+
}
17+
}

web/public/css/bootstrap-theme.css

100644100755
File mode changed.

web/public/css/bootstrap-theme.css.map

100644100755
File mode changed.

web/public/css/bootstrap-theme.min.css

100644100755
File mode changed.

web/public/css/bootstrap-theme.min.css.map

100644100755
File mode changed.

web/public/css/bootstrap.css

100644100755
File mode changed.

web/public/css/bootstrap.css.map

100644100755
File mode changed.

web/public/css/bootstrap.min.css

100644100755
File mode changed.

web/public/css/bootstrap.min.css.map

100644100755
File mode changed.

web/public/css/jumbotron.css

100644100755
File mode changed.

web/public/fonts/glyphicons-halflings-regular.eot

100644100755
File mode changed.

web/public/fonts/glyphicons-halflings-regular.svg

100644100755
File mode changed.

web/public/fonts/glyphicons-halflings-regular.ttf

100644100755
File mode changed.

web/public/fonts/glyphicons-halflings-regular.woff

100644100755
File mode changed.

web/public/fonts/glyphicons-halflings-regular.woff2

100644100755
File mode changed.

web/public/ie10-viewport-bug-workaround.css

100644100755
File mode changed.

web/public/js/bootstrap.js

100644100755
File mode changed.

web/public/js/bootstrap.min.js

100644100755
File mode changed.

web/public/js/npm.js

100644100755
File mode changed.

web/routes/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var express = require('express');
2+
var router = express.Router();
3+
4+
router.get('/', function(req, res, next) {
5+
res.render('index', { title: 'NOTA - Better Choices, One Democracy At The Time' });
6+
});
7+
8+
module.exports = router;

web/routes/register.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var express = require('express');
2+
var router = express.Router();
3+
4+
router.get('/', function(req, res, next) {
5+
res.render('register', { title: 'NOTA - Voter Registration' });
6+
});
7+
8+
module.exports = router;

web/views/error.ejs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1><%= message %></h1>
2+
<h2><%= error.status %></h2>
3+
<pre><%= error.stack %></pre>

web/views/footer.ejs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
<hr/>
3+
<footer>
4+
<p><a href="https://github.com/Adaptech/nota">NOTA is free and Open Source.</a></p>
5+
</footer>

web/views/head.ejs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<head>
2+
<meta charset="utf-8">
3+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
4+
<meta name="viewport" content="width=device-width, initial-scale=1">
5+
<meta name="description" content="">
6+
<meta name="author" content="">
7+
<link rel="icon" href="favicon.ico">
8+
9+
<title><%= title %></title>
10+
11+
<!-- Latest compiled and minified CSS -->
12+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
13+
14+
<!-- Optional theme -->
15+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
16+
17+
<!-- Latest compiled and minified JavaScript -->
18+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
19+
20+
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
21+
22+
<link href="css/jumbotron.css" rel="stylesheet">
23+
<link href="css/navbar.css" rel="stylesheet">
24+
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
25+
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
26+
<script src="js/ie-emulation-modes-warning.js"></script>
27+
28+
29+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
30+
<!--[if lt IE 9]>
31+
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
32+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
33+
<![endif]-->
34+
</head>
35+

web/views/index.ejs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<%- include('head') %>
5+
<body>
6+
<%- include('navbar') %>
7+
<div class="jumbotron">
8+
<div class="container">
9+
<h1>Better Choices For The Electorate.</h1>
10+
<p>Let's improve democracy.</p>
11+
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p>
12+
</div>
13+
</div>
14+
15+
<div class="container">
16+
<div class="row">
17+
<div class="col-md-4">
18+
<h2>The real power:<br/>Choosing the choices</h2>
19+
<p>Two or three parties for millions of voters. Candidates chosen behind the scenes. Power to vote for the slightly less unacceptable choice with little say of who is on the ballot.</p>
20+
</div>
21+
<div class="col-md-4">
22+
<h2>"None Of The Above"</h2>
23+
<p>Whatever you put to the vote, whatever choices you give, there will always be an additional one: <strong>None Of The Above</strong> is an online voting platform and it does this, built into the system, with no possibility to override it.</p>
24+
</div>
25+
<div class="col-md-4">
26+
<h2>Distilling the best options, getting the best candidates.</h2>
27+
<p><strong>Your election is invalid: More than half of the votes were "none of the above".</strong>. That's how it works - if a simple majority of voters rejects all candidates, the referendum is nil and void: Improve the options, improve the question, then try again. With luck, eventually we'll get the best, most qualified people and the closest thing to what voters actually want.</p>
28+
</div>
29+
</div>
30+
<%- include('footer') %>
31+
</div> <!-- /container -->
32+
<%- include('scripts') %>
33+
</body>
34+
</html>
35+

web/views/navbar.ejs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
2+
<div class="container">
3+
<div class="navbar-header">
4+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
5+
<span class="sr-only">Toggle navigation</span>
6+
<span class="icon-bar"></span>
7+
<span class="icon-bar"></span>
8+
<span class="icon-bar"></span>
9+
</button>
10+
<a class="navbar-brand" href="/">None Of The Above</a>
11+
</div>
12+
<div id="navbar" class="navbar-collapse collapse">
13+
<ul class="nav navbar-nav navbar-right">
14+
<li><a href="/register">Register</a></li>
15+
<li><a href="/register">About Us</a></li>
16+
</ul>
17+
</div><!--/.navbar-collapse -->
18+
<b class="caret"></b>
19+
</div>
20+
</nav>

web/views/register.ejs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<%- include('head') %>
5+
<body>
6+
<%- include('navbar') %>
7+
8+
9+
<div class="container">
10+
Voter registration.
11+
12+
<%- include('footer') %>
13+
</div> <!-- /container -->
14+
<%- include('scripts') %>
15+
</body>
16+
</html>
17+

web/views/scripts.ejs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
2+
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
3+
4+
5+
6+
<script src="js/ie10-viewport-bug-workaround.js"></script>
7+

0 commit comments

Comments
 (0)