plone / archetypes.referencebrowserwidget Goto Github PK
View Code? Open in Web Editor NEWprovides a widget used for Archetypes reference-fields
provides a widget used for Archetypes reference-fields
The click on "Add" opens a popup that doesn't hold an exclusive focus, so you go out and you risk losing control of what appears on the screen. Also in the popup, the focus on "View" isn't visible.
if allowed_types are defined, only selectable items should be displayed!
self.request.form['portal_type'] = []
imho ^ removes the portal_type query parameter and disables allowed_types
removing that line solves the problem in "real life" but it seems this feature is not taken into account within the tests
Failure in test test_popup_items (archetypes.referencebrowserwidget.tests.test_product.IntegrationTestCase)
Traceback (most recent call last):
File "/Users/peter/workspace/python/parts/opt/lib/python2.7/unittest/case.py", line 327, in run
testMethod()
File "/Users/peter/workspace/buildout.coredev/src/archetypes.referencebrowserwidget/src/archetypes/referencebrowserwidget/tests/test_product.py", line 665, in test_popup_items
self.assertEqual(len(ROWS.findall(body)), wanted_rows)
File "/Users/peter/workspace/python/parts/opt/lib/python2.7/unittest/case.py", line 509, in assertEqual
assertion_func(first, second, msg=msg)
File "/Users/peter/workspace/python/parts/opt/lib/python2.7/unittest/case.py", line 502, in _baseAssertEqual
raise self.failureException(msg)
AssertionError: 3 != 7
Hi,
I think searching using a ZCTextIndex (like default SearchableText is) should be searched as wildcard (so "word", should be searched like "word*"). This make more sense to any users, we systematically overrides the search view to do this...
I would like to propose a Pull request where a widget.wild_card_search parameter could ne set to True if we want the widget to behave like that. I would even remove this as a parameter but add a checkbox in the popup that would show when a ZCTextIndex index is searched.
What about this?
Thank you!
Gauthier
c7c2806 moved all functions from referencebrowser.js into an anonymous function:
jQuery(function(jq) {
...
});
This means all the refbrowser_* functions are not visible anymore via the global JS namespace and hence moving references up and down does not work anymore because referencebrowser.pt uses
onclick="javascript:refbrowser_moveReferenceDown(this); return false"
http://localhost:8080/Plone2/refbrowser_popup
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 359, in publish_module
Module ZPublisher.WSGIPublisher, line 262, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 63, in call_object
Module archetypes.referencebrowserwidget.browser.view, line 212, in __call__
Module archetypes.referencebrowserwidget.utils, line 217, in __call__
AttributeError: 'ReferenceBrowserPopup' object has no attribute '__of__'
This is in a customer project that I want to update from 4.3 to 5.2. I think I have customised a bit. But I get the above error when I try to use the popup on an edit form.
I'm not sure if we will keep Archetypes for this project, as stepping stone before we move to dexterity and Python 3. Might be double work: first get it to work with Archetypes, and then do the work to go to dexterity.
Somewhere between 2.4 and 2.5, the helper methods have been made private. In several locations were references to the global functions. This broke the functionality and a Felix Schwarz provided a quickfix to solve the problem quickly.
On the long run, these methods should not be global. Instead the code should be reviewed to avoid the requirement for lots of global methods.
In referencebrowser.pt:
<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)">
fails with
Not a valid path-expression. - String: "nocall:obj/@@plone_interface_info can_view python: helper.canView(obj)"
On Plone 5.2.1 I get:
PTRuntimeError: Page Template referencebrowser has errors: ['Compilation failed', 'exceptions.ImportError: No module named set'
This goes away when I edit referencebrowser.pt
and replace tal:repeat="set refs"
by tal:repeat="myset refs"
, plus changing the other occurrences. I guess set
is no longer a good variable name.
No time now to fix, just quickly reporting this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.