From 2879be0b27bfcd51956c97d9da77a8ada25b6b18 Mon Sep 17 00:00:00 2001 From: MaryChes Date: Thu, 8 Sep 2016 16:36:15 -0400 Subject: [PATCH 1/6] reconfigured the create and read .ejs and controller files to sync with movie database api --- ...ployeeController.js => MovieController.js} | 14 +++--- config/routes.js | 8 ++-- views/create.ejs | 48 +++++++------------ views/layout.ejs | 2 +- views/read.ejs | 34 +++++++------ 5 files changed, 44 insertions(+), 62 deletions(-) rename api/controllers/{EmployeeController.js => MovieController.js} (84%) diff --git a/api/controllers/EmployeeController.js b/api/controllers/MovieController.js similarity index 84% rename from api/controllers/EmployeeController.js rename to api/controllers/MovieController.js index 080fe65..c9f00da 100644 --- a/api/controllers/EmployeeController.js +++ b/api/controllers/MovieController.js @@ -7,12 +7,12 @@ var Client = require('node-rest-client').Client; var client = new Client(); -var endpoint = "http://localhost:1337/employee" +var endpoint = "http://localhost:1337/movies" module.exports = { /** - * `EmployeeController.create()` + * `MovieController.create()` */ create: function (req, res) { @@ -39,21 +39,21 @@ module.exports = { /** - * `EmployeeController.read()` + * `MovieController.read()` */ read: function (req, res) { client.get(endpoint, function (data, response) { - return res.view('read', {employees: data}); + return res.view('read', {movies: data}); }).on('error', function (err) { - return res.view('read', {error: { message: "There was an error getting the employees"}}); + return res.view('read', {error: { message: "There was an error getting the records"}}); }); }, /** - * `EmployeeController.update()` + * `MovieController.update()` */ update: function (req, res) { return res.json({ @@ -63,7 +63,7 @@ module.exports = { /** - * `EmployeeController.delete()` + * `MovieController.delete()` */ delete: function (req, res) { return res.json({ diff --git a/config/routes.js b/config/routes.js index 1910d03..b1af5fb 100644 --- a/config/routes.js +++ b/config/routes.js @@ -32,10 +32,10 @@ module.exports.routes = { * * ***************************************************************************/ - '/create':'EmployeeController.create', - '/' :'EmployeeController.read', - '/update':'EmployeeController.update', - '/delete':'EmployeeController.delete' + '/create':'MovieController.create', + '/' :'MovieController.read', + '/update':'MovieController.update', + '/delete':'MovieController.delete' /*************************************************************************** * * diff --git a/views/create.ejs b/views/create.ejs index 9c8491f..c8a5b8f 100644 --- a/views/create.ejs +++ b/views/create.ejs @@ -1,69 +1,53 @@
<%- partial ('partials/statusmessage.ejs') %> -

Add Employee

+

Add Movie

- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- - Password at least 8 characters, 1 upppercase, 1 lowercase, and one number + + Score must be entered as a rational number between 0-10. (#.#)
-
- -
-
- -
-
-
-
-
- +
\ No newline at end of file diff --git a/views/layout.ejs b/views/layout.ejs index 9a06b59..bac8464 100644 --- a/views/layout.ejs +++ b/views/layout.ejs @@ -4,7 +4,7 @@ - Employee Admin + Movie IMBD Database - + <%- partial ('partials/navigation.ejs') %> diff --git a/views/partials/navigation.ejs b/views/partials/navigation.ejs index 0b10b12..ae15dd0 100644 --- a/views/partials/navigation.ejs +++ b/views/partials/navigation.ejs @@ -1,4 +1,4 @@ -