diff options
author | Yorhel <git@yorhel.nl> | 2019-07-25 14:30:04 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-07-25 14:36:21 +0200 |
commit | f296495a912ce759df11c43e78b4552788bdbff2 (patch) | |
tree | 0c10802de65fb7c8475722e12234bff5eb980628 /elm3/Lib/Editsum.elm | |
parent | 0f3cfeb85caec6424bcbea47142eefbf8011636b (diff) |
Merge the v3 branch into separate namespace + fix Docker stuff (again)
I was getting tired of having to keep two branches up-to-date with the
latest developments, so decided to throw v3 into the same branch - just
different files (...which will get mostly rewritten again soon). The two
versions aren't very different in terms of dependencies, build system
and support code, so they can now properly share files. Added a section
to the README to avoid confusion.
This merge also makes it easier to quickly switch between the different
versions, which is handy for development. It's even possible to run both
at the same time, but my scripts use the same port so that needs a
workaround.
And it's amazing how often I break the Docker scripts.
Diffstat (limited to 'elm3/Lib/Editsum.elm')
-rw-r--r-- | elm3/Lib/Editsum.elm | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/elm3/Lib/Editsum.elm b/elm3/Lib/Editsum.elm new file mode 100644 index 00000000..3ddc1506 --- /dev/null +++ b/elm3/Lib/Editsum.elm @@ -0,0 +1,59 @@ +-- This module provides an the 'Edit summary' box, including the 'hidden' and +-- 'locked' moderation checkboxes. + +module Lib.Editsum exposing (Model, Msg, new, update, view) + +import Html exposing (..) +import Html.Attributes exposing (..) +import Lib.Html exposing (..) + + +type alias Model = + { authmod : Bool + , locked : Bool + , hidden : Bool + , editsum : String + } + + +type Msg + = Locked Bool + | Hidden Bool + | Editsum String + + +new : Model +new = + { authmod = False + , locked = False + , hidden = False + , editsum = "" + } + + +update : Msg -> Model -> Model +update msg model = + case msg of + Locked b -> { model | locked = b } + Hidden b -> { model | hidden = b } + Editsum s -> { model | editsum = s } + + +view : Model -> Html Msg +view model = + let + lockhid = cardRow "Mod actions" Nothing <| formGroups + [ [ label [ class "checkbox" ] + [ inputCheck "" model.locked Locked + , text " Locked" ] + ] + , [ label [ class "checkbox" ] + [ inputCheck "" model.hidden Hidden + , text " Hidden" ] + ] + ] + in card_ + [ lockhid + , cardRow "Edit summary" (Just "English please!") + <| formGroup [ inputTextArea "" model.editsum Editsum [rows 4, minlength 2, maxlength 5000, required True] ] + ] |