Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Moffat authored and Mark Moffat committed Mar 7, 2020
1 parent 1d4d751 commit e64905e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions public/javascripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ $(document).ready(function (){
});
});

$(document).on('click', '#btnUserAdd', function(e){
$('#userNewForm').submit();
});

$('#userNewForm').validator().on('submit', function(e){
if(!e.isDefaultPrevented()){
e.preventDefault();
Expand Down Expand Up @@ -161,6 +165,10 @@ $(document).ready(function (){
}
});

$(document).on('click', '#btnUserEdit', function(e){
$('#userEditForm').submit();
});

$('#userEditForm').validator().on('submit', function(e){
if(!e.isDefaultPrevented()){
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/admin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ router.get('/:page?', async (req, res, next) => {
return;
}
// lets look for a page
const page = db.pages.findOne({ pageSlug: req.params.page, pageEnabled: 'true' });
const page = await db.pages.findOne({ pageSlug: req.params.page, pageEnabled: 'true' });
// if we have a page lets render it, else throw 404
if(page){
res.render(`${config.themeViews}page`, {
Expand Down
2 changes: 1 addition & 1 deletion views/user-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="col-md-12">
<div class="page-header">
<div class="float-right">
<button type="submit" class="btn btn-outline-success">{{ @root.__ "Update" }}</button>
<button type="submit" id="btnUserEdit" class="btn btn-outline-success">{{ @root.__ "Update" }}</button>
</div>
<h2>{{ @root.__ "User edit" }}</h2>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/user-new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="col-12">
<div class="page-header">
<div class="float-right">
<button type="submit" class="btn btn-outline-success">{{ @root.__ "Create" }}</button>
<button type="submit" id="btnUserAdd" class="btn btn-outline-success">{{ @root.__ "Create" }}</button>
</div>
<h2>{{ @root.__ "New User" }}</h2>
</div>
Expand Down

0 comments on commit e64905e

Please sign in to comment.