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

@ -5,18 +5,23 @@ module Comp.CustomFieldManage exposing
, init
, update
, view
, view2
)
import Api
import Api.Model.CustomField exposing (CustomField)
import Api.Model.CustomFieldList exposing (CustomFieldList)
import Comp.Basic as B
import Comp.CustomFieldForm
import Comp.CustomFieldTable
import Comp.MenuBar as MB
import Data.Flags exposing (Flags)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import Http
import Styles as S
import Util.CustomField
type alias Model =
@ -192,3 +197,69 @@ viewTable model =
[ div [ class "ui loader" ] []
]
]
--- View2
view2 : Flags -> Model -> Html Msg
view2 flags model =
case model.detailModel of
Just dm ->
viewDetail2 flags dm
Nothing ->
viewTable2 model
viewDetail2 : Flags -> Comp.CustomFieldForm.Model -> Html Msg
viewDetail2 _ detailModel =
let
viewSettings =
Comp.CustomFieldForm.fullViewSettings
in
div []
([ if detailModel.field.id == "" then
h3 [ class S.header2 ]
[ text "Create new custom field"
]
else
h3 [ class S.header2 ]
[ Util.CustomField.nameOrLabel detailModel.field |> text
, div [ class "opacity-50 text-sm" ]
[ text "Id: "
, text detailModel.field.id
]
]
]
++ List.map (Html.map DetailMsg) (Comp.CustomFieldForm.view2 viewSettings detailModel)
)
viewTable2 : Model -> Html Msg
viewTable2 model =
div [ class "flex flex-col md:relative" ]
[ MB.view
{ start =
[ MB.TextInput
{ tagger = SetQuery
, value = model.query
, placeholder = "Search"
, icon = Just "fa fa-search"
}
]
, end =
[ MB.PrimaryButton
{ tagger = InitNewCustomField
, title = "Add a new custom field"
, icon = Just "fa fa-plus"
, label = "New custom field"
}
]
, rootClasses = "mb-4"
}
, Html.map TableMsg (Comp.CustomFieldTable.view2 model.tableModel model.fields)
, B.loadingDimmer model.loading
]