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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><%= title %></title> | |
<link rel='stylesheet' href='/stylesheets/style.css' /> | |
<link rel="stylesheet" href="/bootstrap/dist/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="/components-font-awesome/css/font-awesome.min.css"> | |
<script src="/jquery/dist/jquery.min.js"></script> | |
<script src="/bootstrap/dist/js/bootstrap.min.js"></script> | |
</head> |
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
<html> | |
<%- include ../partials/head.ejs %> | |
<body> | |
<div class="container"> | |
<%- include menu.ejs %> | |
<div class="row"> | |
<div class="col-sm-12"> | |
<div class="row" style="background: gray; padding: 8px 0; margin: 8px 0;"> | |
<div class="col-sm-3">Photo</div> | |
<div class="col-sm-2">Name</div> |
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
<html> | |
<%- include ../partials/head.ejs %> | |
<body> | |
<div class="container"> | |
<%- include menu.ejs %> | |
<div class="row well" style="margin-top: 8px;"> | |
<% if (typeof error !== 'undefined') { %> | |
<div class="col-sm-12"> | |
<div class="label label-danger"> | |
<%- error.message %> |
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
<% items.forEach(function(item) { %> | |
<tr> | |
<td width="200px"> | |
<% if(item.photo) { %> | |
<img src="/photo/<%- item.photo %>" style="width: 100%; max-height: 100px;"> | |
<% } else { %> | |
<img src="/img/default.jpg" style="width: 100%; max-height: 100px;"> | |
<% } %> | |
<input type="file" name="photo"> | |
</td> |
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
<script> | |
$(document).ready(function () { | |
var actionForm = $('#actionForm'); | |
var deleteBtn = $('.btn.delete'); | |
var updateBtn = $('.btn.update'); | |
deleteBtn.click(function () { | |
if (!confirm("are you sure?")) { | |
return false; | |
} |
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
<form method="post" action="/admin/item" enctype="multipart/form-data"> | |
<div class="form-group"> | |
<label>種類</label> | |
<select class="form-control" name="type"> | |
<option>特餐</option> | |
<option>飯類</option> | |
<option>麵食</option> | |
<option>水餃</option> | |
<option>炸物</option> | |
<option>湯類</option> |
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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
module.exports = { | |
name: 'Item', | |
schema: new Schema({ | |
type: String, | |
name: String, | |
price: { | |
big: Number, |
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
router.post('/update/:id', upload.single('photo'), function (req, res, next) { | |
var id = req.params.id; | |
var file = req.file; | |
var data = req.body; | |
data.price = { | |
small: data.priceSmall, | |
big: data.priceBig | |
}; |
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
$(document).ready(function () { | |
var vieClick = $('#vieClick'); | |
var account = $('#account'); | |
var password = $('#password'); | |
//var accountFile = $('#account').val(); //放外面,裡面的account:accountFile吃不到 | |
//var passwordFile = $('#password').val(); //同上 | |
//所以要放裡面 | |
vieClick.click(function () { |
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
$(document).ready(function () { | |
var vieClick = $('#vieClick'); | |
var account = $('#account'); | |
var password = $('#password'); | |
var accountFile = $('#account').val(); | |
var passwordFile = $('#password').val(); | |
vieClick.click(function () { |
NewerOlder