propagate crementing
This commit is contained in:
parent
86ad058107
commit
f410d9e350
7 changed files with 12 additions and 5 deletions
|
@ -115,6 +115,9 @@ instance Yesod App where
|
|||
[ css_bootstrap_css
|
||||
, css_main_css
|
||||
])
|
||||
$(combineScripts 'StaticR
|
||||
[ js_crementing_js
|
||||
])
|
||||
$(widgetFile "default-layout")
|
||||
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ amountField = Field
|
|||
Right (a, "") -> Right a
|
||||
_ -> Left $ MsgInvalidInteger s
|
||||
, fieldView = \theId name attr val req -> toWidget [hamlet|$newline never
|
||||
<input id=#{theId} name=#{name} *{attr} type="number" step=1 min=0 :req:required="" value="#{showVal val}">
|
||||
<input id="crement" id=#{theId} name=#{name} *{attr} type="number" step=1 min=1 :req:required="" value="#{showVal val}">
|
||||
|]
|
||||
, fieldEnctype = UrlEncoded
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ postUpstockR bId = do
|
|||
|
||||
upstockForm :: Form Int
|
||||
upstockForm = renderDivs
|
||||
$ areq amountField (fieldSettingsLabel MsgAmountAdded) (Just 0)
|
||||
$ areq amountField (fieldSettingsLabel MsgAmountAdded) (Just 1)
|
||||
|
||||
getNewArticleR :: Handler Html
|
||||
getNewArticleR = do
|
||||
|
|
|
@ -8,5 +8,5 @@ calling like
|
|||
*/
|
||||
function crmnt( e, i ) { /* read: in-/decrement ( dom-element, signed-integer ) */
|
||||
var d = parseInt( e.value ) + i;
|
||||
e.value = ( d < 0 )? 0 : e.value = d;
|
||||
e.value = ( d < 1 )? 1 : e.value = d;
|
||||
}
|
||||
|
|
|
@ -9,3 +9,5 @@ $doctype 5
|
|||
^{buyWidget}
|
||||
<div>
|
||||
<input type=submit value="_{MsgPurchase}">
|
||||
<input onclick="crmnt( document.getElementById('crement'), 1 )" value="_{MsgIncrement}" type="button">
|
||||
<input onclick="crmnt( document.getElementById('crement'), -1 )" value="_{MsgDecrement}" type="button">
|
||||
|
|
|
@ -9,3 +9,5 @@ $doctype 5
|
|||
^{buyCashWidget}
|
||||
<div>
|
||||
<input type=submit value="_{MsgPurchase}">
|
||||
<input onclick="crmnt( document.getElementById('crement'), 1 )" value="_{MsgIncrement}" type="button">
|
||||
<input onclick="crmnt( document.getElementById('crement'), -1 )" value="_{MsgDecrement}" type="button">
|
||||
|
|
|
@ -9,5 +9,5 @@ $doctype 5
|
|||
^{upstockWidget}
|
||||
<div>
|
||||
<input type=submit value="_{MsgFillup}">
|
||||
<input onclick="crmnt( document.getElementById('hident2'), 1 )" value="_{MsgIncrement}" type="button">
|
||||
<input onclick="crmnt( document.getElementById('hident2'), -1 )" value="_{MsgDecrement}" type="button">
|
||||
<input onclick="crmnt( document.getElementById('crement'), 1 )" value="_{MsgIncrement}" type="button">
|
||||
<input onclick="crmnt( document.getElementById('crement'), -1 )" value="_{MsgDecrement}" type="button">
|
||||
|
|
Loading…
Reference in a new issue