barcode submission with hidden forms
This commit is contained in:
parent
fafb1548cb
commit
5b444ce17e
5 changed files with 17 additions and 7 deletions
|
@ -6,5 +6,8 @@ import qualified Data.Text as T
|
|||
import Text.Blaze.Internal
|
||||
import Text.Shakespeare.Text
|
||||
|
||||
getBarcodeR :: UserId -> Text -> Handler Html
|
||||
getBarcodeR uId barcode = undefined
|
||||
postHomeBarcodeR :: Handler Html
|
||||
postHomeBarcodeR = return mempty
|
||||
|
||||
postSelectBarcodeR :: UserId -> Handler Html
|
||||
postSelectBarcodeR uId = return mempty
|
||||
|
|
|
@ -30,4 +30,5 @@
|
|||
/avatar/#AvatarId/modify ModifyAvatarR GET POST
|
||||
/avatar/#AvatarId/delete AvatarDeleteR GET
|
||||
/newavatar NewAvatarR GET POST
|
||||
/user/#UserId/barcode/#Text BarcodeR GET
|
||||
/barcode HomeBarcodeR POST
|
||||
/user/#UserId/barcode SelectBarcodeR POST
|
||||
|
|
|
@ -11,9 +11,11 @@ function showBarcode(text) {
|
|||
function barcodeKeyPress(event) {
|
||||
var key = String.fromCharCode(event.charCode)
|
||||
if (event.keyCode === 13) {
|
||||
var uid = document.getElementById('uid').getAttribute('value')
|
||||
if (uid) {
|
||||
window.location = "/user/" + encodeURIComponent(uid) + "/barcode/" + encodeURIComponent(barcodeBuf)
|
||||
var input = document.getElementById('barcodeInput')
|
||||
if (input) {
|
||||
input.setAttribute('value', barcodeBuf)
|
||||
input.parentNode.submit()
|
||||
return
|
||||
}
|
||||
barcodeBuf = ""
|
||||
event.preventDefault()
|
||||
|
|
|
@ -23,3 +23,6 @@ $forall (Entity uId user) <- users
|
|||
<article .article #func>
|
||||
<a href=@{ReactivateR}>
|
||||
<p>_{MsgReactivateOldUser}
|
||||
|
||||
<form action=@{HomeBarcodeR} method=POST>
|
||||
<input type=hidden #barcodeInput name=barcode>
|
||||
|
|
|
@ -26,4 +26,5 @@ $forall (Entity bId bev) <- beverages
|
|||
<a href=@{BuyR uId bId}>
|
||||
<p>#{beverageIdent bev}
|
||||
|
||||
<input type=hidden id=uid value=#{toPathPiece uId}>
|
||||
<form action=@{SelectBarcodeR uId} method=POST>
|
||||
<input type=hidden #barcodeInput name=barcode>
|
||||
|
|
Loading…
Reference in a new issue