Merge pull request #650 from eikek/trim-ws

Trim ws
This commit is contained in:
mergify[bot] 2021-02-19 00:58:20 +00:00 committed by GitHub
commit 393645c426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 40 deletions

View File

@ -401,15 +401,15 @@ trait Conversions {
org = ROrganization( org = ROrganization(
oid, oid,
cid, cid,
v.name, v.name.trim,
v.address.street, v.address.street.trim,
v.address.zip, v.address.zip.trim,
v.address.city, v.address.city.trim,
v.address.country, v.address.country.trim,
v.notes, v.notes,
now, now,
now, now,
v.shortName v.shortName.map(_.trim)
) )
} yield OOrganization.OrgAndContacts(org, cont) } yield OOrganization.OrgAndContacts(org, cont)
} }
@ -426,15 +426,15 @@ trait Conversions {
org = ROrganization( org = ROrganization(
v.id, v.id,
cid, cid,
v.name, v.name.trim,
v.address.street, v.address.street.trim,
v.address.zip, v.address.zip.trim,
v.address.city, v.address.city.trim,
v.address.country, v.address.country.trim,
v.notes, v.notes,
v.created, v.created,
now, now,
v.shortName v.shortName.map(_.trim)
) )
} yield OOrganization.OrgAndContacts(org, cont) } yield OOrganization.OrgAndContacts(org, cont)
} }
@ -463,11 +463,11 @@ trait Conversions {
pers = RPerson( pers = RPerson(
pid, pid,
cid, cid,
v.name, v.name.trim,
v.address.street, v.address.street.trim,
v.address.zip, v.address.zip.trim,
v.address.city, v.address.city.trim,
v.address.country, v.address.country.trim,
v.notes, v.notes,
now, now,
now, now,
@ -489,11 +489,11 @@ trait Conversions {
pers = RPerson( pers = RPerson(
v.id, v.id,
cid, cid,
v.name, v.name.trim,
v.address.street, v.address.street.trim,
v.address.zip, v.address.zip.trim,
v.address.city, v.address.city.trim,
v.address.country, v.address.country.trim,
v.notes, v.notes,
v.created, v.created,
now, now,
@ -513,7 +513,7 @@ trait Conversions {
pid: Option[Ident] pid: Option[Ident]
): F[RContact] = ): F[RContact] =
timeId.map { case (id, now) => timeId.map { case (id, now) =>
RContact(id, c.value, c.kind, pid, oid, now) RContact(id, c.value.trim, c.kind, pid, oid, now)
} }
// users // users
@ -564,11 +564,11 @@ trait Conversions {
def newTag[F[_]: Sync](t: Tag, cid: Ident): F[RTag] = def newTag[F[_]: Sync](t: Tag, cid: Ident): F[RTag] =
timeId.map { case (id, now) => timeId.map { case (id, now) =>
RTag(id, cid, t.name, t.category, now) RTag(id, cid, t.name.trim, t.category.map(_.trim), now)
} }
def changeTag(t: Tag, cid: Ident): RTag = def changeTag(t: Tag, cid: Ident): RTag =
RTag(t.id, cid, t.name, t.category, t.created) RTag(t.id, cid, t.name.trim, t.category.map(_.trim), t.created)
// sources // sources
@ -593,7 +593,7 @@ trait Conversions {
RSource( RSource(
id, id,
cid, cid,
s.abbrev, s.abbrev.trim,
s.description, s.description,
0, 0,
s.enabled, s.enabled,
@ -608,7 +608,7 @@ trait Conversions {
RSource( RSource(
s.id, s.id,
coll, coll,
s.abbrev, s.abbrev.trim,
s.description, s.description,
s.counter, s.counter,
s.enabled, s.enabled,
@ -624,13 +624,13 @@ trait Conversions {
def newEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] = def newEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
timeId.map({ case (id, now) => timeId.map({ case (id, now) =>
REquipment(id, cid, e.name, now, now, e.notes) REquipment(id, cid, e.name.trim, now, now, e.notes)
}) })
def changeEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] = def changeEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
Timestamp Timestamp
.current[F] .current[F]
.map(now => REquipment(e.id, cid, e.name, e.created, now, e.notes)) .map(now => REquipment(e.id, cid, e.name.trim, e.created, now, e.notes))
// idref // idref

View File

@ -11,6 +11,7 @@ import Browser exposing (UrlRequest)
import Browser.Navigation exposing (Key) import Browser.Navigation exposing (Key)
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Data.UiTheme exposing (UiTheme)
import Http import Http
import Page exposing (Page(..)) import Page exposing (Page(..))
import Page.CollectiveSettings.Data import Page.CollectiveSettings.Data
@ -46,6 +47,7 @@ type alias Model =
, subs : Sub Msg , subs : Sub Msg
, uiSettings : UiSettings , uiSettings : UiSettings
, sidebarVisible : Bool , sidebarVisible : Bool
, anonymousTheme : UiTheme
} }
@ -94,6 +96,7 @@ init key url flags_ settings =
, subs = Sub.none , subs = Sub.none
, uiSettings = settings , uiSettings = settings
, sidebarVisible = settings.sideMenuVisible , sidebarVisible = settings.sideMenuVisible
, anonymousTheme = Data.UiTheme.Light
} }
, Cmd.batch , Cmd.batch
[ Cmd.map UserSettingsMsg uc [ Cmd.map UserSettingsMsg uc

View File

@ -52,18 +52,18 @@ updateWithSub msg model =
( { model | sidebarVisible = not model.sidebarVisible }, Cmd.none, Sub.none ) ( { model | sidebarVisible = not model.sidebarVisible }, Cmd.none, Sub.none )
ToggleDarkMode -> ToggleDarkMode ->
let
settings =
model.uiSettings
next =
Data.UiTheme.cycle settings.uiTheme
newSettings =
{ settings | uiTheme = next }
in
case model.flags.account of case model.flags.account of
Just _ -> Just _ ->
let
settings =
model.uiSettings
next =
Data.UiTheme.cycle settings.uiTheme
newSettings =
{ settings | uiTheme = next }
in
-- when authenticated, store it in settings only -- when authenticated, store it in settings only
-- once new settings arrive via a subscription, -- once new settings arrive via a subscription,
-- the ui is updated. so it is also updated on -- the ui is updated. so it is also updated on
@ -74,8 +74,12 @@ updateWithSub msg model =
) )
Nothing -> Nothing ->
let
next =
Data.UiTheme.cycle model.anonymousTheme
in
-- when not logged in, simply set the theme -- when not logged in, simply set the theme
( { model | userMenuOpen = False } ( { model | userMenuOpen = False, anonymousTheme = next }
, Ports.setUiTheme next , Ports.setUiTheme next
, Sub.none , Sub.none
) )