summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-03-07 18:12:55 +0100
committerYorhel <git@yorhel.nl>2021-03-07 18:12:57 +0100
commitf0bbc8b2e4f93b5aed098f97f9965f2aa0c215ae (patch)
tree5f3fd59b145423e6a981563640b1b8ad93a9ce20 /elm
parent7d7fb6620f82a422486d9f59b0868d0bdc3786d8 (diff)
Add support for "awaiting moderation" state for DB entries
In preparation for adding edit histories to tags & traits. Abusing the hidden/locked fields for this is a bit of a hack, but it's an easier solution than keeping a seperate 'state' column for tags & traits.
Diffstat (limited to 'elm')
-rw-r--r--elm/CharEdit.elm2
-rw-r--r--elm/DocEdit.elm2
-rw-r--r--elm/Lib/Editsum.elm33
-rw-r--r--elm/ProducerEdit.elm2
-rw-r--r--elm/ReleaseEdit.elm2
-rw-r--r--elm/StaffEdit.elm2
-rw-r--r--elm/VNEdit.elm2
7 files changed, 22 insertions, 23 deletions
diff --git a/elm/CharEdit.elm b/elm/CharEdit.elm
index c2de581e..63abffe4 100644
--- a/elm/CharEdit.elm
+++ b/elm/CharEdit.elm
@@ -87,7 +87,7 @@ init d =
{ state = Api.Normal
, tab = General
, invalidDis = False
- , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden }
+ , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden, hasawait = False }
, name = d.name
, original = d.original
, alias = d.alias
diff --git a/elm/DocEdit.elm b/elm/DocEdit.elm
index b5b52c2d..8b1dcc65 100644
--- a/elm/DocEdit.elm
+++ b/elm/DocEdit.elm
@@ -35,7 +35,7 @@ type alias Model =
init : GD.Recv -> Model
init d =
{ state = Api.Normal
- , editsum = { authmod = True, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden }
+ , editsum = { authmod = True, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden, hasawait = False }
, title = d.title
, content = TP.markdown d.content
, id = d.id
diff --git a/elm/Lib/Editsum.elm b/elm/Lib/Editsum.elm
index 20a51872..c8858080 100644
--- a/elm/Lib/Editsum.elm
+++ b/elm/Lib/Editsum.elm
@@ -1,5 +1,5 @@
--- This module provides an the 'Edit summary' box, including the 'hidden' and
--- 'locked' moderation checkboxes.
+-- This module provides an the 'Edit summary' box, including the entry state
+-- option for moderators.
module Lib.Editsum exposing (Model, Msg, new, update, view)
@@ -11,6 +11,7 @@ import Lib.TextPreview as TP
type alias Model =
{ authmod : Bool
+ , hasawait : Bool
, locked : Bool
, hidden : Bool
, editsum : TP.Model
@@ -18,25 +19,24 @@ type alias Model =
type Msg
- = Locked Bool
- | Hidden Bool
+ = State Bool Bool Bool
| Editsum TP.Msg
new : Model
new =
- { authmod = False
- , locked = False
- , hidden = False
- , editsum = TP.bbcode ""
+ { authmod = False
+ , hasawait = False
+ , locked = False
+ , hidden = False
+ , editsum = TP.bbcode ""
}
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
- Locked b -> ({ model | locked = b }, Cmd.none)
- Hidden b -> ({ model | hidden = b }, Cmd.none)
+ State hid lock _ -> ({ model | hidden = hid, locked = lock }, Cmd.none)
Editsum m -> let (nm,nc) = TP.update m model.editsum in ({ model | editsum = nm }, Cmd.map Editsum nc)
@@ -44,14 +44,13 @@ view : Model -> Html Msg
view model =
let
lockhid =
- [ label []
- [ inputCheck "" model.hidden Hidden
- , text " Deleted" ]
- , label []
- [ inputCheck "" model.locked Locked
- , text " Locked" ]
+ [ label [] [ inputRadio "entry_state" (not model.hidden && not model.locked) (State False False), text " Normal " ]
+ , label [] [ inputRadio "entry_state" (not model.hidden && model.locked) (State False True ), text " Locked " ]
+ , label [] [ inputRadio "entry_state" ( model.hidden && model.locked) (State True True ), text " Deleted " ]
+ , if not model.hasawait then text "" else
+ label [] [ inputRadio "entry_state" ( model.hidden && not model.locked) (State True False), text " Awaiting approval" ]
, br [] []
- , if model.hidden
+ , if model.hidden && model.locked
then span [] [ text "Note: edit summary of the last edit should indicate the reason for the deletion.", br [] [] ]
else text ""
]
diff --git a/elm/ProducerEdit.elm b/elm/ProducerEdit.elm
index b7b8a10e..468f56e5 100644
--- a/elm/ProducerEdit.elm
+++ b/elm/ProducerEdit.elm
@@ -47,7 +47,7 @@ type alias Model =
init : GPE.Recv -> Model
init d =
{ state = Api.Normal
- , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden }
+ , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden, hasawait = False }
, ptype = d.ptype
, name = d.name
, original = d.original
diff --git a/elm/ReleaseEdit.elm b/elm/ReleaseEdit.elm
index 803341cd..0988ad65 100644
--- a/elm/ReleaseEdit.elm
+++ b/elm/ReleaseEdit.elm
@@ -104,7 +104,7 @@ init d =
, prod = d.producers
, prodAdd = A.init ""
, notes = TP.bbcode d.notes
- , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden }
+ , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden, hasawait = False }
, id = d.id
}
diff --git a/elm/StaffEdit.elm b/elm/StaffEdit.elm
index 0256e69a..14dd1abb 100644
--- a/elm/StaffEdit.elm
+++ b/elm/StaffEdit.elm
@@ -45,7 +45,7 @@ type alias Model =
init : GSE.Recv -> Model
init d =
{ state = Api.Normal
- , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden }
+ , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden, hasawait = False }
, alias = d.alias
, aliasDup = False
, aid = d.aid
diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm
index aab55302..ba4a5aa8 100644
--- a/elm/VNEdit.elm
+++ b/elm/VNEdit.elm
@@ -87,7 +87,7 @@ init d =
{ state = Api.Normal
, tab = General
, invalidDis = False
- , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden }
+ , editsum = { authmod = d.authmod, editsum = TP.bbcode d.editsum, locked = d.locked, hidden = d.hidden, hasawait = False }
, title = d.title
, original = d.original
, alias = d.alias