Make link to original file enabled if files are different

This commit is contained in:
Eike Kettner 2020-02-23 14:33:22 +01:00
parent 957073fe62
commit 1f431c3222

View File

@ -40,6 +40,7 @@ import Http
import Markdown import Markdown
import Page exposing (Page(..)) import Page exposing (Page(..))
import Util.Http import Util.Http
import Util.List
import Util.Maybe import Util.Maybe
import Util.Size import Util.Size
import Util.String import Util.String
@ -1176,8 +1177,23 @@ renderAttachmentView model pos attach =
] ]
, div [ class "right menu" ] , div [ class "right menu" ]
[ a [ a
[ class "item" [ classList
, title "Goto Original file" [ ( "item", True )
, ( "disabled", not attach.converted )
]
, title
(if attach.converted then
case Util.List.find (\s -> s.id == attach.id) model.item.sources of
Just src ->
"Goto original: "
++ Maybe.withDefault "<noname>" src.name
Nothing ->
"Goto original file"
else
"This is the original file"
)
, href (fileUrl ++ "/original") , href (fileUrl ++ "/original")
, target "_new" , target "_new"
] ]