diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm index 8f2e2570..6d0341c9 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm @@ -1603,6 +1603,9 @@ resetField flags item tagger field = Data.Fields.CustomFields -> Cmd.none + Data.Fields.SourceName -> + Cmd.none + resetHiddenFields : UiSettings diff --git a/modules/webapp/src/main/elm/Comp/SearchMenu.elm b/modules/webapp/src/main/elm/Comp/SearchMenu.elm index 2841cf5e..9f677053 100644 --- a/modules/webapp/src/main/elm/Comp/SearchMenu.elm +++ b/modules/webapp/src/main/elm/Comp/SearchMenu.elm @@ -72,6 +72,7 @@ type alias Model = , showNameHelp : Bool , customFieldModel : Comp.CustomFieldMultiInput.Model , customValues : CustomFieldValueCollect + , sourceModel : Maybe String } @@ -135,6 +136,7 @@ init = , showNameHelp = False , customFieldModel = Comp.CustomFieldMultiInput.initWith [] , customValues = Data.CustomFieldChange.emptyCollect + , sourceModel = Nothing } @@ -196,6 +198,7 @@ getItemSearch model = , tagCategoriesInclude = model.tagSelection.includeCats |> List.map .name , tagCategoriesExclude = model.tagSelection.excludeCats |> List.map .name , customValues = Data.CustomFieldChange.toFieldValues model.customValues + , source = model.sourceModel } @@ -234,6 +237,7 @@ resetModel model = Comp.CustomFieldMultiInput.reset model.customFieldModel , customValues = Data.CustomFieldChange.emptyCollect + , sourceModel = Nothing } @@ -273,6 +277,7 @@ type Msg | SetFolder IdName | SetTag String | CustomFieldMsg Comp.CustomFieldMultiInput.Msg + | SetSource String type alias NextState = @@ -738,6 +743,17 @@ updateDrop ddm flags settings msg model = , dragDrop = DD.DragDropData ddm Nothing } + SetSource str -> + let + next = + Util.Maybe.fromString str + in + { model = { model | sourceModel = next } + , cmd = Cmd.none + , stateChange = False + , dragDrop = DD.DragDropData ddm Nothing + } + -- View @@ -992,6 +1008,24 @@ viewDrop ddd flags settings model = ] ] ] + , div + [ classList + [ ( segmentClass, not (fieldHidden Data.Fields.SourceName) ) + , ( "invisible hidden", fieldHidden Data.Fields.SourceName ) + ] + ] + [ formHeader (Icons.sourceIcon "") "Source" + , div [ class "field" ] + [ input + [ type_ "text" + , onInput SetSource + , Util.Html.onKeyUpCode KeyUpMsg + , model.sourceModel |> Maybe.withDefault "" |> value + , placeholder "Search in item sourceā€¦" + ] + [] + ] + ] , div [ classList [ ( segmentClass, True ) diff --git a/modules/webapp/src/main/elm/Data/Fields.elm b/modules/webapp/src/main/elm/Data/Fields.elm index e7b71aa8..ef977d38 100644 --- a/modules/webapp/src/main/elm/Data/Fields.elm +++ b/modules/webapp/src/main/elm/Data/Fields.elm @@ -21,6 +21,7 @@ type Field | Direction | PreviewImage | CustomFields + | SourceName all : List Field @@ -37,6 +38,7 @@ all = , Direction , PreviewImage , CustomFields + , SourceName ] @@ -81,6 +83,9 @@ fromString str = "customfields" -> Just CustomFields + "sourcename" -> + Just SourceName + _ -> Nothing @@ -121,6 +126,9 @@ toString field = CustomFields -> "customfields" + SourceName -> + "sourcename" + label : Field -> String label field = @@ -158,6 +166,9 @@ label field = CustomFields -> "Custom Fields" + SourceName -> + "Item Source" + fromList : List String -> List Field fromList strings = diff --git a/modules/webapp/src/main/elm/Data/Icons.elm b/modules/webapp/src/main/elm/Data/Icons.elm index 243a49af..7566d0b4 100644 --- a/modules/webapp/src/main/elm/Data/Icons.elm +++ b/modules/webapp/src/main/elm/Data/Icons.elm @@ -29,6 +29,8 @@ module Data.Icons exposing , personIcon , search , searchIcon + , source + , sourceIcon , tag , tagIcon , tags @@ -40,6 +42,16 @@ import Html exposing (Html, i) import Html.Attributes exposing (class) +source : String +source = + "upload icon" + + +sourceIcon : String -> Html msg +sourceIcon classes = + i [ class (source ++ " " ++ classes) ] [] + + customFieldType : CustomFieldType -> String customFieldType ftype = case ftype of diff --git a/modules/webapp/src/main/elm/Page/CollectiveSettings/View.elm b/modules/webapp/src/main/elm/Page/CollectiveSettings/View.elm index e0aefd5a..2adca4c2 100644 --- a/modules/webapp/src/main/elm/Page/CollectiveSettings/View.elm +++ b/modules/webapp/src/main/elm/Page/CollectiveSettings/View.elm @@ -5,6 +5,7 @@ import Comp.CollectiveSettingsForm import Comp.SourceManage import Comp.UserManage import Data.Flags exposing (Flags) +import Data.Icons as Icons import Data.UiSettings exposing (UiSettings) import Html exposing (..) import Html.Attributes exposing (..) @@ -35,7 +36,7 @@ view flags settings model = [ classActive (model.currentTab == Just SourceTab) "link icon item" , onClick (SetTab SourceTab) ] - [ i [ class "upload icon" ] [] + [ Icons.sourceIcon "" , text "Sources" ] , div @@ -183,7 +184,7 @@ makeTagStats nc = viewSources : Flags -> UiSettings -> Model -> List (Html Msg) viewSources flags settings model = [ h2 [ class "ui header" ] - [ i [ class "ui upload icon" ] [] + [ Icons.sourceIcon "" , div [ class "content" ] [ text "Sources" ]