Reformatted changed source files with elm-format

This commit is contained in:
Stefan Scheidewig 2021-04-18 22:27:50 +02:00
parent decae84aec
commit dd743cf273
5 changed files with 38 additions and 20 deletions

View File

@ -610,8 +610,11 @@ deleteAttachment flags attachId receive =
, expect = Http.expectJson receive Api.Model.BasicResult.decoder
}
--- Delete Attachments
deleteAttachments :
Flags
-> Set String
@ -626,6 +629,7 @@ deleteAttachments flags attachIds receive =
}
--- Attachment Metadata

View File

@ -111,19 +111,23 @@ type alias Model =
, viewMode : ViewMode
}
type ViewMode
= SimpleView
| SelectView SelectViewModel
type alias SelectViewModel =
{ ids : Set String
, action : SelectActionMode
}
type SelectActionMode
= NoneAction
| DeleteSelected
type NotesField
= ViewNotes
| EditNotes Comp.MarkdownInput.Model
@ -204,6 +208,7 @@ emptyModel =
, viewMode = SimpleView
}
initSelectViewModel : SelectViewModel
initSelectViewModel =
{ ids = Set.empty

View File

@ -114,6 +114,7 @@ attachHeader texts settings model _ attach =
case model.viewMode of
SelectView _ ->
True
_ ->
False
@ -121,6 +122,7 @@ attachHeader texts settings model _ attach =
case model.viewMode of
SelectView _ ->
texts.exitSelectMode
_ ->
texts.selectModeTitle
@ -163,11 +165,12 @@ attachHeader texts settings model _ attach =
[ i [ class "fa fa-eye font-thin" ] []
]
, a
[ classList [ (S.secondaryBasicButton ++ " text-sm", True)
, ( "bg-gray-200 dark:bg-bluegray-600", selectView )
, ( "hidden", not selectPossible )
, ( "ml-2", True )
]
[ classList
[ ( S.secondaryBasicButton ++ " text-sm", True )
, ( "bg-gray-200 dark:bg-bluegray-600", selectView )
, ( "hidden", not selectPossible )
, ( "ml-2", True )
]
, href "#"
, title selectToggleText
, onClick ToggleSelectView
@ -175,11 +178,12 @@ attachHeader texts settings model _ attach =
[ i [ class "fa fa-tasks" ] []
]
, a
[ classList [ ( S.deleteButton, True )
, ( "disabled", noAttachmentsSelected )
, ( "hidden", not selectPossible || not selectView )
, ( "ml-2", True )
]
[ classList
[ ( S.deleteButton, True )
, ( "disabled", noAttachmentsSelected )
, ( "hidden", not selectPossible || not selectView )
, ( "ml-2", True )
]
, href "#"
, title texts.deleteAttachments
, onClick RequestDeleteSelected
@ -356,8 +360,10 @@ menuItem texts model pos attach =
SelectView svm ->
if Set.member attach.id svm.ids then
"fa fa-check-circle ml-1"
else
"fa fa-circle ml-1"
_ ->
"fa fa-check-circle ml-1"
@ -365,16 +371,17 @@ menuItem texts model pos attach =
case model.viewMode of
SelectView _ ->
True
_ ->
model.visibleAttach == pos
msg =
case model.viewMode of
SelectView _ ->
(ToggleAttachment attach.id)
_ ->
(SetActiveAttachment pos)
ToggleAttachment attach.id
_ ->
SetActiveAttachment pos
in
a
([ classList <|

View File

@ -24,7 +24,7 @@ import Comp.Dropdown exposing (isDropdownChangeMsg)
import Comp.Dropzone
import Comp.EquipmentForm
import Comp.ItemDetail.FieldTabState as FTabState
import Comp.ItemDetail.Model exposing (AttachmentRename, Model, Msg(..), NotesField(..), SaveNameState(..), SelectActionMode(..), UpdateResult, isEditNotes, resultModel, resultModelCmd, resultModelCmdSub)
import Comp.ItemDetail.Model exposing (AttachmentRename, Model, Msg(..), NotesField(..), SaveNameState(..), SelectActionMode(..), UpdateResult, ViewMode(..), initSelectViewModel, isEditNotes, resultModel, resultModelCmd, resultModelCmdSub)
import Comp.ItemMail
import Comp.KeyInput
import Comp.LinkTarget
@ -44,7 +44,6 @@ import Dict
import Html5.DragDrop as DD
import Http
import Page exposing (Page(..))
import Comp.ItemDetail.Model exposing (ViewMode(..), initSelectViewModel)
import Set exposing (Set)
import Throttle
import Time
@ -275,11 +274,13 @@ update key flags inav settings msg model =
svm_ =
if Set.member id svm.ids then
{ svm | ids = Set.remove id svm.ids }
else
{ svm | ids = Set.insert id svm.ids }
in
resultModel
{ model | viewMode = SelectView svm_ }
_ ->
resultModel model
@ -1404,10 +1405,11 @@ update key flags inav settings msg model =
withSub ( model_, Cmd.none )
ToggleAttachMenu ->
resultModel { model
| attachMenuOpen = not model.attachMenuOpen
, viewMode = SimpleView
}
resultModel
{ model
| attachMenuOpen = not model.attachMenuOpen
, viewMode = SimpleView
}
UiSettingsUpdated ->
let

View File

@ -17,7 +17,7 @@ type alias Texts =
, deleteThisFile : String
, selectModeTitle : String
, exitSelectMode : String
, deleteAttachments: String
, deleteAttachments : String
}