Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlpanel fixes #101

Merged
merged 10 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/102.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix controlpanel view, dont render card element if no rules defined
[1letter]
2 changes: 2 additions & 0 deletions news/103.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix rendering of edit modal dialogs, exclude global tabs
[1letter]
3 changes: 3 additions & 0 deletions news/75.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use WorkflowEditForm in WorkflowEditFormView
use NotifyEditForm in NotifyEditFormView
[1letter]
2 changes: 1 addition & 1 deletion plone/app/contentrules/actions/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ class NotifyEditForm(ActionEditForm):


class NotifyEditFormView(ContentRuleFormWrapper):
form = NotifyAddForm
form = NotifyEditForm
2 changes: 1 addition & 1 deletion plone/app/contentrules/actions/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ class WorkflowEditForm(ActionEditForm):


class WorkflowEditFormView(ContentRuleFormWrapper):
form = WorkflowAddForm
form = WorkflowEditForm
10 changes: 6 additions & 4 deletions plone/app/contentrules/browser/templates/controlpanel.pt
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@
</div>


<div class="card">
<div class="card"
tal:define="
rules rules|view/registeredRules;
"
tal:condition="rules"
>
<fieldset class="card-body"
id="fieldset-rules"
tal:define="
rules rules|view/registeredRules;
"
>

<div class="filters row row-cols-lg-auto g-3 align-items-center"
Expand Down
4 changes: 2 additions & 2 deletions plone/app/contentrules/browser/templates/manage-elements.pt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<div class="col-auto">
<div class="rule-operations">
<a class="pat-plone-modal btn btn-sm btn-primary"
data-pat-plone-modal="modalSizeClass: modal-xl;"
data-pat-plone-modal="modalSizeClass: modal-xl;content:#content-core"
tal:condition="condition/editview"
tal:attributes="
href string:${condition/editview}?_authenticator=${auth_token};
Expand Down Expand Up @@ -234,7 +234,7 @@
<div class="col-auto">
<div class="rule-operations">
<a class="pat-plone-modal btn btn-sm btn-primary"
data-pat-plone-modal="modalSizeClass: modal-xl;"
data-pat-plone-modal="modalSizeClass: modal-xl;content:#content-core"
tal:condition="action/editview"
tal:attributes="
href string:${action/editview}?_authenticator=${auth_token};
Expand Down
7 changes: 7 additions & 0 deletions plone/app/contentrules/tests/test_action_notify.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from plone.app.contentrules.actions.notify import NotifyAction
from plone.app.contentrules.actions.notify import NotifyEditForm
from plone.app.contentrules.actions.notify import NotifyEditFormView
from plone.app.contentrules.rule import Rule
from plone.app.contentrules.tests.base import ContentRulesTestCase
Expand Down Expand Up @@ -52,6 +53,12 @@ def testInvokeEditView(self):
editview = getMultiAdapter((e, self.request), name=element.editview)
self.assertTrue(isinstance(editview, NotifyEditFormView))

def testInvokeEditForm(self):
element = getUtility(IRuleAction, name="plone.actions.Notify")
e = NotifyAction()
editview = getMultiAdapter((e, self.request), name=element.editview)
self.assertTrue(isinstance(editview.form_instance, NotifyEditForm))

def testExecute(self):
e = NotifyAction()
e.message = "Hello world"
Expand Down
7 changes: 7 additions & 0 deletions plone/app/contentrules/tests/test_action_workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from plone.app.contentrules.actions.workflow import WorkflowAction
from plone.app.contentrules.actions.workflow import WorkflowEditForm
from plone.app.contentrules.actions.workflow import WorkflowEditFormView
from plone.app.contentrules.rule import Rule
from plone.app.contentrules.tests.base import ContentRulesTestCase
Expand Down Expand Up @@ -52,6 +53,12 @@ def testInvokeEditView(self):
editview = getMultiAdapter((e, self.folder.REQUEST), name=element.editview)
self.assertTrue(isinstance(editview, WorkflowEditFormView))

def testInvokeEditForm(self):
element = getUtility(IRuleAction, name="plone.actions.Workflow")
e = WorkflowAction()
editview = getMultiAdapter((e, self.folder.REQUEST), name=element.editview)
self.assertTrue(isinstance(editview.form_instance, WorkflowEditForm))

def testExecute(self):
e = WorkflowAction()
e.transition = "publish"
Expand Down