mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Move lesser used menubar items into a menu
This commit is contained in:
@ -41,6 +41,7 @@ menuItem : Texts -> Model msg -> ChannelType -> MB.DropdownMenu msg
|
|||||||
menuItem texts model ct =
|
menuItem texts model ct =
|
||||||
{ icon = Data.ChannelType.icon ct "w-6 h-6 text-center inline-block"
|
{ icon = Data.ChannelType.icon ct "w-6 h-6 text-center inline-block"
|
||||||
, label = texts ct
|
, label = texts ct
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href ""
|
[ href ""
|
||||||
, onClick (model.onItem ct)
|
, onClick (model.onItem ct)
|
||||||
|
@ -228,6 +228,7 @@ attachHeader texts settings model _ attach =
|
|||||||
, items =
|
, items =
|
||||||
[ { icon = i [ class "fa fa-download" ] []
|
[ { icon = i [ class "fa fa-download" ] []
|
||||||
, label = texts.downloadFile
|
, label = texts.downloadFile
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ download attachName
|
[ download attachName
|
||||||
, href fileUrl
|
, href fileUrl
|
||||||
@ -235,6 +236,7 @@ attachHeader texts settings model _ attach =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-file" ] []
|
, { icon = i [ class "fa fa-file" ] []
|
||||||
, label = texts.renameFile
|
, label = texts.renameFile
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
, onClick (EditAttachNameStart attach.id)
|
, onClick (EditAttachNameStart attach.id)
|
||||||
@ -242,6 +244,7 @@ attachHeader texts settings model _ attach =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-file-archive" ] []
|
, { icon = i [ class "fa fa-file-archive" ] []
|
||||||
, label = texts.downloadOriginalArchiveFile
|
, label = texts.downloadOriginalArchiveFile
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href (fileUrl ++ "/archive")
|
[ href (fileUrl ++ "/archive")
|
||||||
, target "_new"
|
, target "_new"
|
||||||
@ -250,6 +253,7 @@ attachHeader texts settings model _ attach =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-external-link-alt" ] []
|
, { icon = i [ class "fa fa-external-link-alt" ] []
|
||||||
, label = texts.originalFile
|
, label = texts.originalFile
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href (fileUrl ++ "/original")
|
[ href (fileUrl ++ "/original")
|
||||||
, target "_new"
|
, target "_new"
|
||||||
@ -263,6 +267,7 @@ attachHeader texts settings model _ attach =
|
|||||||
else
|
else
|
||||||
i [ class "fa fa-toggle-off" ] []
|
i [ class "fa fa-toggle-off" ] []
|
||||||
, label = texts.viewExtractedData
|
, label = texts.viewExtractedData
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ onClick (AttachMetaClick attach.id)
|
[ onClick (AttachMetaClick attach.id)
|
||||||
, href "#"
|
, href "#"
|
||||||
@ -270,6 +275,7 @@ attachHeader texts settings model _ attach =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-redo-alt" ] []
|
, { icon = i [ class "fa fa-redo-alt" ] []
|
||||||
, label = texts.reprocessFile
|
, label = texts.reprocessFile
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ onClick (RequestReprocessFile attach.id)
|
[ onClick (RequestReprocessFile attach.id)
|
||||||
, href "#"
|
, href "#"
|
||||||
@ -277,6 +283,7 @@ attachHeader texts settings model _ attach =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class Icons.showQr ] []
|
, { icon = i [ class Icons.showQr ] []
|
||||||
, label = texts.showQrCode
|
, label = texts.showQrCode
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ onClick (ToggleShowQrAttach attach.id)
|
[ onClick (ToggleShowQrAttach attach.id)
|
||||||
, href "#"
|
, href "#"
|
||||||
@ -284,6 +291,7 @@ attachHeader texts settings model _ attach =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-trash" ] []
|
, { icon = i [ class "fa fa-trash" ] []
|
||||||
, label = texts.deleteThisFile
|
, label = texts.deleteThisFile
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ onClick (RequestDeleteAttachment attach.id)
|
[ onClick (RequestDeleteAttachment attach.id)
|
||||||
, href "#"
|
, href "#"
|
||||||
|
@ -96,6 +96,7 @@ type alias DropdownData msg =
|
|||||||
type alias DropdownMenu msg =
|
type alias DropdownMenu msg =
|
||||||
{ icon : Html msg
|
{ icon : Html msg
|
||||||
, label : String
|
, label : String
|
||||||
|
, disabled : Bool
|
||||||
, attrs : List (Attribute msg)
|
, attrs : List (Attribute msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,10 +172,16 @@ makeDropdown model =
|
|||||||
menuStyle =
|
menuStyle =
|
||||||
"absolute right-0 bg-white dark:bg-slate-800 border dark:border-slate-700 z-50 dark:text-slate-300 shadow-lg transition duration-200 min-w-max "
|
"absolute right-0 bg-white dark:bg-slate-800 border dark:border-slate-700 z-50 dark:text-slate-300 shadow-lg transition duration-200 min-w-max "
|
||||||
|
|
||||||
itemStyle =
|
itemStyleBase =
|
||||||
"transition-colors duration-200 items-center block px-4 py-2 text-normal hover:bg-gray-200 dark:hover:bg-slate-700 dark:hover:text-slate-50"
|
"transition-colors duration-200 items-center block px-4 py-2 text-normal z-50 "
|
||||||
|
|
||||||
menuItem m =
|
itemStyleHover =
|
||||||
|
" hover:bg-gray-200 dark:hover:bg-slate-700 dark:hover:text-slate-50"
|
||||||
|
|
||||||
|
itemStyle =
|
||||||
|
itemStyleBase ++ itemStyleHover
|
||||||
|
|
||||||
|
menuLink m =
|
||||||
a
|
a
|
||||||
(class itemStyle :: m.attrs)
|
(class itemStyle :: m.attrs)
|
||||||
[ m.icon
|
[ m.icon
|
||||||
@ -185,6 +192,34 @@ makeDropdown model =
|
|||||||
[ text m.label
|
[ text m.label
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
disabledLink m =
|
||||||
|
a
|
||||||
|
([ href "#"
|
||||||
|
, disabled True
|
||||||
|
, class itemStyleBase
|
||||||
|
, class "disabled"
|
||||||
|
]
|
||||||
|
++ m.attrs
|
||||||
|
)
|
||||||
|
[ m.icon
|
||||||
|
, span
|
||||||
|
[ class "ml-2"
|
||||||
|
, classList [ ( "hidden", m.label == "" ) ]
|
||||||
|
]
|
||||||
|
[ text m.label
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
menuItem m =
|
||||||
|
if m.label == "separator" then
|
||||||
|
div [ class "py-1" ] [ hr [ class S.border ] [] ]
|
||||||
|
|
||||||
|
else if m.disabled then
|
||||||
|
disabledLink m
|
||||||
|
|
||||||
|
else
|
||||||
|
menuLink m
|
||||||
in
|
in
|
||||||
div [ class "relative" ]
|
div [ class "relative" ]
|
||||||
[ a
|
[ a
|
||||||
|
@ -872,7 +872,7 @@ update mId key flags texts settings msg model =
|
|||||||
cmd =
|
cmd =
|
||||||
Api.saveClientSettings flags newSettings (ClientSettingsSaveResp newSettings)
|
Api.saveClientSettings flags newSettings (ClientSettingsSaveResp newSettings)
|
||||||
in
|
in
|
||||||
noSub ( model, cmd )
|
noSub ( { model | viewMenuOpen = False }, cmd )
|
||||||
|
|
||||||
ClientSettingsSaveResp newSettings (Ok res) ->
|
ClientSettingsSaveResp newSettings (Ok res) ->
|
||||||
if res.success then
|
if res.success then
|
||||||
@ -922,7 +922,7 @@ update mId key flags texts settings msg model =
|
|||||||
( pm, pc ) =
|
( pm, pc ) =
|
||||||
Comp.PublishItems.initQuery flags q
|
Comp.PublishItems.initQuery flags q
|
||||||
in
|
in
|
||||||
noSub ( { model | viewMode = PublishView pm }, Cmd.map PublishViewMsg pc )
|
noSub ( { model | viewMode = PublishView pm, viewMenuOpen = False }, Cmd.map PublishViewMsg pc )
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
noSub ( model, Cmd.none )
|
noSub ( model, Cmd.none )
|
||||||
|
@ -254,29 +254,26 @@ defaultMenuBar texts flags settings model =
|
|||||||
|
|
||||||
isListView =
|
isListView =
|
||||||
settings.itemSearchArrange == Data.ItemArrange.List
|
settings.itemSearchArrange == Data.ItemArrange.List
|
||||||
|
|
||||||
|
menuSep =
|
||||||
|
{ icon = i [] []
|
||||||
|
, label = "separator"
|
||||||
|
, disabled = False
|
||||||
|
, attrs =
|
||||||
|
[]
|
||||||
|
}
|
||||||
in
|
in
|
||||||
MB.view
|
MB.view
|
||||||
{ end =
|
{ start =
|
||||||
[ MB.CustomElement <|
|
[ MB.CustomElement <|
|
||||||
B.secondaryBasicButton
|
if settings.powerSearchEnabled then
|
||||||
{ label = ""
|
powerSearchBar
|
||||||
, icon = Icons.share
|
|
||||||
, disabled = createQuery model == Nothing
|
|
||||||
, handler = onClick TogglePublishCurrentQueryView
|
|
||||||
, attrs =
|
|
||||||
[ title <|
|
|
||||||
if createQuery model == Nothing then
|
|
||||||
texts.nothingSelectedToShare
|
|
||||||
|
|
||||||
else
|
else
|
||||||
texts.publishCurrentQueryTitle
|
simpleSearchBar
|
||||||
, classList
|
]
|
||||||
[ ( btnStyle, True )
|
, end =
|
||||||
]
|
[ MB.CustomElement <|
|
||||||
, href "#"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
, MB.CustomElement <|
|
|
||||||
B.secondaryBasicButton
|
B.secondaryBasicButton
|
||||||
{ label = ""
|
{ label = ""
|
||||||
, icon =
|
, icon =
|
||||||
@ -300,7 +297,7 @@ defaultMenuBar texts flags settings model =
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
, MB.Dropdown
|
, MB.Dropdown
|
||||||
{ linkIcon = "fa fa-grip-vertical"
|
{ linkIcon = "fa fa-bars"
|
||||||
, label = ""
|
, label = ""
|
||||||
, linkClass =
|
, linkClass =
|
||||||
[ ( S.secondaryBasicButton, True )
|
[ ( S.secondaryBasicButton, True )
|
||||||
@ -314,6 +311,7 @@ defaultMenuBar texts flags settings model =
|
|||||||
|
|
||||||
else
|
else
|
||||||
i [ class "fa fa-square font-thin" ] []
|
i [ class "fa fa-square font-thin" ] []
|
||||||
|
, disabled = False
|
||||||
, label = texts.showItemGroups
|
, label = texts.showItemGroups
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
@ -326,6 +324,7 @@ defaultMenuBar texts flags settings model =
|
|||||||
|
|
||||||
else
|
else
|
||||||
i [ class "fa fa-list" ] []
|
i [ class "fa fa-list" ] []
|
||||||
|
, disabled = False
|
||||||
, label = texts.listView
|
, label = texts.listView
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
@ -338,6 +337,7 @@ defaultMenuBar texts flags settings model =
|
|||||||
|
|
||||||
else
|
else
|
||||||
i [ class "fa fa-th-large" ] []
|
i [ class "fa fa-th-large" ] []
|
||||||
|
, disabled = False
|
||||||
, label = texts.tileView
|
, label = texts.tileView
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
@ -346,36 +346,49 @@ defaultMenuBar texts flags settings model =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-compress" ] []
|
, { icon = i [ class "fa fa-compress" ] []
|
||||||
, label = texts.expandCollapseRows
|
, label = texts.expandCollapseRows
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
, classList [ ( "hidden", not isListView ) ]
|
, classList [ ( "hidden", not isListView ) ]
|
||||||
, onClick ToggleExpandCollapseRows
|
, onClick ToggleExpandCollapseRows
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
, menuSep
|
||||||
}
|
, { label = "Share Results"
|
||||||
]
|
, icon = Icons.shareIcon ""
|
||||||
, start =
|
, disabled = createQuery model == Nothing
|
||||||
[ MB.CustomElement <|
|
, attrs =
|
||||||
if settings.powerSearchEnabled then
|
[ title <|
|
||||||
powerSearchBar
|
if createQuery model == Nothing then
|
||||||
|
texts.nothingSelectedToShare
|
||||||
|
|
||||||
else
|
else
|
||||||
simpleSearchBar
|
texts.publishCurrentQueryTitle
|
||||||
, MB.CustomButton
|
, href "#"
|
||||||
{ tagger = TogglePreviewFullWidth
|
, if createQuery model == Nothing then
|
||||||
, label = ""
|
class ""
|
||||||
, icon = Just "fa fa-expand"
|
|
||||||
, title =
|
|
||||||
if settings.cardPreviewFullWidth then
|
|
||||||
texts.fullHeightPreviewTitle
|
|
||||||
|
|
||||||
else
|
else
|
||||||
texts.fullWidthPreviewTitle
|
onClick TogglePublishCurrentQueryView
|
||||||
, inputClass =
|
]
|
||||||
[ ( btnStyle, True )
|
}
|
||||||
, ( "hidden sm:inline-block", False )
|
, { label =
|
||||||
, ( "bg-gray-200 dark:bg-slate-600", settings.cardPreviewFullWidth )
|
if settings.cardPreviewFullWidth then
|
||||||
|
texts.fullHeightPreviewTitle
|
||||||
|
|
||||||
|
else
|
||||||
|
texts.fullWidthPreviewTitle
|
||||||
|
, icon = i [ class "fa fa-expand" ] []
|
||||||
|
, disabled = False
|
||||||
|
, attrs =
|
||||||
|
[ href "#"
|
||||||
|
, onClick TogglePreviewFullWidth
|
||||||
|
, classList
|
||||||
|
[ ( "hidden sm:inline-block", False )
|
||||||
|
, ( "bg-gray-200 dark:bg-slate-600", settings.cardPreviewFullWidth )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -125,6 +125,7 @@ view texts flags model =
|
|||||||
else
|
else
|
||||||
i [ class "fa fa-square font-thin" ] []
|
i [ class "fa fa-square font-thin" ] []
|
||||||
, label = texts.showItemGroups
|
, label = texts.showItemGroups
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
, onClick ToggleShowGroups
|
, onClick ToggleShowGroups
|
||||||
@ -132,6 +133,7 @@ view texts flags model =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-list" ] []
|
, { icon = i [ class "fa fa-list" ] []
|
||||||
, label = texts.listView
|
, label = texts.listView
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
, onClick (ToggleArrange Data.ItemArrange.List)
|
, onClick (ToggleArrange Data.ItemArrange.List)
|
||||||
@ -139,6 +141,7 @@ view texts flags model =
|
|||||||
}
|
}
|
||||||
, { icon = i [ class "fa fa-th-large" ] []
|
, { icon = i [ class "fa fa-th-large" ] []
|
||||||
, label = texts.tileView
|
, label = texts.tileView
|
||||||
|
, disabled = False
|
||||||
, attrs =
|
, attrs =
|
||||||
[ href "#"
|
[ href "#"
|
||||||
, onClick (ToggleArrange Data.ItemArrange.Cards)
|
, onClick (ToggleArrange Data.ItemArrange.Cards)
|
||||||
|
Reference in New Issue
Block a user