Skip to content

Commit

Permalink
The dexterity editor does not allow editing portal types derived by a…
Browse files Browse the repository at this point in the history
… schema because that has no persistent effect

Fixes plone/Products.CMFPlone#3272
  • Loading branch information
ale-rt committed May 14, 2021
1 parent 4b4c68b commit a1b8646
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions news/83.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The dexterity editor does not allow editing portal types derived by a schema because that has no persistent effect
4 changes: 4 additions & 0 deletions plone/schemaeditor/browser/schema/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SchemaListing(AutoExtensibleForm, form.Form):
showEmptyGroups = True
template = ViewPageTemplateFile('schema_listing.pt')
ignoreRequiredOnExtract = True
read_only = False

@property
def schema(self):
Expand Down Expand Up @@ -136,11 +137,14 @@ def handleSaveDefaults(self, action):

class ReadOnlySchemaListing(SchemaListing):
buttons = button.Buttons()
read_only = True

def edit_url(self, field):
return
delete_url = edit_url

def protected_field(self, field):
return True

class SchemaListingPage(FormWrapper):

Expand Down
30 changes: 18 additions & 12 deletions plone/schemaeditor/browser/schema/schema_listing.pt
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<div xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
tal:omit-tag="" i18n:domain="plone">
<a id="add-field" class="pat-plone-modal"
href="${context/absolute_url}/@@add-field">
<button style="float: right; display: block;"
i18n:translate="add_new_field_hellip">Add new field&hellip;</button>
</a>

<a id="add-fieldset" class="pat-plone-modal" tal:condition="context/enableFieldsets"
href="${context/absolute_url}/@@add-fieldset">
<button style="float: right; display: block;"
i18n:translate="add_fieldset_hellip">Add new fieldset&hellip;</button>
</a>
tal:define="read_only python:view.read_only"
tal:omit-tag=""
i18n:domain="plone"
>

<tal:editable condition="not: read_only">
<a id="add-field" class="pat-plone-modal"
href="${context/absolute_url}/@@add-field">
<button style="float: right; display: block;"
i18n:translate="add_new_field_hellip">Add new field&hellip;</button>
</a>

<a id="add-fieldset" class="pat-plone-modal" tal:condition="context/enableFieldsets"
href="${context/absolute_url}/@@add-fieldset">
<button style="float: right; display: block;"
i18n:translate="add_fieldset_hellip">Add new fieldset&hellip;</button>
</a>
</tal:editable>

<metal:form metal:use-macro="context/@@ploneform-macros/form">
<metal:top-slot metal:fill-slot="formtop">
Expand Down

0 comments on commit a1b8646

Please sign in to comment.