JOE
2018-10-23 021a82428aec0b5fcfec2590279bca2bffc22fe3
modify url path
3 files modified
9 ■■■■■ changed files
routes/roles.js 5 ●●●●● patch | view | raw | blame | history
views/roles/create.html 2 ●●● patch | view | raw | blame | history
views/roles/update.html 2 ●●● patch | view | raw | blame | history
routes/roles.js
....@@ -61,9 +61,10 @@
6161 });
6262 });
6363
64
-router.post('/:role_id', function(req, res, next) {
64
+router.post('/', function(req, res, next) {
6565 const data = Object.assign(req.body) || {};
66
- Roles.updateMany({_id: req.params.role_id}, { $set: data}, function(err, response) {
66
+ data.welcome_page_modile = util.generatePath(data.welcome_page_modile);
67
+ Roles.updateMany({_id: data.id}, { $set: data}, function(err, response) {
6768 const param = util.initParam();
6869 if(err) {
6970 param.error = util.errorJson(err).result_msg;
views/roles/create.html
....@@ -1,6 +1,6 @@
11 {{>layout/header-temp}}
22 <div class="content">
3
- <form action="create" method="post">
3
+ <form action="../create" method="post">
44 <h1>Add Role</h1>
55 {{#error}}
66 <h4 class="error">{{error}}</h4>
views/roles/update.html
....@@ -1,6 +1,6 @@
11 {{>layout/header-temp}}
22 <div class="content">
3
- <form method="post">
3
+ <form action="../roles" method="post">
44 <h1>Modify Role</h1>
55 {{#result}}
66 <h4>{{result}}</h4>