Skip to content

Commit

Permalink
Merge pull request #1159 from ds-wizard/release/4.7.0
Browse files Browse the repository at this point in the history
Release 4.7.0
  • Loading branch information
janslifka committed Jun 4, 2024
2 parents d684ddc + 8085823 commit 09406bf
Show file tree
Hide file tree
Showing 13 changed files with 615 additions and 543 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ update cfg appState msg model =
updatePagination Nothing model.filters pqs

UpdatePaginationQueryFilters mbFilterId pqf ->
updatePagination mbFilterId pqf model.paginationQueryString
updatePagination mbFilterId pqf (PaginationQueryString.resetPage model.paginationQueryString)

QueryInput string ->
( { model | qInput = string }
Expand Down
67 changes: 48 additions & 19 deletions engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ type Msg
| OpenAction QuestionnaireAction
| CollapseItem String
| ExpandItem String
| CollapseItems (List String)
| ExpandItems (List String)
| GotLocalStorageData E.Value
| CopyLinkToQuestion (List String)
| ClearRecentlyCopied
Expand All @@ -495,6 +497,12 @@ update msg wrapMsg mbSetFullscreenMsg appState ctx model =

wrap newModel =
( appState.seed, newModel, Cmd.none )

updateCollapsedItems newCollapsedItems =
withSeed
( { model | collapsedItems = newCollapsedItems }
, localStorageCollapsedItemsCmd model.uuid newCollapsedItems
)
in
case msg of
SetActivePage activePage ->
Expand Down Expand Up @@ -916,24 +924,20 @@ update msg wrapMsg mbSetFullscreenMsg appState ctx model =
)

CollapseItem path ->
let
newCollapsedItems =
Set.insert path model.collapsedItems
in
withSeed
( { model | collapsedItems = newCollapsedItems }
, localStorageCollapsedItemsCmd model.uuid newCollapsedItems
)
updateCollapsedItems <|
Set.insert path model.collapsedItems

ExpandItem path ->
let
newCollapsedItems =
Set.remove path model.collapsedItems
in
withSeed
( { model | collapsedItems = newCollapsedItems }
, localStorageCollapsedItemsCmd model.uuid newCollapsedItems
)
updateCollapsedItems <|
Set.remove path model.collapsedItems

CollapseItems paths ->
updateCollapsedItems <|
List.foldl Set.insert model.collapsedItems paths

ExpandItems paths ->
updateCollapsedItems <|
List.foldl Set.remove model.collapsedItems paths

GotLocalStorageData value ->
case decodeValue (D.field "key" D.string) value of
Expand Down Expand Up @@ -1816,12 +1820,13 @@ viewQuestionnaireRightPanelCommentsOverview appState model =
viewChapterComments group =
div []
[ strong [] [ text group.chapter.title ]
, ul [] (List.map viewQuestionComments group.todos)
, ul [ class "fa-ul" ] (List.map viewQuestionComments group.todos)
]

viewQuestionComments comment =
li []
[ a [ onClick (OpenComments comment.path) ]
[ span [ class "fa-li" ] [ fa "far fa-comment" ]
, a [ onClick (OpenComments comment.path) ]
[ span [ class "question" ] [ text <| Question.getTitle comment.question ]
, Badge.light [ class "rounded-pill" ] [ text (String.fromInt comment.comments) ]
]
Expand Down Expand Up @@ -2665,6 +2670,29 @@ viewQuestionMultiChoice appState cfg model path question =
viewQuestionList : AppState -> Config msg -> Context -> Model -> List String -> List String -> Question -> Html Msg
viewQuestionList appState cfg ctx model path humanIdentifiers question =
let
expandAndCollapseButtons =
if List.length itemUuids > 1 then
let
allItemsPaths =
List.map (\uuid -> pathToString (path ++ [ uuid ])) itemUuids
in
div [ class "mb-3" ]
[ a [ onClick (ExpandItems allItemsPaths) ]
[ faSet "questionnaire.item.expandAll" appState
, span [ class "ms-1" ] [ text (gettext "Expand all" appState.locale) ]
]
, a
[ onClick (CollapseItems allItemsPaths)
, class "ms-3"
]
[ faSet "questionnaire.item.collapseAll" appState
, span [ class "ms-1" ] [ text (gettext "Collapse all" appState.locale) ]
]
]

else
emptyNode

viewItem =
viewQuestionListItem appState cfg ctx model question path humanIdentifiers (List.length itemUuids)

Expand All @@ -2680,7 +2708,8 @@ viewQuestionList appState cfg ctx model path humanIdentifiers question =
emptyNode
in
div []
[ div [] (List.indexedMap viewItem itemUuids)
[ expandAndCollapseButtons
, div [] (List.indexedMap viewItem itemUuids)
, viewQuestionListAdd appState cfg itemUuids path
, noAnswersInfo
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ iconSet =
, ( "questionnaire.history.createDocument", "far fa-file" )
, ( "questionnaire.history.revert", "fas fa-history" )
, ( "questionnaire.item.collapse", "fa-fw fas fa-chevron-down" )
, ( "questionnaire.item.collapseAll", "fas fa-angle-double-up" )
, ( "questionnaire.item.expand", "fa-fw fas fa-chevron-right" )
, ( "questionnaire.item.expandAll", "fas fa-angle-double-down" )
, ( "questionnaire.item.moveUp", "fa-fw fas fa-arrow-up" )
, ( "questionnaire.item.moveDown", "fa-fw fas fa-arrow-down" )
, ( "questionnaire.resourcePageReferences", "fas fa-book" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ view appState =
{ title = gettext "Import Document Template" appState.locale
, text =
String.format
(gettext "Document templates transform answers from a questionnaire into a document. This document can be anything, from PDF to machine-actionable JSON. You can import existing document templates from [%s](%s/document-templates) or [develop new ones](%s)." appState.locale)
(gettext "Document templates transform answers from a questionnaire into a document. This document can be anything, from PDF to machine-actionable JSON. You can import existing document templates from [%s](%s) or [develop new ones](%s)." appState.locale)
[ LookAndFeelConfig.defaultRegistryName
, LookAndFeelConfig.defaultRegistryUrl
, LookAndFeelConfig.defaultRegistryUrl ++ "/document-templates"
, GuideLinks.documentTemplates appState.guideLinks
]
, action =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ view appState =
, text =
String.format
(gettext "Knowledge models are published in [%s](%s). You can easily import them into your instance to make them available for researchers. You can also import other knowledge models exported from different instances." appState.locale)
[ LookAndFeelConfig.defaultRegistryName, LookAndFeelConfig.defaultRegistryUrl ]
[ LookAndFeelConfig.defaultRegistryName, LookAndFeelConfig.defaultRegistryUrl ++ "/knowledge-models" ]
, action =
{ route = Routes.knowledgeModelsImport Nothing
, label = gettext "Import" appState.locale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ viewRegistryText appState =
p []
(String.formatHtml
(gettext "You can find Knowledge Models in %s." appState.locale)
[ a [ href url, target "_blank" ]
[ a [ href (url ++ "/knowledge-models"), target "_blank" ]
[ text LookAndFeelConfig.defaultRegistryName ]
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ actions appState cfg locale =
}

deleteActionVisible =
Feature.localeDelete appState locale && not locale.defaultLocale
Feature.localeDelete appState locale

groups =
[ [ ( viewAction, viewActionVisible )
Expand Down
1 change: 0 additions & 1 deletion engine-wizard/elm/Wizard/Projects/Index/Msgs.elm
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ type Msg
| PackagesFilterSearch String
| PackagesFilterSearchComplete (Result ApiError (Pagination PackageSuggestion))
| DebouncerMsg (Debouncer.Msg Msg)
| NoOp
7 changes: 2 additions & 5 deletions engine-wizard/elm/Wizard/Projects/Index/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ update wrapMsg msg appState model =

ListingFilterAddSelectedUser user listingMsg ->
let
updatePackages users =
updateUsers users =
{ users | items = List.uniqueBy .uuid (user :: users.items) }

newModel =
{ model | userFilterSelectedUsers = ActionResult.map updatePackages model.userFilterSelectedUsers }
{ model | userFilterSelectedUsers = ActionResult.map updateUsers model.userFilterSelectedUsers }
in
handleListingMsg wrapMsg appState listingMsg newModel

Expand Down Expand Up @@ -275,9 +275,6 @@ update wrapMsg msg appState model =
in
Debouncer.update update_ updateConfig debounceMsg model

NoOp ->
( model, Cmd.none )


handleDeleteMigration : (Msg -> Wizard.Msgs.Msg) -> AppState -> Model -> Uuid -> ( Model, Cmd Wizard.Msgs.Msg )
handleDeleteMigration wrapMsg appState model uuid =
Expand Down
21 changes: 7 additions & 14 deletions engine-wizard/elm/Wizard/Projects/Index/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ActionResult
import Bootstrap.Dropdown as Dropdown
import Gettext exposing (gettext)
import Html exposing (Html, a, div, input, span, text)
import Html.Attributes exposing (class, classList, href, placeholder, title, type_, value)
import Html.Attributes exposing (class, classList, placeholder, title, type_, value)
import Html.Events exposing (onClick, onInput)
import Json.Decode as D
import List.Extra as List
Expand All @@ -15,7 +15,6 @@ import Shared.Data.PackageSuggestion as PackageSuggestion
import Shared.Data.Pagination as Pagination
import Shared.Data.PaginationQueryFilters as PaginationQueryFilter
import Shared.Data.PaginationQueryFilters.FilterOperator as FilterOperator
import Shared.Data.PaginationQueryString as PaginationQueryString
import Shared.Data.Questionnaire exposing (Questionnaire)
import Shared.Data.Questionnaire.QuestionnaireState exposing (QuestionnaireState(..))
import Shared.Data.User as User
Expand Down Expand Up @@ -46,7 +45,6 @@ import Wizard.Projects.Index.Models exposing (Model)
import Wizard.Projects.Index.Msgs exposing (Msg(..))
import Wizard.Projects.Routes exposing (Route(..), indexRouteIsTemplateFilterId, indexRoutePackagesFilterId, indexRouteProjectTagsFilterId, indexRouteUsersFilterId)
import Wizard.Routes as Routes
import Wizard.Routing as Routing


view : AppState -> Model -> Html Msg
Expand Down Expand Up @@ -387,11 +385,8 @@ listingUsersFilter appState model =
else
filterMsg (PaginationQueryFilter.insertValue indexRouteUsersFilterId (String.join "," (List.unique userUuids)) model.questionnaires.filters)

linkWithOp op =
Routing.toUrl appState <|
Routes.projectsIndexWithFilters
(PaginationQueryFilter.insertOp indexRouteUsersFilterId op model.questionnaires.filters)
(PaginationQueryString.resetPage model.questionnaires.paginationQueryString)
filtersWithOp op =
PaginationQueryFilter.insertOp indexRouteUsersFilterId op model.questionnaires.filters

removeUserMsg user =
List.filter ((/=) (Uuid.toString user.uuid)) selectedUserUuids
Expand Down Expand Up @@ -461,17 +456,15 @@ listingUsersFilter appState model =
, Dropdown.customItem <|
div [ class "dropdown-item-operator" ]
[ a
[ href (linkWithOp FilterOperator.OR)
, classList [ ( "active", filterOperator == FilterOperator.OR ) ]
[ classList [ ( "active", filterOperator == FilterOperator.OR ) ]
, dataCy "filter_users_operator_OR"
, alwaysStopPropagationOn "click" (D.succeed NoOp)
, alwaysStopPropagationOn "click" (D.succeed (ListingMsg (filterMsg (filtersWithOp FilterOperator.OR))))
]
[ text (gettext "OR" appState.locale) ]
, a
[ href (linkWithOp FilterOperator.AND)
, classList [ ( "active", filterOperator == FilterOperator.AND ) ]
[ classList [ ( "active", filterOperator == FilterOperator.AND ) ]
, dataCy "filter_users_operator_AND"
, alwaysStopPropagationOn "click" (D.succeed NoOp)
, alwaysStopPropagationOn "click" (D.succeed (ListingMsg (filterMsg (filtersWithOp FilterOperator.AND))))
]
[ text (gettext "AND" appState.locale) ]
]
Expand Down
10 changes: 8 additions & 2 deletions engine-wizard/scss/modules/Common/Components/_Questionnaire.scss
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,12 @@ $toolbar-height: 40px;
}

.comments-overview {
ul {
padding-left: 1.5rem;
.fa-ul {
margin-left: 1.5rem;

li {
margin-top: 0.5rem;

a {
display: flex;
align-items: baseline;
Expand All @@ -379,6 +381,10 @@ $toolbar-height: 40px;
}
}
}

.fa-li {
color: $gray-600;
}
}
}

Expand Down
Loading

0 comments on commit 09406bf

Please sign in to comment.