mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-25 16:45:05 +00:00
commit
98ee813820
@ -122,10 +122,7 @@ view cfg settings model item =
|
|||||||
item.state /= "created"
|
item.state /= "created"
|
||||||
|
|
||||||
cardColor =
|
cardColor =
|
||||||
if isSelected cfg item.id then
|
if not isConfirmed then
|
||||||
"purple"
|
|
||||||
|
|
||||||
else if not isConfirmed then
|
|
||||||
"blue"
|
"blue"
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -141,6 +138,25 @@ view cfg settings model item =
|
|||||||
|
|
||||||
Data.ItemSelection.Active ids ->
|
Data.ItemSelection.Active ids ->
|
||||||
onClick (ToggleSelectItem ids item.id)
|
onClick (ToggleSelectItem ids item.id)
|
||||||
|
|
||||||
|
selectedDimmer =
|
||||||
|
div
|
||||||
|
[ classList
|
||||||
|
[ ( "ui light dimmer", True )
|
||||||
|
, ( "active", isSelected cfg item.id )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
[ div [ class "content" ]
|
||||||
|
[ a
|
||||||
|
[ cardAction
|
||||||
|
]
|
||||||
|
[ i [ class "huge icons purple" ]
|
||||||
|
[ i [ class "big circle outline icon" ] []
|
||||||
|
, i [ class "check icon" ] []
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
in
|
in
|
||||||
div
|
div
|
||||||
([ classList
|
([ classList
|
||||||
@ -152,16 +168,21 @@ view cfg settings model item =
|
|||||||
]
|
]
|
||||||
++ DD.draggable ItemDDMsg item.id
|
++ DD.draggable ItemDDMsg item.id
|
||||||
)
|
)
|
||||||
[ if fieldHidden Data.Fields.PreviewImage then
|
((if fieldHidden Data.Fields.PreviewImage then
|
||||||
span [ class "invisible" ] []
|
[]
|
||||||
|
|
||||||
else
|
else
|
||||||
previewImage settings model item
|
[ selectedDimmer
|
||||||
, mainContent cardAction cardColor isConfirmed settings cfg item
|
, previewMenu model item (currentAttachment model item)
|
||||||
, notesContent settings item
|
, previewImage settings cardAction model item
|
||||||
, metaDataContent settings item
|
]
|
||||||
, fulltextResultsContent item
|
)
|
||||||
]
|
++ [ mainContent cardAction cardColor isConfirmed settings cfg item
|
||||||
|
, notesContent settings item
|
||||||
|
, metaDataContent settings item
|
||||||
|
, fulltextResultsContent item
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
fulltextResultsContent : ItemLight -> Html Msg
|
fulltextResultsContent : ItemLight -> Html Msg
|
||||||
@ -306,35 +327,25 @@ mainContent cardAction cardColor isConfirmed settings cfg item =
|
|||||||
Data.UiSettings.fieldHidden settings f
|
Data.UiSettings.fieldHidden settings f
|
||||||
in
|
in
|
||||||
a
|
a
|
||||||
[ class "link content"
|
[ class "content"
|
||||||
, href "#"
|
, href "#"
|
||||||
, cardAction
|
, cardAction
|
||||||
]
|
]
|
||||||
[ case cfg.selection of
|
[ if fieldHidden Data.Fields.Direction then
|
||||||
Data.ItemSelection.Active ids ->
|
div [ class "header" ]
|
||||||
div [ class "header" ]
|
[ Util.String.underscoreToSpace item.name |> text
|
||||||
[ Util.Html.checkbox (Set.member item.id ids)
|
]
|
||||||
, dirIcon
|
|
||||||
, Util.String.underscoreToSpace item.name
|
|
||||||
|> text
|
|
||||||
]
|
|
||||||
|
|
||||||
Data.ItemSelection.Inactive ->
|
else
|
||||||
if fieldHidden Data.Fields.Direction then
|
div
|
||||||
div [ class "header" ]
|
[ class "header"
|
||||||
[ Util.String.underscoreToSpace item.name |> text
|
, Data.Direction.labelFromMaybe item.direction
|
||||||
]
|
|> title
|
||||||
|
]
|
||||||
else
|
[ dirIcon
|
||||||
div
|
, Util.String.underscoreToSpace item.name
|
||||||
[ class "header"
|
|> text
|
||||||
, Data.Direction.labelFromMaybe item.direction
|
]
|
||||||
|> title
|
|
||||||
]
|
|
||||||
[ dirIcon
|
|
||||||
, Util.String.underscoreToSpace item.name
|
|
||||||
|> text
|
|
||||||
]
|
|
||||||
, div
|
, div
|
||||||
[ classList
|
[ classList
|
||||||
[ ( "ui right corner label", True )
|
[ ( "ui right corner label", True )
|
||||||
@ -376,20 +387,21 @@ mainContent cardAction cardColor isConfirmed settings cfg item =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
previewImage : UiSettings -> Model -> ItemLight -> Html Msg
|
previewImage : UiSettings -> Attribute Msg -> Model -> ItemLight -> Html Msg
|
||||||
previewImage settings model item =
|
previewImage settings cardAction model item =
|
||||||
let
|
let
|
||||||
|
mainAttach =
|
||||||
|
currentAttachment model item
|
||||||
|
|
||||||
previewUrl =
|
previewUrl =
|
||||||
Maybe.map .id mainAttach
|
Maybe.map .id mainAttach
|
||||||
|> Maybe.map Api.attachmentPreviewURL
|
|> Maybe.map Api.attachmentPreviewURL
|
||||||
|> Maybe.withDefault (Api.itemBasePreviewURL item.id)
|
|> Maybe.withDefault (Api.itemBasePreviewURL item.id)
|
||||||
|
|
||||||
mainAttach =
|
|
||||||
currentAttachment model item
|
|
||||||
in
|
in
|
||||||
div
|
a
|
||||||
[ class "image ds-card-image"
|
[ class "image ds-card-image"
|
||||||
, Data.UiSettings.cardPreviewSize settings
|
, Data.UiSettings.cardPreviewSize settings
|
||||||
|
, cardAction
|
||||||
]
|
]
|
||||||
[ img
|
[ img
|
||||||
[ class "preview-image"
|
[ class "preview-image"
|
||||||
@ -397,52 +409,73 @@ previewImage settings model item =
|
|||||||
, Data.UiSettings.cardPreviewSize settings
|
, Data.UiSettings.cardPreviewSize settings
|
||||||
]
|
]
|
||||||
[]
|
[]
|
||||||
, pageCountLabel model item mainAttach
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
pageCountLabel : Model -> ItemLight -> Maybe AttachmentLight -> Html Msg
|
previewMenu : Model -> ItemLight -> Maybe AttachmentLight -> Html Msg
|
||||||
pageCountLabel model item mainAttach =
|
previewMenu model item mainAttach =
|
||||||
let
|
let
|
||||||
pageCount =
|
pageCount =
|
||||||
Maybe.andThen .pageCount mainAttach
|
Maybe.andThen .pageCount mainAttach
|
||||||
|> Maybe.withDefault 0
|
|> Maybe.withDefault 0
|
||||||
in
|
|
||||||
div
|
|
||||||
[ classList
|
|
||||||
[ ( "card-attachment-nav top", True )
|
|
||||||
, ( "invisible", pageCount == 0 || (item.fileCount == 1 && pageCount == 1) )
|
|
||||||
]
|
|
||||||
]
|
|
||||||
[ if item.fileCount == 1 then
|
|
||||||
div
|
|
||||||
[ class "ui secondary basic mini label"
|
|
||||||
, title "Number of pages"
|
|
||||||
]
|
|
||||||
[ text "p."
|
|
||||||
, text (String.fromInt pageCount)
|
|
||||||
]
|
|
||||||
|
|
||||||
else
|
attachUrl =
|
||||||
div [ class "ui left labeled mini button" ]
|
Maybe.map .id mainAttach
|
||||||
[ div [ class "ui basic right pointing mini label" ]
|
|> Maybe.map ((++) "/api/v1/sec/attachment/")
|
||||||
[ currentPosition model item
|
|> Maybe.withDefault "/api/v1/sec/attachment/none"
|
||||||
|> String.fromInt
|
|
||||||
|> text
|
gotoFileBtn =
|
||||||
, text "/"
|
a
|
||||||
, text (String.fromInt item.fileCount)
|
[ class "ui compact basic icon button"
|
||||||
, text " p."
|
, href attachUrl
|
||||||
, text (String.fromInt pageCount)
|
, target "_self"
|
||||||
|
]
|
||||||
|
[ i [ class "eye icon" ] []
|
||||||
|
]
|
||||||
|
in
|
||||||
|
if pageCount == 0 || (item.fileCount == 1 && pageCount == 1) then
|
||||||
|
div [ class "card-attachment-nav" ]
|
||||||
|
[ gotoFileBtn
|
||||||
|
]
|
||||||
|
|
||||||
|
else if item.fileCount == 1 then
|
||||||
|
div [ class "card-attachment-nav" ]
|
||||||
|
[ div [ class "ui small top attached basic icon buttons" ]
|
||||||
|
[ gotoFileBtn
|
||||||
|
]
|
||||||
|
, div [ class "ui attached basic fitted center aligned blue segment" ]
|
||||||
|
[ span
|
||||||
|
[ title "Number of pages"
|
||||||
]
|
]
|
||||||
|
[ text (String.fromInt pageCount)
|
||||||
|
, text "p."
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
else
|
||||||
|
div [ class "card-attachment-nav" ]
|
||||||
|
[ div [ class "ui small top attached basic icon buttons" ]
|
||||||
|
[ gotoFileBtn
|
||||||
, a
|
, a
|
||||||
[ class "ui mini icon secondary button"
|
[ class "ui compact icon button"
|
||||||
, href "#"
|
, href "#"
|
||||||
, onClick (CyclePreview item)
|
, onClick (CyclePreview item)
|
||||||
]
|
]
|
||||||
[ i [ class "arrow right icon" ] []
|
[ i [ class "arrow right icon" ] []
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
, div [ class "ui attached basic blue fitted center aligned segment" ]
|
||||||
|
[ currentPosition model item
|
||||||
|
|> String.fromInt
|
||||||
|
|> text
|
||||||
|
, text "/"
|
||||||
|
, text (String.fromInt item.fileCount)
|
||||||
|
, text ", "
|
||||||
|
, text (String.fromInt pageCount)
|
||||||
|
, text "p."
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
renderHighlightEntry : HighlightEntry -> Html Msg
|
renderHighlightEntry : HighlightEntry -> Html Msg
|
||||||
|
@ -96,16 +96,11 @@
|
|||||||
.default-layout .ui.card .link.content:hover {
|
.default-layout .ui.card .link.content:hover {
|
||||||
box-shadow: 0 0 0 1px #d4d4d5,0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
|
box-shadow: 0 0 0 1px #d4d4d5,0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
|
||||||
}
|
}
|
||||||
.default-layout .image .card-attachment-nav {
|
.default-layout .card .card-attachment-nav {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 2px;
|
left: 4px;
|
||||||
z-index: 10;
|
top: 4px;
|
||||||
}
|
z-index: 8;
|
||||||
.default-layout .image .card-attachment-nav.bottom {
|
|
||||||
bottom: 2px;
|
|
||||||
}
|
|
||||||
.default-layout .image .card-attachment-nav.top {
|
|
||||||
top: 2px;
|
|
||||||
}
|
}
|
||||||
.default-layout .image.ds-card-image {
|
.default-layout .image.ds-card-image {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -123,13 +118,13 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
.default-layout img.preview-image.small {
|
.default-layout .image.ds-card-image img.preview-image.small {
|
||||||
max-width: 80px;
|
max-width: 80px;
|
||||||
}
|
}
|
||||||
.default-layout img.preview-image.medium {
|
.default-layout .image.ds-card-image img.preview-image.medium {
|
||||||
max-width: 160px;
|
max-width: 160px;
|
||||||
}
|
}
|
||||||
.default-layout img.preview-image.large {
|
.default-layout .image.ds-card-image img.preview-image.large {
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user