Skip to content

Commit

Permalink
Merge branch 'feature/index' of https://github.com/rl-institut/bd_app
Browse files Browse the repository at this point in the history
…into feature/index
  • Loading branch information
josihoppe committed Dec 2, 2024
2 parents 1d729d8 + 5308a9f commit d55e384
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions building_dialouge_webapp/heat/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,11 @@ def dispatch(self, request, *args, **kwargs) -> HttpResponse:
# Fill template with state partials by adding them with their target_id
return self.render_to_response(context)

def finished(self):
def finished(self, request):
"""Check if the given flow is finished."""
self.request = request
state_responses = self.start.set()
return any(isinstance(response, EndState) for response in state_responses.values())
return any(isinstance(response, RedirectStateResponse) for response in state_responses.values())


class BuildingTypeFlow(SidebarNavigationMixin, Flow):
Expand Down
4 changes: 2 additions & 2 deletions building_dialouge_webapp/heat/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ def get_context_data(self, **kwargs):

for category in index:
for step in category["steps"]:
flow_object = step["object"]
flow_object = step["object"]()

if step["url"] == current_url:
step["index_state"] = "active"
elif flow_object.finished(self):
elif hasattr(flow_object, "finished") and flow_object.finished(self.request):
step["index_state"] = "visited"
else:
step["index_state"] = ""
Expand Down
4 changes: 2 additions & 2 deletions building_dialouge_webapp/static/css/layouts/_questions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@mixin sidebar-items {
a {
color: $grey-400;
pointer-events: none;
pointer-events: auto;
}

&.visited a {
Expand Down Expand Up @@ -151,4 +151,4 @@ main .step-question {
@media screen and (min-width: $breakpoint-3xl) {
width: 40rem;
}
}
}

0 comments on commit d55e384

Please sign in to comment.