diff options
author | Yorhel <git@yorhel.nl> | 2020-07-08 13:26:06 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-07-08 13:26:06 +0200 |
commit | f102034bfdc068b6fd002a90b7ffc36c164a9215 (patch) | |
tree | ec09478abe8b0f2c4313a8a75668df37afb45ad2 | |
parent | c741fcd9d48301ac1bc33019a21e67c976c4b932 (diff) |
VN::Edit: Fix some errors + title/alias warnings & normalization
-rw-r--r-- | elm/VNEdit.elm | 16 | ||||
-rw-r--r-- | lib/VNWeb/VN/Edit.pm | 1 |
2 files changed, 14 insertions, 3 deletions
diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm index 0764c167..cfa00e56 100644 --- a/elm/VNEdit.elm +++ b/elm/VNEdit.elm @@ -277,20 +277,30 @@ view : Model -> Html Msg view model = let geninfo = - [ formField "title::Title (romaji)" [ inputText "title" model.title Title GVE.valTitle ] + [ formField "title::Title (romaji)" + [ inputText "title" model.title Title (style "width" "500px" :: GVE.valTitle) + , if containsNonLatin model.title + then b [ class "standout" ] [ br [] [], text "This title field should only contain latin-alphabet characters, please put the \"actual\" title in the field below and the romanization above." ] + else text "" + ] , formField "original::Original title" - [ inputText "original" model.original Title GVE.valOriginal + [ inputText "original" model.original Original (style "width" "500px" :: GVE.valOriginal) , if model.title /= "" && model.title == model.original then b [ class "standout" ] [ br [] [], text "Should not be the same as the Title (romaji). Leave blank is the original title is already in the latin alphabet" ] + else if model.original /= "" && String.toLower model.title /= String.toLower model.original && not (containsNonLatin model.original) + then b [ class "standout" ] [ br [] [], text "Original title does not seem to contain any non-latin characters. Leave this field empty if the title is already in the latin alphabet" ] else text "" ] , formField "alias::Aliases" [ inputTextArea "alias" model.alias Alias (rows 3 :: GVE.valAlias) , br [] [] + , if hasDuplicates <| String.lines <| String.toLower model.alias + then b [ class "standout" ] [ text "List contains duplicate aliases.", br [] [] ] + else text "" + -- TODO: Warn when release titles are entered? , text "List of alternative titles or abbreviations. One line for each alias. Can include both official (japanese/english) titles and unofficial titles used around net." , br [] [] , text "Titles that are listed in the releases should not be added here!" - -- TODO: Compare & warn when release title is listed as alias ] , formField "desc::Description" [ TP.view "desc" model.desc Desc 600 (style "height" "180px" :: GVE.valDesc) [ b [ class "standout" ] [ text "English please!" ] ] diff --git a/lib/VNWeb/VN/Edit.pm b/lib/VNWeb/VN/Edit.pm index e7a9e3ff..71fc3182 100644 --- a/lib/VNWeb/VN/Edit.pm +++ b/lib/VNWeb/VN/Edit.pm @@ -143,6 +143,7 @@ elm_api VNEdit => $FORM_OUT, $FORM_IN, sub { $data->{locked} = $e->{locked}||0; } $data->{desc} = bb_subst_links $data->{desc}; + $data->{alias} =~ s/\n\n+/\n/; validate_dbid 'SELECT id FROM anime WHERE id IN', map $_->{aid}, $data->{anime}->@*; validate_dbid 'SELECT id FROM images WHERE id IN', $data->{image} if $data->{image}; |