Skip to content

Commit

Permalink
Revert "add a 'protected' attribute to field factory"
Browse files Browse the repository at this point in the history
This reverts commit 127af2e.

Conflicts:
	CHANGES.rst
  • Loading branch information
tisto committed Jun 2, 2015
1 parent 67b8f70 commit 170766f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 62 deletions.
6 changes: 0 additions & 6 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ Changelog
Message values
[datakurre]

- Add a "protected" method to IFieldFactory that may be used to determine
if a particular field must be non editable and not movable using the editor
(just like a behavior field).
Override it for custom behavior in a subclass.
[ebrehault]


2.0.4 (2015-05-13)
------------------
Expand Down
6 changes: 0 additions & 6 deletions plone/schemaeditor/browser/schema/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ def field_type(self, field):
else:
return field.__class__.__name__

def protected_field(self, field):
field_identifier = u'%s.%s' % (
field.__module__, field.__class__.__name__)
field_factory = queryUtility(IFieldFactory, name=field_identifier)
return field_factory.protected(field)

def edit_url(self, field):
field_factory = self._field_factory(field)
if field_factory is not None and field_factory.editable(field):
Expand Down
81 changes: 38 additions & 43 deletions plone/schemaeditor/browser/schema/schema_listing.pt
Original file line number Diff line number Diff line change
Expand Up @@ -92,53 +92,48 @@
</tal:block>

<tal:widgets repeat="widget group/widgets/values">
<tal:block
tal:define="
disabled widget/disabled|nothing;
protected python:view.protected_field(widget.field);">

<div tal:condition="python:disabled or protected" class="fieldPreview fieldFromBehavior">
<div class="fieldLabel">
<tal:block tal:condition="disabled" i18n:translate="">From the
<tal:block i18n:name="behavior_name" tal:replace="python:widget.__name__.split('.')[0]"/> behavior:</tal:block>
<strong tal:content="widget/field/__name__" /> &ndash;
<tal:block tal:content="python:view.field_type(widget.field)"/>
</div>
<tal:field tal:replace="structure widget/@@ploneform-render-widget" />
<div class="disabled-field-overlay"></div>

<div tal:condition="widget/disabled|nothing" class="fieldPreview fieldFromBehavior">
<div class="fieldLabel">
<tal:block i18n:translate="">From the
<tal:block i18n:name="behavior_name" tal:replace="python:widget.__name__.split('.')[0]"/> behavior:</tal:block>
<strong tal:content="widget/field/__name__" /> &ndash;
<tal:block tal:content="python:view.field_type(widget.field)"/>
</div>
<tal:field tal:replace="structure widget/@@ploneform-render-widget" />
<div class="disabled-field-overlay"></div>
</div>

<div tal:condition="not:widget/disabled|nothing"
class="fieldPreview orderable" tal:attributes="data-field_id widget/field/__name__">

<div class="fieldLabel">
<strong tal:content="widget/field/__name__" /> &ndash;
<tal:block tal:content="python:view.field_type(widget.field)"/>
</div>

<div tal:condition="python:not(disabled or protected)"
class="fieldPreview orderable" tal:attributes="data-field_id widget/field/__name__">

<div class="fieldLabel">
<strong tal:content="widget/field/__name__" /> &ndash;
<tal:block tal:content="python:view.field_type(widget.field)"/>
</div>

<div class="fieldControls"
i18n:domain="plone.schemaeditor">
<a class="fieldSettings pat-plone-modal"
tal:define="edit_url python:view.edit_url(widget.field)"
tal:condition="edit_url"
i18n:translate=""
tal:attributes="href edit_url">Settings&hellip;</a>
<a class="schemaeditor-delete-field"
i18n:attributes="title; data-confirm_msg"
title="Delete field"
data-confirm_msg="Are you sure you want to delete this field?"
style="margin-left: 1em; font-size: 150%; border: none"
tal:define="delete_url python:view.delete_url(widget.field)"
tal:condition="delete_url"
tal:attributes="href delete_url">&times;</a>
</div>

<div style="width: 80%">
<tal:field tal:replace="structure widget/@@ploneform-render-widget" />
</div>
<div class="fieldControls"
i18n:domain="plone.schemaeditor">
<a class="fieldSettings pat-plone-modal"
tal:define="edit_url python:view.edit_url(widget.field)"
tal:condition="edit_url"
i18n:translate=""
tal:attributes="href edit_url">Settings&hellip;</a>
<a class="schemaeditor-delete-field"
i18n:attributes="title; data-confirm_msg"
title="Delete field"
data-confirm_msg="Are you sure you want to delete this field?"
style="margin-left: 1em; font-size: 150%; border: none"
tal:define="delete_url python:view.delete_url(widget.field)"
tal:condition="delete_url"
tal:attributes="href delete_url">&times;</a>
</div>

<div style="width: 80%">
<tal:field tal:replace="structure widget/@@ploneform-render-widget" />
</div>
</tal:block>

</div>

</tal:widgets>

Expand Down
4 changes: 0 additions & 4 deletions plone/schemaeditor/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ def editable(self, field):
""" test whether a given instance of a field is editable """
return True

def protected(self, field):
""" test whether a given instance of a field is protected """
return False


def FieldsVocabularyFactory(context):
request = getRequest()
Expand Down
3 changes: 0 additions & 3 deletions plone/schemaeditor/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ def available(self):
def editable(self, field):
""" test whether a given instance of a field is editable """

def protected(self, field):
""" test whether a given instance of a field is protected """


class IEditableSchema(Interface):

Expand Down

0 comments on commit 170766f

Please sign in to comment.