Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
d3f94ed5
Commit
d3f94ed5
authored
Jan 27, 2014
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_autocompletion_ui: Clean up and make parameters names consistent with ERP5.
parent
67d35171
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
23 deletions
+25
-23
bt5/erp5_autocompletion_ui/SkinTemplateItem/portal_skins/erp5_autocompletion_ui/ERP5Site_getCompletionList.xml
...ins/erp5_autocompletion_ui/ERP5Site_getCompletionList.xml
+11
-12
bt5/erp5_autocompletion_ui/SkinTemplateItem/portal_skins/erp5_autocompletion_ui/jquery.erp5.autocompletion.js.xml
.../erp5_autocompletion_ui/jquery.erp5.autocompletion.js.xml
+10
-10
bt5/erp5_autocompletion_ui/bt/change_log
bt5/erp5_autocompletion_ui/bt/change_log
+3
-0
bt5/erp5_autocompletion_ui/bt/revision
bt5/erp5_autocompletion_ui/bt/revision
+1
-1
No files found.
bt5/erp5_autocompletion_ui/SkinTemplateItem/portal_skins/erp5_autocompletion_ui/ERP5Site_getCompletionList.xml
View file @
d3f94ed5
...
@@ -50,20 +50,19 @@
...
@@ -50,20 +50,19 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
req = container.REQUEST.get\n
<value>
<string>
kw = dict(limit=20)\n
kw = dict(limit=20)\n
\n
\n
term = req("starts_with")\n
if starts_with is not None and search_catalog_key is not None:\n
key = req("key")\n
kw[search_catalog_key] = "%s%%" % starts_with\n
if term is not None and key is not None:\n
kw[key] = "%s%%" % term\n
\n
\n
portal_type = req("portal_type")\n
if search_portal_type is not None:\n
if portal_type is not None:\n
kw["portal_type"] = search_portal_type\n
kw["portal_type"] = portal_type\n
\n
result = [o.title for o in context.portal_catalog(**kw)]\n
\n
\n
result = []\n
for brain in context.portal_catalog(**kw):\n
result.append({\'label\': brain.getTitle(),\n
\'value\': brain.getTitle(),\n
\'description\': brain.getRelativeUrl()})\n
\n
\n
from json import dumps\n
from json import dumps\n
return dumps(result, indent=4)\n
return dumps(result, indent=4)\n
...
@@ -71,7 +70,7 @@ return dumps(result, indent=4)\n
...
@@ -71,7 +70,7 @@ return dumps(result, indent=4)\n
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
starts_with=None, search_catalog_key=None, search_portal_type=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_autocompletion_ui/SkinTemplateItem/portal_skins/erp5_autocompletion_ui/jquery.erp5.autocompletion.js.xml
View file @
d3f94ed5
...
@@ -41,9 +41,10 @@ $(function() {\n
...
@@ -41,9 +41,10 @@ $(function() {\n
// private\n
// private\n
function generateSource(params) {\n
function generateSource(params) {\n
var data = {};\n
var data = {};\n
\n
if (params.search_portal_type)\n
if (params.portal_type) data.portal_type = params.portal_type;\n
data.search_portal_type = params.search_portal_type;\n
if (params.search_key) data.key = params.search_key;\n
if (params.search_catalog_key)\n
data.search_catalog_key = params.search_catalog_key;\n
\n
\n
return function(request, response) {\n
return function(request, response) {\n
$.extend(data, {starts_with: request.term});\n
$.extend(data, {starts_with: request.term});\n
...
@@ -61,18 +62,18 @@ $(function() {\n
...
@@ -61,18 +62,18 @@ $(function() {\n
\n
\n
/*\n
/*\n
* Wrapper around jQuery.ui.autocomplete that queries catalog\n
* Wrapper around jQuery.ui.autocomplete that queries catalog\n
* to return matching terms.
Titles are displayed
.\n
* to return matching terms.
Display title by default
.\n
*\n
*\n
* Parameters:\n
* Parameters:\n
* - search_key: catalog key that should be matched against\n
* - search_
catalog_
key: catalog key that should be matched against\n
* user input. For example, "title" to match titles,\n
* user input. For example, "title" to match titles,\n
* your_custom_reference to search for customized reference, etc\n
* your_custom_reference to search for customized reference, etc\n
* - optional portal_type\n
* - optional
search_
portal_type\n
*\n
*\n
* Example:\n
* Example:\n
* $(".your_input").ERP5Autocomplete({\n
* $(".your_input").ERP5Autocomplete({\n
* portal_type: "Product",\n
*
search_
portal_type: "Product",\n
* search_key: "title",\n
* search_
catalog_
key: "title",\n
* });\n
* });\n
*/\n
*/\n
$.fn.ERP5Autocomplete = function(kw) {\n
$.fn.ERP5Autocomplete = function(kw) {\n
...
@@ -80,8 +81,7 @@ $(function() {\n
...
@@ -80,8 +81,7 @@ $(function() {\n
delay: 600});\n
delay: 600});\n
};\n
};\n
});\n
});\n
</tal:block>
\n
</tal:block>
]]>
</unicode>
</value>
]]>
</unicode>
</value>
</item>
</item>
...
...
bt5/erp5_autocompletion_ui/bt/change_log
View file @
d3f94ed5
2014-01-27 arnaud.fontaine
* Clean up and make parameters names consistent with ERP5.
2014-01-27 arnaud.fontaine
2014-01-27 arnaud.fontaine
* Increase delay before searching from 300ms (default) to 600ms, this should be enough...
* Increase delay before searching from 300ms (default) to 600ms, this should be enough...
...
...
bt5/erp5_autocompletion_ui/bt/revision
View file @
d3f94ed5
10
11
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment