diff --git a/frontend/src/app.sass b/frontend/src/app.sass index 017d9d98a..f63bea3b0 100644 --- a/frontend/src/app.sass +++ b/frontend/src/app.sass @@ -390,6 +390,12 @@ input[type="button"].btn-info:not(.btn-link):hover, padding-right: 10px max-width: 300px + &.table__td--unlimited + max-width: unset + + &.table__td--wide + max-width: 600px + .table__td--number width: min-content padding-left: 0 @@ -412,6 +418,12 @@ input[type="button"].btn-info:not(.btn-link):hover, line-height: 1.4 vertical-align: top + &.table__td--bottom + vertical-align: bottom + + &.table__td--middle + vertical-align: middle + .table__td--automatic font-style: oblique color: var(--color-fontsec) @@ -465,6 +477,10 @@ input[type="button"].btn-info:not(.btn-link):hover, max-height: 200px overflow-y: auto + .table__td--unlimited &, .table__td--wide & + max-height: unset + overflow-y: unset + .table--vertical th, .table__th background-color: transparent @@ -1675,3 +1691,9 @@ video & > video object-fit: contain flex-grow: 1 + +.hr + height: 1px + width: 90% + margin: 0.5em auto + background-color: var(--color-grey) diff --git a/messages/uniworx/utils/handler_form/de-de-formal.msg b/messages/uniworx/utils/handler_form/de-de-formal.msg new file mode 100644 index 000000000..bd586dfa1 --- /dev/null +++ b/messages/uniworx/utils/handler_form/de-de-formal.msg @@ -0,0 +1,3 @@ +I18nFormNoTranslations: (Noch) keine Übersetzungen +I18nFormLanguageAlreadyExists lang@Lang: Die Sprache „#{lang}“ wurde bereits hinzugefügt. +I18nFormLanguage: Sprache \ No newline at end of file diff --git a/messages/uniworx/utils/handler_form/en-eu.msg b/messages/uniworx/utils/handler_form/en-eu.msg new file mode 100644 index 000000000..bc55d9f2b --- /dev/null +++ b/messages/uniworx/utils/handler_form/en-eu.msg @@ -0,0 +1,3 @@ +I18nFormLanguageAlreadyExists lang: Language “#{lang}” was already added. +I18nFormLanguage: Language +I18nFormNoTranslations: No translations (yet) diff --git a/src/Foundation/I18n.hs b/src/Foundation/I18n.hs index 17f4d418b..c13fd25d1 100644 --- a/src/Foundation/I18n.hs +++ b/src/Foundation/I18n.hs @@ -232,17 +232,19 @@ instance RenderMessage UniWorX Load where Load { byTutorial = Just True , byProportion = p } -> MsgCorByProportionIncludingTutorial p Load { byTutorial = Just False, byProportion = p } -> MsgCorByProportionExcludingTutorial p -newtype MsgLanguage = MsgLanguage Lang +data MsgLanguage = MsgLanguage { unMsgLanguage :: Lang } | MsgLanguageEndonym { unMsgLanguage :: Lang } deriving stock (Eq, Ord, Show, Read) instance RenderMessage UniWorX MsgLanguage where - renderMessage foundation ls (MsgLanguage lang@(map mk . Text.splitOn "-" -> lang')) + renderMessage foundation ls msg@(unMsgLanguage -> lang@(map mk . Text.splitOn "-" -> lang')) | ("de" : "DE" : _) <- lang' = mr MsgGermanGermany | ("de" : _) <- lang' = mr MsgGerman | ("en" : "EU" : _) <- lang' = mr MsgEnglishEurope | ("en" : _) <- lang' = mr MsgEnglish | otherwise = lang where - mr = renderMessage foundation $ lang : filter (/= lang) ls + mr = renderMessage foundation $ case msg of + MsgLanguageEndonym _ -> lang : filter (/= lang) ls + MsgLanguage _ -> ls appLanguagesOpts :: ( MonadHandler m , RenderMessage (HandlerSite m) MsgLanguage diff --git a/src/Foundation/Navigation.hs b/src/Foundation/Navigation.hs index 3f2f77b37..bb4baad68 100644 --- a/src/Foundation/Navigation.hs +++ b/src/Foundation/Navigation.hs @@ -619,7 +619,7 @@ defaultLinks = fmap catMaybes . mapM runMaybeT $ -- Define the menu items of the activeLang <- selectLanguage appLanguages let navChildren = flip map (toList appLanguages) $ \lang -> NavLink - { navLabel = MsgLanguage lang + { navLabel = MsgLanguageEndonym lang , navRoute = (LangR, [(toPathPiece GetReferer, toPathPiece currentRoute) | currentRoute <- hoistMaybe mCurrentRoute ]) , navAccess' = NavAccessTrue , navType = NavTypeButton diff --git a/src/Handler/Admin/Test.hs b/src/Handler/Admin/Test.hs index 2de4ec9f2..ac62ab491 100644 --- a/src/Handler/Admin/Test.hs +++ b/src/Handler/Admin/Test.hs @@ -149,15 +149,16 @@ postAdminTestR = do -- This /needs/ to replace all occurrences of @mreq@ with @mpreq@ (no fields should be /actually/ required) mkAddForm :: ListPosition -- ^ Approximate position of the add-widget -> Natural -- ^ Dimension Index, outermost dimension ist 0 i.e. if dimension is 3 hyperplane-adders get passed 0, planes get passed 1, lines get 2, and points get 3 + -> ListLength -- ^ Previous shape of massinput -> (Text -> Text) -- ^ Nudge deterministic field ids so they're unique -> FieldView UniWorX -- ^ Submit-Button for this add-widget -> Maybe (Form (Map ListPosition Int -> FormResult (Map ListPosition Int))) -- ^ Nothing iff adding further cells in this position/dimension makes no sense; returns callback to determine index of new cells and data needed to initialize cells - mkAddForm 0 0 nudge submitBtn = Just $ \csrf -> do + mkAddForm 0 0 liveliness nudge submitBtn = guardOn (allowAdd 0 0 liveliness) $ \csrf -> do (addRes, addView) <- mpreq textField ("" & addName (nudge "text")) Nothing -- Any old field; for demonstration let addRes' = fromMaybe 0 . readMay . Text.filter isDigit <$> addRes -- Do something semi-interesting on the result of the @textField@ to demonstrate that further processing can be done addRes'' = addRes' <&> \dat prev -> FormSuccess (Map.singleton (maybe 0 (succ . fst) $ Map.lookupMax prev) dat) -- Construct the callback to determine new cell positions and data within @FormResult@ as required, nested @FormResult@ allows aborting the add depending on previous data return (addRes'', toWidget csrf >> fvWidget addView >> fvWidget submitBtn) - mkAddForm _pos _dim _ _ = error "Dimension and Position is always 0 for our 1-dimensional form" + mkAddForm _pos _dim _ _ _ = error "Dimension and Position is always 0 for our 1-dimensional form" -- | Make a single massInput-Cell -- @@ -184,8 +185,9 @@ postAdminTestR = do -- The actual call to @massInput@ is comparatively simple: - ((miResult, fvWidget -> miForm), miEnc) <- runFormPost . identifyForm ("massinput" :: Text) $ massInput (MassInput mkAddForm mkCellForm deleteCell allowAdd (\_ _ _ -> Set.empty) buttonAction defaultMiLayout ("massinput" :: Text)) "" True Nothing + ((miResult, fvWidget -> miForm), miEnc) <- runFormPost . identifyForm ("massinput" :: Text) $ massInput (MassInput mkAddForm mkCellForm deleteCell (\_ _ _ -> Set.empty) buttonAction defaultMiLayout ("massinput" :: Text)) "" True Nothing + ((i18nResult, fvWidget -> i18nWidget), i18nEnc) <- runFormPost . identifyForm ("i18n-stored-markup" :: Text) $ i18nField htmlField True (\_ -> Nothing) ("i18n-stored-markup" :: Text) "" True Nothing testDownloadWidget <- testDownload @@ -228,6 +230,29 @@ postAdminTestR = do

#{tshow res} |] + + i18nIdent <- newIdent + let i18nForm' = wrapForm i18nWidget FormSettings + { formMethod = POST + , formAction = Just . SomeRoute $ AdminTestR :#: i18nIdent + , formEncoding = i18nEnc + , formAttrs = [] + , formSubmit = FormSubmit + , formAnchor = Just i18nIdent + } + [whamlet| +

I18n-Form + ^{i18nForm'} + $case i18nResult + $of FormMissing + $of FormFailure errs +