mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Remove old ui code in frontend
This commit is contained in:
@ -3,7 +3,6 @@ module Comp.UiSettingsForm exposing
|
||||
, Msg
|
||||
, init
|
||||
, update
|
||||
, view
|
||||
, view2
|
||||
)
|
||||
|
||||
@ -24,7 +23,7 @@ import Data.UiSettings exposing (ItemPattern, Pos(..), UiSettings)
|
||||
import Dict exposing (Dict)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onCheck, onClick, onInput)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Http
|
||||
import Markdown
|
||||
import Set exposing (Set)
|
||||
@ -41,7 +40,6 @@ type alias Model =
|
||||
, nativePdfPreview : Bool
|
||||
, itemSearchNoteLength : Maybe Int
|
||||
, searchNoteLengthModel : Comp.IntField.Model
|
||||
, itemDetailNotesPosition : Pos
|
||||
, searchMenuFolderCount : Maybe Int
|
||||
, searchMenuFolderCountModel : Comp.IntField.Model
|
||||
, searchMenuTagCount : Maybe Int
|
||||
@ -50,7 +48,6 @@ type alias Model =
|
||||
, searchMenuTagCatCountModel : Comp.IntField.Model
|
||||
, formFields : List Field
|
||||
, itemDetailShortcuts : Bool
|
||||
, searchMenuVisible : Bool
|
||||
, editMenuVisible : Bool
|
||||
, cardPreviewSize : BasicSize
|
||||
, cardTitlePattern : PatternModel
|
||||
@ -120,7 +117,6 @@ init flags settings =
|
||||
(Just flags.config.maxNoteLength)
|
||||
False
|
||||
"Max. Note Length"
|
||||
, itemDetailNotesPosition = settings.itemDetailNotesPosition
|
||||
, searchMenuFolderCount = Just settings.searchMenuFolderCount
|
||||
, searchMenuFolderCountModel =
|
||||
Comp.IntField.init
|
||||
@ -144,7 +140,6 @@ init flags settings =
|
||||
"Number of categories in search menu"
|
||||
, formFields = settings.formFields
|
||||
, itemDetailShortcuts = settings.itemDetailShortcuts
|
||||
, searchMenuVisible = settings.searchMenuVisible
|
||||
, editMenuVisible = settings.editMenuVisible
|
||||
, cardPreviewSize = settings.cardPreviewSize
|
||||
, cardTitlePattern = initPatternModel settings.cardTitleTemplate
|
||||
@ -165,13 +160,11 @@ type Msg
|
||||
| GetTagsResp (Result Http.Error TagList)
|
||||
| TogglePdfPreview
|
||||
| NoteLengthMsg Comp.IntField.Msg
|
||||
| SetNotesPosition Pos
|
||||
| SearchMenuFolderMsg Comp.IntField.Msg
|
||||
| SearchMenuTagMsg Comp.IntField.Msg
|
||||
| SearchMenuTagCatMsg Comp.IntField.Msg
|
||||
| FieldListMsg Comp.FieldListSelect.Msg
|
||||
| ToggleItemDetailShortcuts
|
||||
| ToggleSearchMenuVisible
|
||||
| ToggleEditMenuVisible
|
||||
| CardPreviewSizeMsg Comp.BasicSizeField.Msg
|
||||
| SetCardTitlePattern String
|
||||
@ -270,17 +263,6 @@ update sett msg model =
|
||||
in
|
||||
( model_, nextSettings )
|
||||
|
||||
SetNotesPosition pos ->
|
||||
let
|
||||
model_ =
|
||||
{ model | itemDetailNotesPosition = pos }
|
||||
in
|
||||
if model_.itemDetailNotesPosition == sett.itemDetailNotesPosition then
|
||||
( model_, Nothing )
|
||||
|
||||
else
|
||||
( model_, Just { sett | itemDetailNotesPosition = model_.itemDetailNotesPosition } )
|
||||
|
||||
TagColorMsg lm ->
|
||||
let
|
||||
( m_, d_ ) =
|
||||
@ -348,15 +330,6 @@ update sett msg model =
|
||||
, Just { sett | itemDetailShortcuts = flag }
|
||||
)
|
||||
|
||||
ToggleSearchMenuVisible ->
|
||||
let
|
||||
flag =
|
||||
not model.searchMenuVisible
|
||||
in
|
||||
( { model | searchMenuVisible = flag }
|
||||
, Just { sett | searchMenuVisible = flag }
|
||||
)
|
||||
|
||||
ToggleEditMenuVisible ->
|
||||
let
|
||||
flag =
|
||||
@ -474,235 +447,6 @@ update sett msg model =
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
tagColorViewOpts : Comp.ColorTagger.ViewOpts
|
||||
tagColorViewOpts =
|
||||
{ renderItem =
|
||||
\( k, v ) ->
|
||||
span [ class ("ui label " ++ Data.Color.toString v) ]
|
||||
[ text k ]
|
||||
, label = "Choose color for tag categories"
|
||||
, description = Just "Tags can be represented differently based on their category."
|
||||
}
|
||||
|
||||
|
||||
view : Flags -> UiSettings -> Model -> Html Msg
|
||||
view flags _ model =
|
||||
div [ class "ui form" ]
|
||||
[ div [ class "ui dividing header" ]
|
||||
[ text "Item Search"
|
||||
]
|
||||
, Html.map SearchPageSizeMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
("Maximum results in one page when searching items. At most "
|
||||
++ String.fromInt flags.config.maxPageSize
|
||||
++ "."
|
||||
)
|
||||
model.itemSearchPageSize
|
||||
"field"
|
||||
model.searchPageSizeModel
|
||||
)
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, onCheck (\_ -> ToggleSearchStatsVisible)
|
||||
, checked model.searchStatsVisible
|
||||
]
|
||||
[]
|
||||
, label []
|
||||
[ text "Show basic search statistics by default"
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "ui dividing header" ]
|
||||
[ text "Item Cards"
|
||||
]
|
||||
, Html.map NoteLengthMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
("Maximum size of the item notes to display in card view. Between 0 - "
|
||||
++ String.fromInt flags.config.maxNoteLength
|
||||
++ "."
|
||||
)
|
||||
model.itemSearchNoteLength
|
||||
"field"
|
||||
model.searchNoteLengthModel
|
||||
)
|
||||
, Html.map CardPreviewSizeMsg
|
||||
(Comp.BasicSizeField.view
|
||||
"Size of item preview"
|
||||
model.cardPreviewSize
|
||||
)
|
||||
, div [ class "field" ]
|
||||
[ label []
|
||||
[ text "Card Title Pattern"
|
||||
, a
|
||||
[ class "right-float"
|
||||
, title "Toggle pattern help text"
|
||||
, href "#"
|
||||
, onClick TogglePatternHelpMsg
|
||||
]
|
||||
[ i [ class "help link icon" ] []
|
||||
]
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, Maybe.withDefault "" model.cardTitlePattern.pattern |> value
|
||||
, onInput SetCardTitlePattern
|
||||
]
|
||||
[]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ label []
|
||||
[ text "Card Subtitle Pattern"
|
||||
, a
|
||||
[ class "right-float"
|
||||
, title "Toggle pattern help text"
|
||||
, href "#"
|
||||
, onClick TogglePatternHelpMsg
|
||||
]
|
||||
[ i [ class "help link icon" ] []
|
||||
]
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, Maybe.withDefault "" model.cardSubtitlePattern.pattern |> value
|
||||
, onInput SetCardSubtitlePattern
|
||||
]
|
||||
[]
|
||||
]
|
||||
, Markdown.toHtml
|
||||
[ classList
|
||||
[ ( "ui message", True )
|
||||
, ( "hidden", not model.showPatternHelp )
|
||||
]
|
||||
]
|
||||
IT.helpMessage
|
||||
, div [ class "ui dividing header" ]
|
||||
[ text "Search Menu" ]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, onCheck (\_ -> ToggleSearchMenuVisible)
|
||||
, checked model.searchMenuVisible
|
||||
]
|
||||
[]
|
||||
, label []
|
||||
[ text "Show search side menu by default"
|
||||
]
|
||||
]
|
||||
]
|
||||
, Html.map SearchMenuTagMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
"How many tags to display in search menu at once. Others can be expanded. Use 0 to always show all."
|
||||
model.searchMenuTagCount
|
||||
"field"
|
||||
model.searchMenuTagCountModel
|
||||
)
|
||||
, Html.map SearchMenuTagCatMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
"How many categories to display in search menu at once. Others can be expanded. Use 0 to always show all."
|
||||
model.searchMenuTagCatCount
|
||||
"field"
|
||||
model.searchMenuTagCatCountModel
|
||||
)
|
||||
, Html.map SearchMenuFolderMsg
|
||||
(Comp.IntField.viewWithInfo
|
||||
"How many folders to display in search menu at once. Other folders can be expanded. Use 0 to always show all."
|
||||
model.searchMenuFolderCount
|
||||
"field"
|
||||
model.searchMenuFolderCountModel
|
||||
)
|
||||
, div [ class "ui dividing header" ]
|
||||
[ text "Item Detail"
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, onCheck (\_ -> TogglePdfPreview)
|
||||
, checked model.nativePdfPreview
|
||||
]
|
||||
[]
|
||||
, label []
|
||||
[ text "Browser-native PDF preview"
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, onCheck (\_ -> ToggleItemDetailShortcuts)
|
||||
, checked model.itemDetailShortcuts
|
||||
]
|
||||
[]
|
||||
, label []
|
||||
[ text "Use keyboard shortcuts for navigation and confirm/unconfirm with open edit menu."
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, onCheck (\_ -> ToggleEditMenuVisible)
|
||||
, checked model.editMenuVisible
|
||||
]
|
||||
[]
|
||||
, label []
|
||||
[ text "Show edit side menu by default"
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "grouped fields" ]
|
||||
[ label [] [ text "Position of item notes" ]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui radio checkbox" ]
|
||||
[ input
|
||||
[ type_ "radio"
|
||||
, checked (model.itemDetailNotesPosition == Top)
|
||||
, onCheck (\_ -> SetNotesPosition Top)
|
||||
]
|
||||
[]
|
||||
, label [] [ text "Top" ]
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui radio checkbox" ]
|
||||
[ input
|
||||
[ type_ "radio"
|
||||
, checked (model.itemDetailNotesPosition == Bottom)
|
||||
, onCheck (\_ -> SetNotesPosition Bottom)
|
||||
]
|
||||
[]
|
||||
, label [] [ text "Bottom" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "ui dividing header" ]
|
||||
[ text "Tag Category Colors"
|
||||
]
|
||||
, Html.map TagColorMsg
|
||||
(Comp.ColorTagger.view
|
||||
model.tagColors
|
||||
tagColorViewOpts
|
||||
model.tagColorModel
|
||||
)
|
||||
, div [ class "ui dividing header" ]
|
||||
[ text "Fields"
|
||||
]
|
||||
, span [ class "small-info" ]
|
||||
[ text "Choose which fields to display in search and edit menus."
|
||||
]
|
||||
, Html.map FieldListMsg (Comp.FieldListSelect.view model.formFields)
|
||||
]
|
||||
|
||||
|
||||
|
||||
--- View2
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user