Skip to content

Commit

Permalink
Show elements that the reader has no access to as "Undisclosed"
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Sep 28, 2015
1 parent 8346d31 commit edf74dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 49 deletions.
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ Changelog
2.5.5 (unreleased)
------------------

- Nothing changed yet.
- Show elements that the reader has no access to as "Undisclosed" instead of
throwing Unauthorized.
[pbauer]


2.5.4 (2015-09-27)
------------------

- Follow README/CHANGES best practice.
[tisto]

- saner check for isNotSelf(), which was throwing KeyError
[alecpm, tkimnguyen]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
image_method field/widget/image_method|string:;
show_path field/widget/show_path|nothing;
hide_inaccessible field/widget/hide_inaccessible | nothing;
helper nocall:here/refbrowserhelper;
portal context/@@plone_portal_state/portal;
multiValued field/multiValued;
helper nocall:here/refbrowserhelper;
portal context/@@plone_portal_state/portal;
portal_path helper/getPortalPath;
value python: field.getEditAccessor(context)();
refs python:helper.getFieldRelations(field, value);"
value python: field.getEditAccessor(context)();
refs python:helper.getFieldRelations(field, value);"
condition="refs">


<tal:notMultivalued condition="not:field/multiValued">
<tal:block condition="python: (can_view or not hide_inaccessible)"
define="obj python:refs[0];
obj_path python: '/'.join(obj.getPhysicalPath());
obj_interface_info nocall:obj/@@plone_interface_info;
can_view python: helper.canView(obj)">
<ul tal:omit-tag="not:multiValued">
<tal:items tal:repeat="obj refs">
<tal:check tal:define="can_view python:helper.canView(obj)">
<li tal:condition="can_view" tal:omit-tag="not:multiValued">
<tal:item define="obj_path python: '/'.join(obj.getPhysicalPath());
obj_interface_info nocall:obj/@@plone_interface_info;">
<img src="#" alt="Image"
tal:condition="python: obj.portal_type in image_portal_types"
tal:attributes="src string:${obj/absolute_url}/$image_method"
Expand All @@ -52,42 +52,13 @@
>directory</span>)
</tal:if>

</tal:block>
</tal:notMultivalued>

<ul tal:condition="field/multiValued">
<tal:block tal:repeat="obj refs">
<tal:block define="obj_path python: '/'.join(obj.getPhysicalPath());
can_view python: helper.canView(obj);
obj_interface_info nocall:obj/@@plone_interface_info"
condition="python: can_view or not hide_inaccessible">
<li>
<img tal:condition="python:obj.portal_type in image_portal_types"
tal:attributes="src string:${obj/absolute_url}/$image_method" />
<a href="#"
tal:attributes="
href obj/absolute_url;
class python:obj.portal_type.replace(' ', '_')"
tal:content="
python:obj.Title() or obj.absolute_url(relative=1)"
>Target Title</a>

<a href="#"
tal:condition="python:obj_interface_info.provides('Products.Archetypes.interfaces.referenceengine.IContentReference')"
tal:attributes="href python:ref.getContentObject().absolute_url();
class python:obj.portal_type.replace(' ', '_')"
tal:content="field/relationship"
>reference object link</a>

<tal:if condition="show_path"
i18n:translate="label_directory">
(Directory: <span i18n:name="directory"
tal:replace="python: obj_path.replace(portal_path + '/', '') "
>directory</span>)
</tal:if>
</li>
</tal:block>
</tal:block>
</tal:item>
</li>
<li tal:condition="not:can_view" tal:omit-tag="not:multiValued">
<span i18:translate="">Undisclosed</span>
</li>
</tal:check>
</tal:items>
</ul>

</tal:define>
Expand Down

0 comments on commit edf74dd

Please sign in to comment.