Add a qr code to the link of an item or attachment

This commit is contained in:
eikek
2021-08-17 02:15:14 +02:00
parent 2d2f9e3e87
commit 8f23b68587
14 changed files with 307 additions and 41 deletions

View File

@ -11,8 +11,19 @@ import Api
import Api.Model.Attachment exposing (Attachment)
import Comp.AttachmentMeta
import Comp.ItemDetail.ConfirmModalView
import Comp.ItemDetail.Model exposing (Model, Msg(..), NotesField(..), SaveNameState(..), ViewMode(..))
import Comp.ItemDetail.Model
exposing
( Model
, Msg(..)
, NotesField(..)
, SaveNameState(..)
, ViewMode(..)
, isShowQrAttach
)
import Comp.ItemDetail.ShowQrCode
import Comp.MenuBar as MB
import Data.Flags exposing (Flags)
import Data.Icons as Icons
import Data.UiSettings exposing (UiSettings)
import Dict
import Html exposing (..)
@ -27,8 +38,8 @@ import Util.Size
import Util.String
view : Texts -> UiSettings -> Model -> Int -> Attachment -> Html Msg
view texts settings model pos attach =
view : Texts -> Flags -> UiSettings -> Model -> Int -> Attachment -> Html Msg
view texts flags settings model pos attach =
let
fileUrl =
Api.fileURL attach.id
@ -61,6 +72,11 @@ view texts settings model pos attach =
Nothing ->
span [ class "hidden" ] []
else if isShowQrAttach model.showQrModel then
Comp.ItemDetail.ShowQrCode.view1 flags
"border-r border-l border-b dark:border-bluegray-600 h-full"
(Comp.ItemDetail.ShowQrCode.Attach attach.id)
else
div
[ class "flex flex-col relative px-2 pt-2 h-full"
@ -269,6 +285,13 @@ attachHeader texts settings model _ attach =
, href "#"
]
}
, { icon = Icons.showQr
, label = texts.showQrCode
, attrs =
[ onClick (ToggleShowQrAttach attach.id)
, href "#"
]
}
, { icon = "fa fa-trash"
, label = texts.deleteThisFile
, attrs =