mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Prepared multiselect view mode for attachment list
This commit is contained in:
@ -4,13 +4,7 @@ import Api
|
||||
import Api.Model.Attachment exposing (Attachment)
|
||||
import Comp.AttachmentMeta
|
||||
import Comp.ConfirmModal
|
||||
import Comp.ItemDetail.Model
|
||||
exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, NotesField(..)
|
||||
, SaveNameState(..)
|
||||
)
|
||||
import Comp.ItemDetail.Model exposing (Model, Msg(..), NotesField(..), SaveNameState(..), ViewMode(..))
|
||||
import Comp.MenuBar as MB
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Dict
|
||||
@ -19,7 +13,6 @@ import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Html5.DragDrop as DD
|
||||
import Messages.Comp.ItemDetail.SingleAttachment exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Styles as S
|
||||
import Util.Maybe
|
||||
import Util.Size
|
||||
@ -87,6 +80,7 @@ view texts settings model pos attach =
|
||||
- toggle thumbs
|
||||
- name + size
|
||||
- eye icon to open it
|
||||
- toggle multi select
|
||||
- menu
|
||||
- rename
|
||||
- meta data
|
||||
@ -112,6 +106,26 @@ attachHeader texts settings model _ attach =
|
||||
multiAttach =
|
||||
List.length model.item.attachments > 1
|
||||
|
||||
selectPossible =
|
||||
multiAttach && model.attachMenuOpen
|
||||
|
||||
selectView =
|
||||
case model.viewMode of
|
||||
SelectView _ ->
|
||||
True
|
||||
_ ->
|
||||
False
|
||||
|
||||
selectToggleText =
|
||||
case model.viewMode of
|
||||
SelectView _ ->
|
||||
texts.exitSelectMode
|
||||
_ ->
|
||||
texts.selectModeTitle
|
||||
|
||||
noAttachmentsSelected =
|
||||
List.isEmpty model.item.attachments
|
||||
|
||||
attachSelectToggle mobile =
|
||||
a
|
||||
[ href "#"
|
||||
@ -143,15 +157,40 @@ attachHeader texts settings model _ attach =
|
||||
, title texts.openFileInNewTab
|
||||
, class S.secondaryBasicButton
|
||||
, class "ml-2"
|
||||
, classList [ ( "hidden", selectView ) ]
|
||||
]
|
||||
[ 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 )
|
||||
]
|
||||
, href "#"
|
||||
, title selectToggleText
|
||||
, onClick ToggleSelectView
|
||||
]
|
||||
[ i [ class "fa fa-tasks" ] []
|
||||
]
|
||||
, a
|
||||
[ classList [ ( S.deleteButton, True )
|
||||
, ( "disabled", noAttachmentsSelected )
|
||||
, ( "hidden", not selectPossible || not selectView )
|
||||
, ( "ml-2", True )
|
||||
]
|
||||
, href "#"
|
||||
, title texts.deleteAttachments
|
||||
]
|
||||
[ i [ class "fa fa-trash" ] []
|
||||
]
|
||||
, MB.viewItem <|
|
||||
MB.Dropdown
|
||||
{ linkIcon = "fa fa-bars"
|
||||
, linkClass =
|
||||
[ ( "ml-2", True )
|
||||
, ( S.secondaryBasicButton, True )
|
||||
, ( "hidden", selectView )
|
||||
]
|
||||
, toggleMenu = ToggleAttachmentDropdown
|
||||
, menuOpen = model.attachmentDropdownOpen
|
||||
|
Reference in New Issue
Block a user