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,13 +4,16 @@ module Comp.OrgTable exposing
, emptyModel
, update
, view
, view2
)
import Api.Model.Organization exposing (Organization)
import Comp.Basic as B
import Data.Flags exposing (Flags)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Styles as S
import Util.Address
import Util.Contact
@ -88,3 +91,42 @@ renderOrgLine model org =
[ Util.Contact.toString org.contacts |> text
]
]
--- View2
view2 : Model -> Html Msg
view2 model =
table [ class S.tableMain ]
[ thead []
[ tr []
[ th [ class "" ] []
, th [ class "text-left" ] [ text "Name" ]
, th [ class "text-left hidden md:table-cell" ] [ text "Address" ]
, th [ class "text-left hidden sm:table-cell" ] [ text "Contact" ]
]
]
, tbody []
(List.map (renderOrgLine2 model) model.orgs)
]
renderOrgLine2 : Model -> Organization -> Html Msg
renderOrgLine2 model org =
tr
[ classList [ ( "active", model.selected == Just org ) ]
, class S.tableRow
]
[ B.editLinkTableCell (Select org)
, td [ class "py-4 sm:py-2 pr-2 md:pr-4" ]
[ text org.name
]
, td [ class "py-4 sm:py-2 pr-4 hidden md:table-cell" ]
[ Util.Address.toString org.address |> text
]
, td [ class "py-4 sm:py-2 sm:py-2 pr-2 md:pr-4 hidden sm:table-cell" ]
[ Util.Contact.toString org.contacts |> text
]
]