summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-02-27 16:20:34 +0100
committerYorhel <git@yorhel.nl>2020-02-27 16:20:34 +0100
commit018cbf36fe8e33818759909d8ff4fbda87fa3f62 (patch)
tree82a2a54fc7ff26667ae2cca233b14ff921fdad37
parent7dc48dbf20d5b27a22a431b621d639608841ce73 (diff)
v2rw/RelEdit: Add notes field
-rw-r--r--elm/ReleaseEdit/General.elm13
-rw-r--r--elm/ReleaseEdit/Main.elm1
-rw-r--r--lib/VNWeb/Releases/Edit.pm1
3 files changed, 14 insertions, 1 deletions
diff --git a/elm/ReleaseEdit/General.elm b/elm/ReleaseEdit/General.elm
index ef075a6f..57fccf92 100644
--- a/elm/ReleaseEdit/General.elm
+++ b/elm/ReleaseEdit/General.elm
@@ -12,11 +12,12 @@ import Gen.Api as GApi
import Lib.RDate as D
import Lib.Autocomplete as A
import Lib.ExtLinks as EL
+import Lib.TextPreview as TP
import Gen.Types as GT
import Gen.ReleaseEdit as GRE
import Gen.ExtLinks as GEL
--- TODO: notes, producers, VNs
+-- TODO: producers, VNs
type alias Model =
@@ -45,6 +46,7 @@ type alias Model =
, engineConf : A.Config Msg GRE.RecvEngines
, engine : A.Model GRE.RecvEngines
, extlinks : EL.Model GRE.RecvExtlinks
+ , notes : TP.Model
}
@@ -80,6 +82,7 @@ init d =
}
, engine = A.init d.engine
, extlinks = EL.new d.extlinks GEL.releaseLinks
+ , notes = TP.bbcode d.notes
}
@@ -114,6 +117,7 @@ type Msg
| Website String
| Engine (A.Msg GRE.RecvEngines)
| ExtLinks (EL.Msg GRE.RecvExtlinks)
+ | Notes (TP.Msg)
update : Msg -> Model -> (Model, Cmd Msg)
@@ -152,6 +156,7 @@ update msg model =
Nothing -> nm
in ({ model | engine = nmod }, c)
ExtLinks m -> mod { model | extlinks = EL.update m model.extlinks }
+ Notes m -> let (nm, nc) = TP.update m model.notes in ({ model | notes = nm }, Cmd.map Notes nc)
isValid : Model -> Bool
@@ -241,4 +246,10 @@ view model =
, formField "catalog::Catalog number" [ inputText "catalog" model.catalog Catalog GRE.valCatalog ]
, formField "website::Website" [ inputText "website" model.website Website (style "width" "500px" :: GRE.valWebsite) ]
, formField "External Links" [ Html.map ExtLinks (EL.view model.extlinks) ]
+
+ , tr [ class "newpart" ] [ td [ colspan 2 ] [] ]
+ , formField "notes::Notes"
+ [ TP.view "notes" model.notes Notes 700 [] [ b [ class "standout" ] [ text " (English please!) " ] ]
+ , text "Miscellaneous notes/comments, information that does not fit in the above fields. E.g.: Types of censoring or for which releases this patch applies."
+ ]
]
diff --git a/elm/ReleaseEdit/Main.elm b/elm/ReleaseEdit/Main.elm
index 5615c7f5..587666f5 100644
--- a/elm/ReleaseEdit/Main.elm
+++ b/elm/ReleaseEdit/Main.elm
@@ -70,6 +70,7 @@ encode model =
, website = model.general.website
, engine = model.general.engine.value
, extlinks = model.general.extlinks.links
+ , notes = model.general.notes.data
}
diff --git a/lib/VNWeb/Releases/Edit.pm b/lib/VNWeb/Releases/Edit.pm
index 737476f3..28fc96d4 100644
--- a/lib/VNWeb/Releases/Edit.pm
+++ b/lib/VNWeb/Releases/Edit.pm
@@ -29,6 +29,7 @@ my $FORM = {
website => { required => 0, default => '', weburl => 1 },
engine => { required => 0, default => '', maxlength => 50 },
extlinks => validate_extlinks('r'),
+ notes => { required => 0, default => '', maxlength => 10240 },
hidden => { anybool => 1 },
locked => { anybool => 1 },