-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ jspm_packages | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Jetbrains | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const path = require('path'); | ||
const express = require('express'); | ||
|
||
const app = express(); | ||
|
||
app.set('views', path.join(__dirname, 'views')); | ||
app.set('view engine', 'pug'); | ||
|
||
app.get('/', (req, res) => res.render('index')); | ||
|
||
app.listen(3000, () => { | ||
// eslint-disable-next-line no-console | ||
console.log('Example app listening on port 3000!'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "pug-form-helper", | ||
"version": "1.0.0", | ||
"description": "create form helper using pug", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/fajardm/pug-form-helper.git" | ||
}, | ||
"keywords": [ | ||
"pug", | ||
"form", | ||
"helper", | ||
"nodejs" | ||
], | ||
"author": "[email protected]", | ||
"license": "GPL-3.0", | ||
"bugs": { | ||
"url": "https://github.com/fajardm/pug-form-helper/issues" | ||
}, | ||
"homepage": "https://github.com/fajardm/pug-form-helper#readme", | ||
"dependencies": { | ||
"express": "^4.15.2", | ||
"pug": "^2.0.0-beta.12" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb": "^14.1.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^4.0.0", | ||
"eslint-plugin-react": "^6.10.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include ../views/mixins/form | ||
|
||
+text_field({name: "email", type: "email"}) | ||
br | ||
+select_tag({name: 'address', items: ['item 1', 'item 2', 'item 3']}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
- Input field | ||
- @params {object} params | ||
// | ||
mixin text_field (params) | ||
- const name = params.name ? params.name : '' | ||
- const label = params.label ? params.label : name | ||
- const placeholder = params.placeholder ? params.placeholder : label | ||
- const type = params.type ? params.type : 'text' | ||
.form-group | ||
label(for=name) #{label} | ||
input.form-control(id=name, name=name, type=type, placeholder=placeholder) | ||
|
||
// | ||
- Select tag | ||
- @params {object} params | ||
// | ||
mixin select_tag (params) | ||
- const name = params.name ? params.name : '' | ||
- const label = params.label ? params.label : name | ||
- const items = Array.isArray(params.items) ? params.items : [params.items] | ||
.form-group | ||
label(for=name) #{label} | ||
select.form-control(id=name, name=name) | ||
each item in items | ||
option #{item} |