mirror of
				https://github.com/TheAnachronism/docspell.git
				synced 2025-10-30 21:40:12 +00:00 
			
		
		
		
	Fix selecting items in multi-edit mode
For some to me unknown reason, changing the dom slightly (removing hidden elements), resulted in a different event dispatching. The cards while being attached to an event would reload the page as if the event is propagated. This happned by commit #8d7b3c7d in Home/View.elm. Adding the hidden nodes back into the dom, "fixed" it. This change now gives a better fix in assuring that every anchor has either a sensible `href` or an event and a `href #`.
This commit is contained in:
		| @@ -148,10 +148,13 @@ view cfg settings model item = | ||||
|         cardAction = | ||||
|             case cfg.selection of | ||||
|                 Data.ItemSelection.Inactive -> | ||||
|                     Page.href (ItemDetailPage item.id) | ||||
|                     [ Page.href (ItemDetailPage item.id) | ||||
|                     ] | ||||
|  | ||||
|                 Data.ItemSelection.Active ids -> | ||||
|                     onClick (ToggleSelectItem ids item.id) | ||||
|                     [ onClick (ToggleSelectItem ids item.id) | ||||
|                     , href "#" | ||||
|                     ] | ||||
|  | ||||
|         selectedDimmer = | ||||
|             div | ||||
| @@ -162,8 +165,7 @@ view cfg settings model item = | ||||
|                 ] | ||||
|                 [ div [ class "content" ] | ||||
|                     [ a | ||||
|                         [ cardAction | ||||
|                         ] | ||||
|                         cardAction | ||||
|                         [ i [ class "huge icons purple" ] | ||||
|                             [ i [ class "big circle outline icon" ] [] | ||||
|                             , i [ class "check icon" ] [] | ||||
| @@ -311,7 +313,7 @@ notesContent settings item = | ||||
|         ] | ||||
|  | ||||
|  | ||||
| mainContent : Attribute Msg -> String -> Bool -> UiSettings -> ViewConfig -> ItemLight -> Html Msg | ||||
| mainContent : List (Attribute Msg) -> String -> Bool -> UiSettings -> ViewConfig -> ItemLight -> Html Msg | ||||
| mainContent cardAction cardColor isConfirmed settings _ item = | ||||
|     let | ||||
|         dirIcon = | ||||
| @@ -327,10 +329,7 @@ mainContent cardAction cardColor isConfirmed settings _ item = | ||||
|             settings.cardSubtitleTemplate.template | ||||
|     in | ||||
|     a | ||||
|         [ class "content" | ||||
|         , href "#" | ||||
|         , cardAction | ||||
|         ] | ||||
|         (class "content" :: cardAction) | ||||
|         [ if fieldHidden Data.Fields.Direction then | ||||
|             div [ class "header" ] | ||||
|                 [ IT.render titlePattern item |> text | ||||
| @@ -419,7 +418,7 @@ mainTagsAndFields settings item = | ||||
|         (renderFields ++ renderTags) | ||||
|  | ||||
|  | ||||
| previewImage : UiSettings -> Attribute Msg -> Model -> ItemLight -> Html Msg | ||||
| previewImage : UiSettings -> List (Attribute Msg) -> Model -> ItemLight -> Html Msg | ||||
| previewImage settings cardAction model item = | ||||
|     let | ||||
|         mainAttach = | ||||
| @@ -431,10 +430,11 @@ previewImage settings cardAction model item = | ||||
|                 |> Maybe.withDefault (Api.itemBasePreviewURL item.id) | ||||
|     in | ||||
|     a | ||||
|         [ class "image ds-card-image" | ||||
|         , Data.UiSettings.cardPreviewSize settings | ||||
|         , cardAction | ||||
|         ] | ||||
|         ([ class "image ds-card-image" | ||||
|          , Data.UiSettings.cardPreviewSize settings | ||||
|          ] | ||||
|             ++ cardAction | ||||
|         ) | ||||
|         [ img | ||||
|             [ class "preview-image" | ||||
|             , src previewUrl | ||||
|   | ||||
		Reference in New Issue
	
	Block a user