diff --git a/NodeAPI/index.js b/NodeAPI/index.js index 46e57cc3e68bd5b4d6832345b5a567432df83eef..1e2f3daceee0a15819624dd27a1d614305996ca6 100644 --- a/NodeAPI/index.js +++ b/NodeAPI/index.js @@ -52,6 +52,8 @@ app.post('/predict', (req,res) => { // Insert the record to the collection, throw error if insert unsuccessful collection.insert(rec, {w:1}, function(err, result) {}); + }, function(){ + db.close(); }); res.render('predictions',{predictions:JSON.parse(JSON.parse(body).predictionText)}) @@ -61,9 +63,21 @@ app.post('/predict', (req,res) => { console.log(req.body.plot) // res.render('index', {}); - }); - - - +app.get('/submissions', function (req, res) { + var resultArray = []; + /**MongoClient.connect(url, function(err, database) { + if(err) { return console.dir(err); } + + var cursor = database.db().collection('Pred_Records').find() + cursor.forEach(function(doc, err){ + resultArray.push(doc) + }, function(){ + db.close(); + res.render('submissions', {items: resultArray}); + }); + });**/ + res.render('submissions', {}); + +}); \ No newline at end of file diff --git a/NodeAPI/public/css/style.css b/NodeAPI/public/css/style.css index b6f0933e70578175e6e9a0ca960a2965d9db1a58..e71915c962dbb1fc6e51c8ee28f739ddc23d8c59 100644 --- a/NodeAPI/public/css/style.css +++ b/NodeAPI/public/css/style.css @@ -71,7 +71,8 @@ fieldset { -ms-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out; transition: all 0.1s ease-in-out; - color: black; + color: #444; + margin-top: 4%; } .ghost-button:hover { border:2px solid #e95e01; @@ -86,7 +87,6 @@ p { width: 100%; height: 100%; color: white; - display: grid; background-size: 300% 300%; /* background-image: linear-gradient( -90deg, @@ -132,4 +132,45 @@ p { border-color: #007299; color: #007299; box-shadow: none; +} + +/* Add a black background color to the top navigation */ +.topnav { + background-color: cornflowerblue; + overflow: hidden; +} + +/* Style the links inside the navigation bar */ +.topnav a { + float: left; + color: #f2f2f2; + text-align: center; + padding: 14px 16px; + text-decoration: none; + font-size: 1.3em; + font-family: Calibri, 'Trebuchet MS', sans-serif; + font-weight: bold; +} + +/* Change the color of links on hover */ +.topnav a:hover { + background-color: #ddd; + color: #e95e01; +} + +/* Add a color to the active/current link */ +.topnav a.active { + background-color: #e95e01; + color: white; +} + +.title{ + color: cornflowerblue; + font-size: 2.2em; + margin-top: 5%; +} + +.subtitle{ + color: #e95e01; + font-size: 1.2em; } \ No newline at end of file diff --git a/NodeAPI/views/index.ejs b/NodeAPI/views/index.ejs index 0ad075c2845356d49185883ecfe0dcf95f107886..fa58fa4e0362edc7f631f0807842e34b1dc3d046 100644 --- a/NodeAPI/views/index.ejs +++ b/NodeAPI/views/index.ejs @@ -13,10 +13,14 @@ </head> <div class="bg"> + <div class="topnav"> + <a class="active" href="/">NLP11</a> + <a href="/submissions">Submissions</a> + </div> <body class="text-center" > <div class="row"> - <h1 style="color: cornflowerblue;">NLP Group 11: Predict movie genres by plot</h1> - <b style="color: #e95e01; font-size: large;">Enter a movie plot text to receive a prediction of the grenre(s)</b> <br> + <h1 class="title">NLP Group 11: Predict movie genres by plot</h1> + <b class="subtitle">Enter a movie plot text to receive a prediction of the grenre(s)</b> <br> <!-- <h2>Enter plot text</h2> --> <!-- <div>Any Address holding a balance of SIMP is able allow the backend to burn their tokens. <b>MAKE SURE METAMASK BROWSER EXTENSION IS CONNECTED TO THE WEBSITE (TOP RIGHT)</b></div> --> diff --git a/NodeAPI/views/predictions.ejs b/NodeAPI/views/predictions.ejs index 8dda37800fffb9b47351b575e04c95c2d265d9eb..bc90bf58425b560a406aa84cee3aeb42217d711e 100644 --- a/NodeAPI/views/predictions.ejs +++ b/NodeAPI/views/predictions.ejs @@ -15,6 +15,10 @@ </head> <div class="bg"> + <div class="topnav"> + <a href="/">NLP11</a> + <a href="/submissions">Submissions</a> + </div> <body class="text-center" > <div class="row"> <h1 style="color: cornflowerblue;">Predicted Genres</h1> diff --git a/NodeAPI/views/submissions.ejs b/NodeAPI/views/submissions.ejs new file mode 100644 index 0000000000000000000000000000000000000000..d85468f456f5dcb38d298098ae5dbc64010127c6 --- /dev/null +++ b/NodeAPI/views/submissions.ejs @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> + <head> + <title>NLP Demo</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" type="text/css" href="/css/style.css"> + <link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'> + <!-- Latest compiled and minified CSS --> + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> + <!-- jQuery library --> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> + </head> + + <div class="bg"> + <div class="topnav"> + <a href="/">NLP11</a> + <a class="active" href="/submissions">Submissions</a> + </div> + <body class="text-center" > + + </body> + </div> +</html> +