Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
added params to customActions
Browse files Browse the repository at this point in the history
  • Loading branch information
xnopasaranx committed Jun 3, 2022
1 parent 2a5fd64 commit 2dd64aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This file documents any relevant changes done to ViUR Vi since version 2.

## [3.0.22] - 2022-06-03
- Feat: added params to customAction view call

## [3.0.21] - 2022-05-25
- Feat: added grouped skels
- Fix: viewactions now not merged by default, customActions now can be defined in a view
Expand Down
7 changes: 6 additions & 1 deletion vi/serversideaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@ def onClick(self, sender=None):


def apply(self,sender=None):
selection = self.parent().parent().getCurrentSelection()
if self.actionData["action"] == "view":
url_parts = self.actionData['url'].split("/")
targetInfo = conf["modules"][url_parts[0]]

if "params" in self.actionData:
if selection:
targetInfo.update({k: v.replace("{{key}}", selection[0]["key"]) for k, v in self.actionData["params"].items()})
else:
targetInfo.update(self.actionData["params"])
conf["mainWindow"].openView(
translate("{{module}} - {{name}}", module=targetInfo["name"], name=self.actionData['name']),
targetInfo.get("icon") or "icon-edit",
Expand All @@ -103,7 +109,6 @@ def apply(self,sender=None):
)

else:
selection = self.parent().parent().getCurrentSelection()
if self.multiSelection and len(selection) > 0 or len(selection) == 1:
# if (len(selection) == 1 and not self.actionData["allowMultiSelection"]) or len(selection) > 0:
wasIdle = not self.pendingFetches
Expand Down

0 comments on commit 2dd64aa

Please sign in to comment.