~alcinnz/bureaucromancy

043b1cdefa6d82a3a31f1d22f37f56f9b36feea7 — Adrian Cochrane 1 year, 2 months ago ac09cd8
Implement tel input type
3 files changed, 35 insertions(+), 0 deletions(-)

M form.html
M src/Text/HTML/Form/WebApp.hs
A tpl/number.html
M form.html => form.html +1 -0
@@ 13,6 13,7 @@
    <label><input type="radio" name="char" value="elgar" />Magus Elgar</label>
    <label><input type="file" name="file" />Upload a file!</label>
    <label><input type="email" name="email" />eMail</label>
    <label><input type="tel" name="tel" />Telephone</label>
  </form>
</body>
</html>

M src/Text/HTML/Form/WebApp.hs => src/Text/HTML/Form/WebApp.hs +2 -0
@@ 104,6 104,8 @@ renderInput form ix input@Input { inputType="file" } path qs = do
        "link" ~> ('/':show ix ++ '/':L.intercalate "/" path')
      ]
    doesDirectoryExist' parent file = doesDirectoryExist $ parent </> file
renderInput form ix input@Input { inputType = "tel" } [] qs =
    template "number.html" form ix input qs
renderInput form ix input [keyboard] qs =
    renderInput form ix input [keyboard, ""] qs
renderInput form ix input [keyboard, ""] qs | Just (Just _) <- resolveSource path =

A tpl/number.html => tpl/number.html +32 -0
@@ 0,0 1,32 @@
{% extends "base.html" %}

{%- block control -%}<section>
  <p>{{ input.value }}</p>
  <hr />
  <table>
    <tr>
      <td><a href=":7{{Q}}">7</a></td>
      <td><a href=":8{{Q}}">8</a></td>
      <td><a href=":9{{Q}}">9</a></td>
      <td><a href=":-{{Q}}">-</a></td>
    </tr>
    <tr>
      <td><a href=":4{{Q}}">4</a></td>
      <td><a href=":5{{Q}}">5</a></td>
      <td><a href=":6{{Q}}">6</a></td>
      <td><a href=":%20{{Q}}">SPACE</a></td>
    </tr>
    <tr>
      <td><a href=":1{{Q}}">1</a></td>
      <td><a href=":2{{Q}}">2</a></td>
      <td><a href=":3{{Q}}">3</a></td>
      <td><a href="-{{Q}}">DEL</a></td>
    </tr>
    <tr>
      <td><a href=":*{{Q}}">*</a></td>
      <td><a href=":0{{Q}}">0</a></td>
      <td><a href=":#{{Q}}">#</a></td>
      <td><a href=":.{{Q}}">.</a></td>
    </tr>
  </table>
</section>{%- endblock -%}