barcode: switch to location with user
This commit is contained in:
parent
38e91a20b5
commit
fafb1548cb
6 changed files with 19 additions and 1 deletions
|
@ -36,6 +36,7 @@ import Handler.Summary
|
||||||
import Handler.Modify
|
import Handler.Modify
|
||||||
import Handler.CashCheck
|
import Handler.CashCheck
|
||||||
import Handler.Avatar
|
import Handler.Avatar
|
||||||
|
import Handler.Barcode
|
||||||
|
|
||||||
-- This line actually creates our YesodDispatch instance. It is the second half
|
-- This line actually creates our YesodDispatch instance. It is the second half
|
||||||
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
|
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
|
||||||
|
|
10
Handler/Barcode.hs
Normal file
10
Handler/Barcode.hs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module Handler.Barcode where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Handler.Common
|
||||||
|
import qualified Data.Text as T
|
||||||
|
import Text.Blaze.Internal
|
||||||
|
import Text.Shakespeare.Text
|
||||||
|
|
||||||
|
getBarcodeR :: UserId -> Text -> Handler Html
|
||||||
|
getBarcodeR uId barcode = undefined
|
|
@ -30,3 +30,4 @@
|
||||||
/avatar/#AvatarId/modify ModifyAvatarR GET POST
|
/avatar/#AvatarId/modify ModifyAvatarR GET POST
|
||||||
/avatar/#AvatarId/delete AvatarDeleteR GET
|
/avatar/#AvatarId/delete AvatarDeleteR GET
|
||||||
/newavatar NewAvatarR GET POST
|
/newavatar NewAvatarR GET POST
|
||||||
|
/user/#UserId/barcode/#Text BarcodeR GET
|
||||||
|
|
|
@ -11,7 +11,10 @@ function showBarcode(text) {
|
||||||
function barcodeKeyPress(event) {
|
function barcodeKeyPress(event) {
|
||||||
var key = String.fromCharCode(event.charCode)
|
var key = String.fromCharCode(event.charCode)
|
||||||
if (event.keyCode === 13) {
|
if (event.keyCode === 13) {
|
||||||
// window.location = "" + barcodeBuf
|
var uid = document.getElementById('uid').getAttribute('value')
|
||||||
|
if (uid) {
|
||||||
|
window.location = "/user/" + encodeURIComponent(uid) + "/barcode/" + encodeURIComponent(barcodeBuf)
|
||||||
|
}
|
||||||
barcodeBuf = ""
|
barcodeBuf = ""
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,3 +25,5 @@ $forall (Entity bId bev) <- beverages
|
||||||
$else
|
$else
|
||||||
<a href=@{BuyR uId bId}>
|
<a href=@{BuyR uId bId}>
|
||||||
<p>#{beverageIdent bev}
|
<p>#{beverageIdent bev}
|
||||||
|
|
||||||
|
<input type=hidden id=uid value=#{toPathPiece uId}>
|
||||||
|
|
|
@ -31,6 +31,7 @@ library
|
||||||
Handler.Modify
|
Handler.Modify
|
||||||
Handler.CashCheck
|
Handler.CashCheck
|
||||||
Handler.Avatar
|
Handler.Avatar
|
||||||
|
Handler.Barcode
|
||||||
|
|
||||||
if flag(dev) || flag(library-only)
|
if flag(dev) || flag(library-only)
|
||||||
cpp-options: -DDEVELOPMENT
|
cpp-options: -DDEVELOPMENT
|
||||||
|
|
Loading…
Reference in a new issue