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.CashCheck
|
||||
import Handler.Avatar
|
||||
import Handler.Barcode
|
||||
|
||||
-- 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
|
||||
|
|
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/delete AvatarDeleteR GET
|
||||
/newavatar NewAvatarR GET POST
|
||||
/user/#UserId/barcode/#Text BarcodeR GET
|
||||
|
|
|
@ -11,7 +11,10 @@ function showBarcode(text) {
|
|||
function barcodeKeyPress(event) {
|
||||
var key = String.fromCharCode(event.charCode)
|
||||
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 = ""
|
||||
event.preventDefault()
|
||||
} else {
|
||||
|
|
|
@ -25,3 +25,5 @@ $forall (Entity bId bev) <- beverages
|
|||
$else
|
||||
<a href=@{BuyR uId bId}>
|
||||
<p>#{beverageIdent bev}
|
||||
|
||||
<input type=hidden id=uid value=#{toPathPiece uId}>
|
||||
|
|
|
@ -31,6 +31,7 @@ library
|
|||
Handler.Modify
|
||||
Handler.CashCheck
|
||||
Handler.Avatar
|
||||
Handler.Barcode
|
||||
|
||||
if flag(dev) || flag(library-only)
|
||||
cpp-options: -DDEVELOPMENT
|
||||
|
|
Loading…
Reference in a new issue