refactor(firm): fix build too

This commit is contained in:
Steffen Jost 2023-11-23 13:27:57 +01:00
parent c5c4a62de0
commit 400a3449c5
10 changed files with 55 additions and 45 deletions

View File

@ -3,6 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
FirmAssociates: Firmenangehörige
FirmContact: Firmenkontakt
FirmNoContact: Keine allgemeinen Kontaktinformationen bekannt.
FirmEmail: Allgemeine Email
FirmAddress: Postanschrift
FirmDefaultPreferenceInfo: Diese Voreinstellungen gelten nur für neue Firmenangehörige

View File

@ -3,6 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
FirmAssociates: Company associated users
FirmContact: Company Contact
FirmNoContact: No general contact information known.
FirmEmail: General company email
FirmAddress: Postal address
FirmDefaultPreferenceInfo: Default setting for new company associates only

View File

@ -806,6 +806,7 @@ postFirmUsersR fsh = do
siteLayout (citext2widget companyName) $ do
setTitle $ toHtml $ CI.original companyShorthand <> "-" <> tshow companyAvsId
let firmContactInfo = $(widgetFile "firm-contact-info")
$(widgetFile "firm-users")
@ -1053,6 +1054,7 @@ postFirmSupersR fsh = do
siteLayout (citext2widget fsh) $ do
setTitle $ citext2Html $ fsh <> " Supers"
let firmContactInfo = $(widgetFile "firm-contact-info")
$(i18nWidgetFile "firm-supervisors")

View File

@ -475,11 +475,11 @@ serveProfileR (uid, user@User{..}) = do
, UserWarningDays =. stgWarningDays
, UserNotificationSettings =. stgNotificationSettings
, UserShowSex =. stgShowSex
, UserPinPassword =. stgPinPassword -- TODO & canonical
, UserPostAddress =. stgPostAddress -- TODO & canonical
, UserPinPassword =. (stgPinPassword & canonical)
, UserPostAddress =. (stgPostAddress & canonical)
, UserPrefersPostal =. stgPrefersPostal
, UserTelephone =. stgTelephone & canonical
, UserMobile =. stgMobile & canonical
, UserTelephone =. (stgTelephone & canonical)
, UserMobile =. (stgMobile & canonical)
, UserExamOfficeGetSynced =. (stgExamOfficeSettings & eosettingsGetSynced)
, UserExamOfficeGetLabels =. (stgExamOfficeSettings & eosettingsGetLabels)
]

View File

@ -50,6 +50,13 @@ data StoredMarkup = StoredMarkup
deriving (Read, Show, Generic)
deriving anyclass (Binary, Hashable, NFData)
instance Canonical (Maybe StoredMarkup) where
canonical Nothing = Nothing
canonical r@(Just s@StoredMarkup{..}) = let mi' = LT.strip markupInput in if
| LT.null mi' -> Nothing
| markupInput == mi' -> r
| otherwise -> Just s{markupInput = mi'}
htmlToStoredMarkup :: Html -> StoredMarkup
htmlToStoredMarkup html = StoredMarkup
{ markupInputFormat = MarkupHtml

View File

@ -1987,8 +1987,9 @@ instance {-# OVERLAPPABLE #-} (Canonical mono, MonoFoldable mono, Eq mono) => Ca
instance (Ord a, Canonical a) => Canonical (Set a) where
canonical = Set.map canonical
instance Canonical (Maybe Text) where
canonical Nothing = Nothing
canonical (Just t) =
let t' = Text.strip t
in if Text.null t' then Nothing else Just t'
instance Canonical (Maybe Text) where -- a split into Canonical Text and Canonical a => Maybe seems nicer, but the latter instance would be troublesome
canonical Nothing = Nothing
canonical r@(Just t) = let t' = Text.strip t in if
| Text.null t' -> Nothing
| t == t' -> r
| otherwise -> Just t'

View File

@ -0,0 +1,23 @@
$newline never
$# SPDX-FileCopyrightText: 2023 Steffen Jost <jost@tcs.ifi.lmu.de>
$#
$# SPDX-License-Identifier: AGPL-3.0-or-later
<section .profile>
<h2>_{MsgFirmContact}
<dl .deflist.profile-dl>
$maybe fem <- companyEmail
<dt .deflist__dt>
_{MsgFirmEmail} #{iconLetterOrEmail False}
<dd .deflist__dd .email>
#{mailtoHtml fem}
$maybe addr <- companyPostAddress
<dt .deflist__dt>
_{MsgFirmAddress} #{iconLetterOrEmail True}
<dd .deflist__dd>
#{addr}
$nothing
$maybe _ <- companyEmail
$nothing
_{MsgFirmNoContact}

View File

@ -4,18 +4,7 @@ $# SPDX-FileCopyrightText: 2023 Steffen Jost <jost@tcs.ifi.lmu.de>
$#
$# SPDX-License-Identifier: AGPL-3.0-or-later
<section .profile>
<dl .deflist.profile-dl>
$maybe fem <- companyEmail
<dt .deflist__dt>
_{MsgFirmEmail} #{iconLetterOrEmail False}
<dd .deflist__dd .email>
#{mailtoHtml fem}
$maybe addr <- companyPostAddress
<dt .deflist__dt>
_{MsgFirmAddress} #{iconLetterOrEmail True}
<dd .deflist__dd>
#{addr}
^{firmContactInfo}
<section>
<div .scrolltable .scrolltable--bordered>

View File

@ -9,19 +9,11 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
Daraus folgt zum Beispiel, dass wenn <em>x</em> ein Standard-Ansprechpartner für Firma <em>a</em> ist
und wenn <em>y</em> sowohl Firma <em>a</em> als auch <em>b</em> angehört,
dass dann <em>x</em> als firmenfremd in der Liste der Ansprechpartner von Firma <em>b</em> angezeigt wird.
<section .profile>
<dl .deflist.profile-dl>
$maybe fem <- companyEmail
<dt .deflist__dt>
_{MsgFirmEmail} #{iconLetterOrEmail False}
<dd .deflist__dd .email>
#{mailtoHtml fem}
$maybe addr <- companyPostAddress
<dt .deflist__dt>
_{MsgFirmAddress} #{iconLetterOrEmail True}
<dd .deflist__dd>
#{addr}
^{firmContactInfo}
<section>
^{fsprTable}
<section>
^{addSuperForm}

View File

@ -8,19 +8,11 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
Note that supervision is company independent.
For example, if <em>x</em> is a regular supervisor for company <em>a</em> and <em>y</em> belongs to companies <em>a</em> and <em>b</em>,
then <em>x</em> will be listed as a foreign supervisor for company <em>b</em>.
<section .profile>
<dl .deflist.profile-dl>
$maybe fem <- companyEmail
<dt .deflist__dt>
_{MsgFirmEmail} #{iconLetterOrEmail False}
<dd .deflist__dd .email>
#{mailtoHtml fem}
$maybe addr <- companyPostAddress
<dt .deflist__dt>
_{MsgFirmAddress} #{iconLetterOrEmail True}
<dd .deflist__dd>
#{addr}
^{firmContactInfo}
<section>
^{fsprTable}
<section>
^{addSuperForm}