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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
96f5d5bc
Commit
96f5d5bc
authored
Aug 01, 2014
by
Sven Franck
Committed by
Sebastien Robin
Aug 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added search field on gadget wrapping a listbox
parent
d2a9980e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
381 additions
and
14 deletions
+381
-14
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
...hTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
+6
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
...mplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
+18
-5
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_html.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_list_html.xml
+5
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
+19
-5
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_html.xml
...Item/web_page_module/rjs_gadget_erp5_searchfield_html.xml
+149
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
...teItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
+183
-0
bt5/erp5_web_renderjs_ui/bt/revision
bt5/erp5_web_renderjs_ui/bt/revision
+1
-1
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
View file @
96f5d5bc
...
@@ -140,6 +140,7 @@
...
@@ -140,6 +140,7 @@
group_list = form_definition.group_list,\n
group_list = form_definition.group_list,\n
queue = new RSVP.Queue(),\n
queue = new RSVP.Queue(),\n
form_gadget = this,\n
form_gadget = this,\n
suboption_dict = {},\n
parent_element = document.createElement("div");\n
parent_element = document.createElement("div");\n
\n
\n
delete options.erp5_document;\n
delete options.erp5_document;\n
...
@@ -147,6 +148,10 @@
...
@@ -147,6 +148,10 @@
\n
\n
// options = options.form_gadget || {};\n
// options = options.form_gadget || {};\n
form_gadget.state_parameter_dict = options.form_gadget || {};\n
form_gadget.state_parameter_dict = options.form_gadget || {};\n
// XXX Hardcoded for searchfield - remove later!\n
if (form_definition.extended_search) {\n
suboption_dict.extended_search = form_definition.extended_search;\n
}\n
\n
\n
form_gadget.props.gadget_list = [];\n
form_gadget.props.gadget_list = [];\n
form_gadget.props.id = erp5_document._id;\n
form_gadget.props.id = erp5_document._id;\n
...
@@ -203,7 +208,7 @@
...
@@ -203,7 +208,7 @@
})\n
})\n
.push(function (field_gadget) {\n
.push(function (field_gadget) {\n
form_gadget.props.gadget_list.push(field_gadget);\n
form_gadget.props.gadget_list.push(field_gadget);\n
var suboptions = options[renderered_field.key] ||
{}
;\n
var suboptions = options[renderered_field.key] ||
suboption_dict
;\n
suboptions.field_json = renderered_field;\n
suboptions.field_json = renderered_field;\n
return field_gadget.render(suboptions);\n
return field_gadget.render(suboptions);\n
});\n
});\n
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
96f5d5bc
...
@@ -138,6 +138,7 @@
...
@@ -138,6 +138,7 @@
\n
\n
gadget.props.field_json = field_json;\n
gadget.props.field_json = field_json;\n
gadget.props.begin_from = parseInt(options.begin_from, 10) || 0;\n
gadget.props.begin_from = parseInt(options.begin_from, 10) || 0;\n
gadget.props.extended_search = options.extended_search;\n
\n
\n
for (i = 0; i < field_json.column_list.length; i += 1) {\n
for (i = 0; i < field_json.column_list.length; i += 1) {\n
th = document.createElement("th");\n
th = document.createElement("th");\n
...
@@ -152,22 +153,34 @@
...
@@ -152,22 +153,34 @@
//////////////////////////////////////////////\n
//////////////////////////////////////////////\n
.declareService(function () {\n
.declareService(function () {\n
var gadget = this,\n
var gadget = this,\n
field_json = gadget.props.field_json,\n
props = gadget.props,\n
begin_from = gadget.props.begin_from,\n
field_json = props.field_json,\n
table = gadget.props.element.querySelector(\'table\'),\n
begin_from = props.begin_from,\n
table = props.element.querySelector(\'table\'),\n
tbody = document.createElement("tbody"),\n
tbody = document.createElement("tbody"),\n
url_query = props.extended_search,\n
query_string = "",\n
lines = field_json.lines,\n
lines = field_json.lines,\n
select_list = [],\n
select_list = [],\n
dataset,\n
dataset,\n
counter,\n
counter,\n
i;\n
i;\n
\n
// function buildQueryString(previous, next) {\n
// return previous + next[0] + \':= "\' + url_query + \'" OR \';\n
// }\n
\n
if (url_query) {\n
//query_string = field_json.column_list.reduce(buildQueryString, \' AND (\').replace(new RegExp("OR " + \'$\'), \')\');\n
query_string = \' AND \' + url_query;\n
}\n
\n
\n
for (i = 0; i < field_json.column_list.length; i += 1) {\n
for (i = 0; i < field_json.column_list.length; i += 1) {\n
select_list.push(field_json.column_list[i][0]);\n
select_list.push(field_json.column_list[i][0]);\n
}\n
}\n
\n
\n
return gadget.jio_allDocs({\n
return gadget.jio_allDocs({\n
"query": new URI(field_json.query).query(true).query,\n
"query": new URI(field_json.query).query(true).query
+ query_string
,\n
"limit": [begin_from, begin_from + lines + 1],\n
"limit": [begin_from, begin_from + lines + 1],\n
"select_list": select_list\n
"select_list": select_list\n
}).push(function (result) {\n
}).push(function (result) {\n
...
@@ -239,7 +252,7 @@
...
@@ -239,7 +252,7 @@
paging_wrap = document.createElement("div"),\n
paging_wrap = document.createElement("div"),\n
len;\n
len;\n
\n
\n
th.
colspan = lines
;\n
th.
setAttribute("colspan", field_json.column_list.length)
;\n
\n
\n
paging_menu.className = "ui-controlgroup ui-controlgroup-horizontal ui-corner-all";\n
paging_menu.className = "ui-controlgroup ui-controlgroup-horizontal ui-corner-all";\n
paging_wrap.className = "ui-controlgroup-controls";\n
paging_wrap.className = "ui-controlgroup-controls";\n
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_html.xml
View file @
96f5d5bc
...
@@ -118,10 +118,13 @@
...
@@ -118,10 +118,13 @@
\n
\n
</head>
\n
</head>
\n
<body>
\n
<body>
\n
\n
<div
data-gadget-url=
"gadget_erp5_searchfield.html"
\n
data-gadget-scope=
"erp5_searchfield"
\n
data-gadget-sandbox=
"public"
></div>
\n
\n
<div
data-gadget-url=
"gadget_erp5_form.html"
\n
<div
data-gadget-url=
"gadget_erp5_form.html"
\n
data-gadget-scope=
"erp5_form"
\n
data-gadget-scope=
"erp5_form"
\n
data-gadget-sandbox=
"public"
>
\n
data-gadget-sandbox=
"public"
>
</div>
\n
\n
\n
</body>
\n
</body>
\n
</html>
</html>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
View file @
96f5d5bc
...
@@ -97,7 +97,6 @@
...
@@ -97,7 +97,6 @@
<key>
<string>
text_content
</string>
</key>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*global rJS, RSVP, jQuery, Handlebars,\n
<value>
<string>
/*global rJS, RSVP, jQuery, Handlebars,\n
promiseEventListener, console */\n
promiseEventListener, console */\n
/*jslint nomen: true */\n
/*global window, rJS, RSVP, StatelessJS, alert, FormData, document, console */\n
/*global window, rJS, RSVP, StatelessJS, alert, FormData, document, console */\n
/*jslint maxlen:200, nomen: true */\n
/*jslint maxlen:200, nomen: true */\n
(function (window, rJS, RSVP) {\n
(function (window, rJS, RSVP) {\n
...
@@ -108,16 +107,31 @@
...
@@ -108,16 +107,31 @@
// declared methods\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n
.declareMethod(\'render\', function (options) {\n
\n
var gadget = this;
\n
var form_options = options.erp5_form || {};\n
var form_options = options.erp5_form || {};\n
var search_options = {};\n
\n
\n
form_options.erp5_document = options.erp5_document;\n
form_options.erp5_document = options.erp5_document;\n
form_options.form_definition = options.form_definition;\n
form_options.form_definition = options.form_definition;\n
// XXX not generic, fix later\n
if (options.erp5_searchfield) {\n
form_options.form_definition.extended_search = options.erp5_searchfield.extended_search;\n
search_options.extended_search = options.erp5_searchfield.extended_search;\n
}\n
form_options.view = options.view;\n
form_options.view = options.view;\n
\n
\n
return this.getDeclaredGadget("erp5_form")\n
return new RSVP.Queue()\n
.push(function (erp5_form) {\n
.push(function () {\n
return erp5_form.render(form_options);\n
return RSVP.all([\n
gadget.getDeclaredGadget("erp5_searchfield"),\n
gadget.getDeclaredGadget("erp5_form")\n
]);\n
})\n
.push(function (all_gadget) {\n
return RSVP.all([\n
all_gadget[0].render(search_options),\n
all_gadget[1].render(form_options)\n
]);\n
});\n
});\n
\n
\n
});\n
});\n
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_html.xml
0 → 100644
View file @
96f5d5bc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Page"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_erp5_searchfield.html
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
rjs_gadget_erp5_searchfield_html
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<string>
en
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Page
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<!DOCTYPE html>
\n
<html>
\n
<head>
\n
<meta
charset=
"utf-8"
/>
\n
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
\n
<title>
ERP5 Search Field
</title>
\n
\n
<!-- renderjs -->
\n
<script
src=
"RSVP.js"
></script>
\n
<script
src=
"renderjs.js"
></script>
\n
<!-- <script src="handlebars.js"></script> -->
\n
\n
<!-- custom script -->
\n
<script
src=
"gadget_erp5_searchfield.js"
></script>
\n
\n
</head>
\n
<body>
\n
\n
<fieldset
class=
"center"
>
\n
<form
class=
"search_form"
>
\n
<div
class=
"ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear"
>
\n
<input
type=
"text"
data-enhanced=
"true"
value=
""
name=
"search"
/>
\n
<div
class=
"ui-btn ui-input-clear ui-input-btn ui-corner-all ui-icon-search ui-btn-icon-notext"
>
\n
Submit
<input
data-enhanced=
"true"
type=
"submit"
value=
"Submit"
>
\n
</div>
\n
</div>
\n
</form>
\n
</fieldset>
\n
\n
</body>
\n
</html>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Gadget ERP5 Search Field
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
001
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
0 → 100644
View file @
96f5d5bc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_erp5_searchfield.js
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
rjs_gadget_erp5_searchfield_js
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<string>
en
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Script
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*global rJS, RSVP, jQuery, Handlebars,\n
promiseEventListener, console */\n
/*global window, rJS, RSVP, StatelessJS, alert, FormData, document, console */\n
/*jslint maxlen:200, nomen: true */\n
(function (window, rJS, RSVP, $) {\n
"use strict";\n
\n
rJS(window)\n
/////////////////////////////////////////////////////////////////\n
// ready\n
/////////////////////////////////////////////////////////////////\n
// Init local properties\n
.ready(function (g) {\n
g.props = {};\n
})\n
\n
// Assign the element to a variable\n
.ready(function (g) {\n
return g.getElement()\n
.push(function (element) {\n
g.props.element = element;\n
});\n
})\n
\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n
this.props.element.querySelector("input").value = options.extended_search || "";\n
})\n
\n
.declareMethod(\'getContent\', function () {\n
var input = this.__element.querySelector(\'input\'),\n
result = {};\n
\n
result[input.getAttribute(\'name\')] = input.value;\n
return result;\n
})\n
\n
.declareService(function () {\n
var search_form = this;\n
\n
function formSubmit() {\n
var form_data;\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return search_form.getContent();\n
})\n
.push(function (data) {\n
console.log(data);\n
return search_form.pleasePublishMyState({\n
"extended_search": data.search\n
});\n
})\n
.push(function (url) {\n
console.log(url);\n
return search_form.pleaseRedirectMyHash(url);\n
});\n
}\n
\n
// Listen to form submit\n
return loopEventListener(\n
search_form.props.element.querySelector(\'form\'),\n
\'submit\',\n
false,\n
formSubmit\n
);\n
});\n
\n
}(window, rJS, RSVP, jQuery));
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Gadget ERP5 Search Field JS
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
001
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/bt/revision
View file @
96f5d5bc
18
19
\ 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