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.Blaze.Internal
|
||||||
import Text.Shakespeare.Text
|
import Text.Shakespeare.Text
|
||||||
|
|
||||||
getBarcodeR :: UserId -> Text -> Handler Html
|
postHomeBarcodeR :: Handler Html
|
||||||
getBarcodeR uId barcode = undefined
|
postHomeBarcodeR = return mempty
|
||||||
|
|
||||||
|
postSelectBarcodeR :: UserId -> Handler Html
|
||||||
|
postSelectBarcodeR uId = return mempty
|
||||||
|
|
|
@ -30,4 +30,5 @@
|
||||||
/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
|
/barcode HomeBarcodeR POST
|
||||||
|
/user/#UserId/barcode SelectBarcodeR POST
|
||||||
|
|
|
@ -11,9 +11,11 @@ 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) {
|
||||||
var uid = document.getElementById('uid').getAttribute('value')
|
var input = document.getElementById('barcodeInput')
|
||||||
if (uid) {
|
if (input) {
|
||||||
window.location = "/user/" + encodeURIComponent(uid) + "/barcode/" + encodeURIComponent(barcodeBuf)
|
input.setAttribute('value', barcodeBuf)
|
||||||
|
input.parentNode.submit()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
barcodeBuf = ""
|
barcodeBuf = ""
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
|
@ -23,3 +23,6 @@ $forall (Entity uId user) <- users
|
||||||
<article .article #func>
|
<article .article #func>
|
||||||
<a href=@{ReactivateR}>
|
<a href=@{ReactivateR}>
|
||||||
<p>_{MsgReactivateOldUser}
|
<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}>
|
<a href=@{BuyR uId bId}>
|
||||||
<p>#{beverageIdent bev}
|
<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