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:
@ -6,7 +6,6 @@ module Comp.ItemDetail.MultiEditMenu exposing
|
||||
, init
|
||||
, loadModel
|
||||
, update
|
||||
, view
|
||||
, view2
|
||||
)
|
||||
|
||||
@ -626,257 +625,12 @@ type alias ViewConfig =
|
||||
|
||||
defaultViewConfig : ViewConfig
|
||||
defaultViewConfig =
|
||||
{ menuClass = "ui vertical segment"
|
||||
{ menuClass = ""
|
||||
, nameState = SaveSuccess
|
||||
, customFieldState = \_ -> SaveSuccess
|
||||
}
|
||||
|
||||
|
||||
view : ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
view =
|
||||
renderEditForm
|
||||
|
||||
|
||||
renderEditForm : ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
renderEditForm cfg settings model =
|
||||
let
|
||||
fieldVisible field =
|
||||
Data.UiSettings.fieldVisible settings field
|
||||
|
||||
optional fields html =
|
||||
if
|
||||
List.map fieldVisible fields
|
||||
|> List.foldl (||) False
|
||||
then
|
||||
html
|
||||
|
||||
else
|
||||
span [ class "invisible hidden" ] []
|
||||
|
||||
tagModeIcon =
|
||||
case model.tagEditMode of
|
||||
AddTags ->
|
||||
i [ class "grey plus link icon" ] []
|
||||
|
||||
RemoveTags ->
|
||||
i [ class "grey eraser link icon" ] []
|
||||
|
||||
ReplaceTags ->
|
||||
i [ class "grey redo alternate link icon" ] []
|
||||
|
||||
tagModeMsg =
|
||||
case model.tagEditMode of
|
||||
AddTags ->
|
||||
"Tags chosen here are *added* to all selected items."
|
||||
|
||||
RemoveTags ->
|
||||
"Tags chosen here are *removed* from all selected items."
|
||||
|
||||
ReplaceTags ->
|
||||
"Tags chosen here *replace* those on selected items."
|
||||
|
||||
customFieldIcon field =
|
||||
case cfg.customFieldState field.id of
|
||||
SaveSuccess ->
|
||||
Nothing
|
||||
|
||||
SaveFailed ->
|
||||
Just "red exclamation triangle icon"
|
||||
|
||||
Saving ->
|
||||
Just "refresh loading icon"
|
||||
|
||||
customFieldSettings =
|
||||
Comp.CustomFieldMultiInput.ViewSettings
|
||||
False
|
||||
"field"
|
||||
customFieldIcon
|
||||
in
|
||||
div [ class cfg.menuClass ]
|
||||
[ div [ class "ui form warning" ]
|
||||
[ div [ class "field" ]
|
||||
[ div
|
||||
[ class "ui fluid buttons"
|
||||
]
|
||||
[ button
|
||||
[ class "ui primary button"
|
||||
, onClick (ConfirmMsg True)
|
||||
]
|
||||
[ text "Confirm"
|
||||
]
|
||||
, div [ class "or" ] []
|
||||
, button
|
||||
[ class "ui secondary button"
|
||||
, onClick (ConfirmMsg False)
|
||||
]
|
||||
[ text "Unconfirm"
|
||||
]
|
||||
]
|
||||
]
|
||||
, optional [ Data.Fields.Tag ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.tagsIcon "grey"
|
||||
, text "Tags"
|
||||
, a
|
||||
[ class "right-float"
|
||||
, href "#"
|
||||
, title "Change tag edit mode"
|
||||
, onClick ToggleTagEditMode
|
||||
]
|
||||
[ tagModeIcon
|
||||
]
|
||||
]
|
||||
, Html.map TagDropdownMsg (Comp.Dropdown.view settings model.tagModel)
|
||||
, Markdown.toHtml [ class "small-info" ] tagModeMsg
|
||||
]
|
||||
, div [ class " field" ]
|
||||
[ label [] [ text "Name" ]
|
||||
, div [ class "ui icon input" ]
|
||||
[ input [ type_ "text", value model.nameModel, onInput SetName ] []
|
||||
, i
|
||||
[ classList
|
||||
[ ( "green check icon", cfg.nameState == SaveSuccess )
|
||||
, ( "red exclamation triangle icon", cfg.nameState == SaveFailed )
|
||||
, ( "sync loading icon", cfg.nameState == Saving )
|
||||
]
|
||||
]
|
||||
[]
|
||||
]
|
||||
]
|
||||
, optional [ Data.Fields.Folder ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.folderIcon "grey"
|
||||
, text "Folder"
|
||||
]
|
||||
, Html.map FolderDropdownMsg (Comp.Dropdown.view settings model.folderModel)
|
||||
, div
|
||||
[ classList
|
||||
[ ( "ui warning message", True )
|
||||
, ( "hidden", isFolderMember model )
|
||||
]
|
||||
]
|
||||
[ Markdown.toHtml [] """
|
||||
You are **not a member** of this folder. This item will be **hidden**
|
||||
from any search now. Use a folder where you are a member of to make this
|
||||
item visible. This message will disappear then.
|
||||
"""
|
||||
]
|
||||
]
|
||||
, optional [ Data.Fields.CustomFields ] <|
|
||||
h4 [ class "ui dividing header" ]
|
||||
[ Icons.customFieldIcon ""
|
||||
, text "Custom Fields"
|
||||
]
|
||||
, optional [ Data.Fields.CustomFields ] <|
|
||||
Html.map CustomFieldMsg
|
||||
(Comp.CustomFieldMultiInput.view customFieldSettings model.customFieldModel)
|
||||
, optional [ Data.Fields.Date, Data.Fields.DueDate ] <|
|
||||
h4 [ class "ui dividing header" ]
|
||||
[ Icons.itemDatesIcon ""
|
||||
, text "Item Dates"
|
||||
]
|
||||
, optional [ Data.Fields.Date ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.dateIcon "grey"
|
||||
, text "Date"
|
||||
]
|
||||
, div [ class "ui left icon action input" ]
|
||||
[ Html.map ItemDatePickerMsg
|
||||
(Comp.DatePicker.viewTime
|
||||
model.itemDate
|
||||
actionInputDatePicker
|
||||
model.itemDatePicker
|
||||
)
|
||||
, a [ class "ui icon button", href "#", onClick RemoveDate ]
|
||||
[ i [ class "trash alternate outline icon" ] []
|
||||
]
|
||||
, Icons.dateIcon ""
|
||||
]
|
||||
]
|
||||
, optional [ Data.Fields.DueDate ] <|
|
||||
div [ class " field" ]
|
||||
[ label []
|
||||
[ Icons.dueDateIcon "grey"
|
||||
, text "Due Date"
|
||||
]
|
||||
, div [ class "ui left icon action input" ]
|
||||
[ Html.map DueDatePickerMsg
|
||||
(Comp.DatePicker.viewTime
|
||||
model.dueDate
|
||||
actionInputDatePicker
|
||||
model.dueDatePicker
|
||||
)
|
||||
, a [ class "ui icon button", href "#", onClick RemoveDueDate ]
|
||||
[ i [ class "trash alternate outline icon" ] [] ]
|
||||
, Icons.dueDateIcon ""
|
||||
]
|
||||
]
|
||||
, optional [ Data.Fields.CorrOrg, Data.Fields.CorrPerson ] <|
|
||||
h4 [ class "ui dividing header" ]
|
||||
[ Icons.correspondentIcon ""
|
||||
, text "Correspondent"
|
||||
]
|
||||
, optional [ Data.Fields.CorrOrg ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.organizationIcon "grey"
|
||||
, text "Organization"
|
||||
]
|
||||
, Html.map OrgDropdownMsg (Comp.Dropdown.view settings model.corrOrgModel)
|
||||
]
|
||||
, optional [ Data.Fields.CorrPerson ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.personIcon "grey"
|
||||
, text "Person"
|
||||
]
|
||||
, Html.map CorrPersonMsg (Comp.Dropdown.view settings model.corrPersonModel)
|
||||
]
|
||||
, optional [ Data.Fields.ConcPerson, Data.Fields.ConcEquip ] <|
|
||||
h4 [ class "ui dividing header" ]
|
||||
[ Icons.concernedIcon
|
||||
, text "Concerning"
|
||||
]
|
||||
, optional [ Data.Fields.ConcPerson ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.personIcon "grey"
|
||||
, text "Person"
|
||||
]
|
||||
, Html.map ConcPersonMsg (Comp.Dropdown.view settings model.concPersonModel)
|
||||
]
|
||||
, optional [ Data.Fields.ConcEquip ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.equipmentIcon "grey"
|
||||
, text "Equipment"
|
||||
]
|
||||
, Html.map ConcEquipMsg (Comp.Dropdown.view settings model.concEquipModel)
|
||||
]
|
||||
, optional [ Data.Fields.Direction ] <|
|
||||
div [ class "field" ]
|
||||
[ label []
|
||||
[ Icons.directionIcon "grey"
|
||||
, text "Direction"
|
||||
]
|
||||
, Html.map DirDropdownMsg (Comp.Dropdown.view settings model.directionModel)
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
actionInputDatePicker : DatePicker.Settings
|
||||
actionInputDatePicker =
|
||||
let
|
||||
ds =
|
||||
Comp.DatePicker.defaultSettings
|
||||
in
|
||||
{ ds | containerClassList = [ ( "ui action input", True ) ] }
|
||||
|
||||
|
||||
|
||||
--- View2
|
||||
|
||||
|
Reference in New Issue
Block a user