First version of new ui based on tailwind

This drops fomantic-ui as css toolkit and introduces tailwindcss. With
tailwind there are no predefined components, but it's very easy to
create those. So customizing the look&feel is much simpler, most of
the time no additional css is needed.

This requires a complete rewrite of the markup + styles. Luckily all
logic can be kept as is. The now old ui is not removed, it is still
available by using a request header `Docspell-Ui` with a value of `1`
for the old ui and `2` for the new ui.

Another addition is "dev mode", where docspell serves assets with a
no-cache header, to disable browser caching. This makes developing a
lot easier.
This commit is contained in:
Eike Kettner
2021-01-29 20:48:27 +01:00
parent 442b76c5af
commit dd935454c9
140 changed files with 15077 additions and 214 deletions

View File

@ -4,14 +4,18 @@ module Comp.SourceTable exposing
, isEdit
, update
, view
, view2
)
import Api.Model.SourceAndTags exposing (SourceAndTags)
import Comp.Basic as B
import Data.Flags exposing (Flags)
import Data.Priority
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Styles as S
import Util.Html
type SelectMode
@ -48,6 +52,10 @@ update _ msg =
( Cmd.none, Display source )
--- View
view : List SourceAndTags -> Html Msg
view sources =
table [ class "ui table" ]
@ -115,3 +123,63 @@ renderSourceLine source =
[ text source.source.id
]
]
--- View2
view2 : List SourceAndTags -> Html Msg
view2 sources =
table [ class S.tableMain ]
[ thead []
[ tr []
[ th [ class "" ] []
, th [ class "text-left" ] [ text "Abbrev" ]
, th [ class "px-2 text-center" ] [ text "Enabled" ]
, th [ class "hidden md:table-cell" ] [ text "Counter" ]
, th [ class "hidden md:table-cell" ] [ text "Priority" ]
, th [ class "hidden sm:table-cell" ] [ text "Id" ]
]
]
, tbody []
(List.map renderSourceLine2 sources)
]
renderSourceLine2 : SourceAndTags -> Html Msg
renderSourceLine2 source =
tr
[ class S.tableRow ]
[ td [ class S.editLinkTableCellStyle ]
[ div
[ class "inline-flex space-x-2"
]
[ B.editLinkLabel (Select source)
, B.linkLabel
{ label = "Show"
, icon = "fa fa-eye"
, handler = Show source
, disabled = not source.source.enabled
}
]
]
, td [ class "text-left" ]
[ text source.source.abbrev
]
, td [ class "w-px px-2 text-center" ]
[ Util.Html.checkbox2 source.source.enabled
]
, td [ class "text-center hidden md:table-cell" ]
[ source.source.counter |> String.fromInt |> text
]
, td [ class "text-center hidden md:table-cell" ]
[ Data.Priority.fromString source.source.priority
|> Maybe.map Data.Priority.toName
|> Maybe.withDefault source.source.priority
|> text
]
, td [ class "text-center hidden sm:table-cell" ]
[ text source.source.id
]
]