mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 19:08:26 +00:00
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:
@ -5,12 +5,15 @@ module Comp.EmailSettingsTable exposing
|
||||
, init
|
||||
, update
|
||||
, view
|
||||
, view2
|
||||
)
|
||||
|
||||
import Api.Model.EmailSettings exposing (EmailSettings)
|
||||
import Comp.Basic as B
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Styles as S
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -42,6 +45,10 @@ update msg model =
|
||||
( { model | selected = Just ems }, Cmd.none )
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
table [ class "ui selectable pointer table" ]
|
||||
@ -76,3 +83,45 @@ renderLine model ems =
|
||||
, td [] [ text hostport ]
|
||||
, td [] [ text ems.from ]
|
||||
]
|
||||
|
||||
|
||||
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
[ th [ class "" ] []
|
||||
, th [ class "text-left mr-2" ] [ text "Name" ]
|
||||
, th [ class "text-left mr-2" ] [ text "Host/Port" ]
|
||||
, th [ class "text-left mr-2 hidden sm:table-cell" ] [ text "From" ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderLine2 model) model.emailSettings)
|
||||
]
|
||||
|
||||
|
||||
renderLine2 : Model -> EmailSettings -> Html Msg
|
||||
renderLine2 _ ems =
|
||||
let
|
||||
hostport =
|
||||
case ems.smtpPort of
|
||||
Just p ->
|
||||
ems.smtpHost ++ ":" ++ String.fromInt p
|
||||
|
||||
Nothing ->
|
||||
ems.smtpHost
|
||||
in
|
||||
tr
|
||||
[ class S.tableRow ]
|
||||
[ B.editLinkTableCell (Select ems)
|
||||
, td [ class "text-left mr-2" ]
|
||||
[ text ems.name
|
||||
]
|
||||
, td [ class "text-left mr-2" ] [ text hostport ]
|
||||
, td [ class "text-left" ] [ text ems.from ]
|
||||
]
|
||||
|
Reference in New Issue
Block a user