mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Initial version.
Features: - Upload PDF files let them analyze - Manage meta data and items - See processing in webapp
This commit is contained in:
40
modules/webapp/src/main/elm/Util/Html.elm
Normal file
40
modules/webapp/src/main/elm/Util/Html.elm
Normal file
@ -0,0 +1,40 @@
|
||||
module Util.Html exposing (..)
|
||||
|
||||
import Html exposing (Attribute)
|
||||
import Html.Attributes exposing (class)
|
||||
import Html.Events exposing (on, keyCode)
|
||||
import Json.Decode as Decode
|
||||
|
||||
type KeyCode
|
||||
= Up
|
||||
| Down
|
||||
| Left
|
||||
| Right
|
||||
| Enter
|
||||
|
||||
intToKeyCode: Int -> Maybe KeyCode
|
||||
intToKeyCode code =
|
||||
case code of
|
||||
38 -> Just Up
|
||||
40 -> Just Down
|
||||
39 -> Just Right
|
||||
37 -> Just Left
|
||||
13 -> Just Enter
|
||||
_ -> Nothing
|
||||
|
||||
onKeyUp : (Int -> msg) -> Attribute msg
|
||||
onKeyUp tagger =
|
||||
on "keyup" (Decode.map tagger keyCode)
|
||||
|
||||
|
||||
onClickk : msg -> Attribute msg
|
||||
onClickk msg =
|
||||
Html.Events.preventDefaultOn "click" (Decode.map alwaysPreventDefault (Decode.succeed msg))
|
||||
|
||||
alwaysPreventDefault : msg -> ( msg, Bool )
|
||||
alwaysPreventDefault msg =
|
||||
( msg, True )
|
||||
|
||||
classActive: Bool -> String -> Attribute msg
|
||||
classActive active classes =
|
||||
class (classes ++ (if active then " active" else ""))
|
Reference in New Issue
Block a user