diff --git a/src/Handler/Material.hs b/src/Handler/Material.hs index f9cfa6a2c..7ae50af56 100644 --- a/src/Handler/Material.hs +++ b/src/Handler/Material.hs @@ -267,6 +267,7 @@ postMaterialNewR tid ssh csh = do siteLayoutMsg headingLong $ do setTitleI headingShort editWidget + $(i18nWidgetFile "html-input") handleMaterialEdit :: TermId -> SchoolId -> CourseShorthand -> CourseId -> Maybe MaterialForm -> (Material -> DB (Maybe MaterialId)) -> Handler Widget handleMaterialEdit tid ssh csh cid template dbMaterial = do diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index 22ba8ada5..53bd24028 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -127,7 +127,7 @@ makeSheetForm msId template = identifyForm FIDsheet $ \html -> do <*> aopt (multiFileField $ oldFileIds SheetSolution) (fslI MsgSheetSolution) (sfSolutionF <$> template) <*> aopt (multiFileField $ oldFileIds SheetMarking) (fslI MsgSheetMarking & setTooltip MsgSheetMarkingTip) (sfMarkingF <$> template) - <*> aopt htmlField (fslI MsgSheetMarking) (sfMarkingText <$> template) + <*> aopt htmlField (fslpI MsgSheetMarking "Html") (sfMarkingText <$> template) return $ case result of FormSuccess sheetResult | errorMsgs <- validateSheet mr sheetResult diff --git a/src/Handler/Utils.hs b/src/Handler/Utils.hs index b98ca50ff..e7cf7dabb 100644 --- a/src/Handler/Utils.hs +++ b/src/Handler/Utils.hs @@ -202,7 +202,7 @@ warnTermDays tid times = do i18nWidgetFile :: FilePath -> Q Exp i18nWidgetFile basename = do -- Construct list of available translations (@de@, @en@, ...) at compile time - let i18nDirectory = "templates" > basename + let i18nDirectory = "templates" > "i18n" > basename availableFiles <- qRunIO $ listDirectory i18nDirectory let availableTranslations = sortWith (NTop . flip List.elemIndex (NonEmpty.toList appLanguages)) . List.nub $ pack . takeBaseName <$> availableFiles availableTranslations' <- maybe (fail $ "‘" <> i18nDirectory <> "’ is empty") return $ NonEmpty.nonEmpty availableTranslations @@ -210,7 +210,7 @@ i18nWidgetFile basename = do -- Dispatch to correct language (depending on user settings via `selectLanguage`) at run time ws <- newName "ws" -- Name for dispatch function letE - [ funD ws $ [ clause [litP $ stringL l] (normalB . widgetFile $ basename > l) [] + [ funD ws $ [ clause [litP $ stringL l] (normalB . widgetFile $ "i18n" > basename > l) [] | l <- unpack <$> NonEmpty.toList availableTranslations' -- One function definition for every available language ] ++ [ clause [wildP] (normalB [e| error "selectLanguage returned an invalid translation" |]) [] ] -- Fallback mostly there so compiler does not complain about non-exhaustive pattern match ] [e|selectLanguage availableTranslations' >>= $(varE ws)|] diff --git a/src/Handler/Utils/Communication.hs b/src/Handler/Utils/Communication.hs index 31a8cbb89..955e841a6 100644 --- a/src/Handler/Utils/Communication.hs +++ b/src/Handler/Utils/Communication.hs @@ -91,7 +91,7 @@ data Communication = Communication commR :: CommunicationRoute -> Handler Html commR CommunicationRoute{..} = do cUser <- maybeAuth - + MsgRenderer mr <- getMsgRenderer mbCurrentRoute <- getCurrentRoute @@ -140,7 +140,7 @@ commR CommunicationRoute{..} = do miCell _ (Left (CI.original -> email)) initRes nudge csrf = do (tickRes, tickView) <- mpreq checkBoxField ("" & addName (nudge "tick")) $ initRes <|> Just True return (tickRes, $(widgetFile "widgets/communication/recipientEmail")) - miCell _ (Right (lookupUser -> User{..})) initRes nudge csrf = do + miCell _ (Right (lookupUser -> User{..})) initRes nudge csrf = do (tickRes, tickView) <- mpreq checkBoxField ("" & addName (nudge "tick")) $ initRes <|> Just True return (tickRes, $(widgetFile "widgets/communication/recipientName")) miAllowAdd (EnumPosition RecipientCustom, 0) 1 _ = True @@ -172,8 +172,8 @@ commR CommunicationRoute{..} = do ((commRes,commWdgt),commEncoding) <- runFormPost . identifyForm FIDCommunication . renderAForm FormStandard $ Communication <$> recipientAForm - <*> aopt textField (fslI MsgCommSubject) Nothing - <*> areq htmlField (fslI MsgCommBody) Nothing + <*> aopt textField (fslI MsgCommSubject) Nothing + <*> areq htmlField (fslpI MsgCommBody "Html") Nothing formResult commRes $ \comm -> do runDBJobs . runConduit $ hoist (mapReaderT lift) (crJobs comm) .| sinkDBJobs addMessageI Success . MsgCommSuccess . Set.size $ cRecipients comm @@ -188,3 +188,4 @@ commR CommunicationRoute{..} = do siteLayoutMsg crHeading $ do setTitleI crHeading formWdgt + $(i18nWidgetFile "html-input") diff --git a/templates/corrections-upload-instructions/de.hamlet b/templates/i18n/corrections-upload-instructions/de.hamlet similarity index 100% rename from templates/corrections-upload-instructions/de.hamlet rename to templates/i18n/corrections-upload-instructions/de.hamlet diff --git a/templates/data-protection/de.hamlet b/templates/i18n/data-protection/de.hamlet similarity index 100% rename from templates/data-protection/de.hamlet rename to templates/i18n/data-protection/de.hamlet diff --git a/templates/i18n/html-input/de.hamlet b/templates/i18n/html-input/de.hamlet new file mode 100644 index 000000000..71e8396e2 --- /dev/null +++ b/templates/i18n/html-input/de.hamlet @@ -0,0 +1,8 @@ +
+ Das Eingabefeld für Mitteilungstext/Beschreibung akzeptiert derzeit nur Html.
+ Zeilumbrüche spielen dementsprechend keine Rolle, können aber mit
+
+ Für die Zukunft ist Markdown Unterstützung inklusive Editor geplant.
diff --git a/templates/imprint/de.hamlet b/templates/i18n/imprint/de.hamlet
similarity index 100%
rename from templates/imprint/de.hamlet
rename to templates/i18n/imprint/de.hamlet
diff --git a/templates/info-lecturer/de.hamlet b/templates/i18n/info-lecturer/de.hamlet
similarity index 100%
rename from templates/info-lecturer/de.hamlet
rename to templates/i18n/info-lecturer/de.hamlet
diff --git a/templates/profile/tokenExplanation/de.hamlet b/templates/i18n/profile/tokenExplanation/de.hamlet
similarity index 100%
rename from templates/profile/tokenExplanation/de.hamlet
rename to templates/i18n/profile/tokenExplanation/de.hamlet
diff --git a/templates/sheet-edit/de.hamlet b/templates/i18n/sheet-edit/de.hamlet
similarity index 100%
rename from templates/sheet-edit/de.hamlet
rename to templates/i18n/sheet-edit/de.hamlet
<br>
+ eingefügt werden.
+