Skip to content

Commit

Permalink
create add product form #53
Browse files Browse the repository at this point in the history
  • Loading branch information
jwld committed Jun 7, 2017
1 parent 9acd0cd commit 7c0f060
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 6 deletions.
3 changes: 3 additions & 0 deletions public/scripts/new_product.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function() {
console.log(123);
})();
2 changes: 1 addition & 1 deletion public/style/sass/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
}

input, textarea {
input, textarea, select {
width: 100%;
margin-top: .5rem;
padding: .5rem 0;
Expand Down
2 changes: 1 addition & 1 deletion public/style/sass/_reset.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
body, header, h1, a, div, input, textarea, p {
body, header, h1, a, div, input, textarea, p, select {
margin: 0;
padding: 0;
border: 0;
Expand Down
5 changes: 5 additions & 0 deletions src/routes/new_product.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = (req, res) => {
res.render('new_product', {
title: 'Add New Product'
});
};
7 changes: 4 additions & 3 deletions src/routes/router.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const router = require('express').Router();
const auth = require('./validate.js');

router.post('/authenticate', require('./authenticate'));
router.post('/authenticate', require('./authenticate.js'));
router.get('/', require('./home.js'));
router.get('/register', require('./register.js'));
router.get('/login', require('./login.js'));
router.get('/create', auth, require('./create.js'));
router.get('/sign-s3', require('./sign_s3'));
router.get('/sign-s3', require('./sign_s3.js'));
router.post('/add-user', require('./add_user.js'));
router.post('/add-profile', require('./add_profile.js'));
router.get('/profile', require('./profile'));
router.get('/profile', require('./profile.js'));
router.get('/new-product', require('./new_product.js'));

module.exports = router;
34 changes: 34 additions & 0 deletions views/new_product.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{>header}}

<div class="page-content">
<form class="form" id="product-form" autocomplete="off">
<div class="form-input-wrap">
<label>Product Name
<input type="text" name="product">
</label>

<label>Category
<select class="input-field" name="category">
<option value="">Please Select</option>
<option value="Jewellery">Jewellery</option>
<option value="Crochet">Crochet</option>
<option value="Calligraphy">Calligraphy</option>
<option value="Embroidery">Embroidery</option>
<option value="Metalworking">Metalworking</option>
</select>
</label>

<label class="textarea-label">Description
<span class="char-count" id="about-char-count">100</span>
<textarea name="description" rows="3" maxlength="100" id="about-text"></textarea>
</label>

<label>Price
<input class="input-field" type="number" min="1" name="price" step="any">
</label>
</div>
<input id="submit" type="submit" value="SUBMIT">
</form>
</div>

<script type="text/javascript" src="./scripts/new_product.js"></script>
2 changes: 1 addition & 1 deletion views/partials/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1 class="page-title">{{title}}</h1>
<div class="nav-button-wrap">
{{#if user}}
<a class="nav-button fa fa-plus" id="nav-button" href="/add-product"></a>
<a class="nav-button fa fa-plus" id="nav-button" href="/new-product"></a>
{{/if}}
<a class="nav-button fa fa-home" id="nav-button" href="/"></a>
</div>
Expand Down

0 comments on commit 7c0f060

Please sign in to comment.