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
Ludovic Kiefer
erp5
Commits
3a500c87
Commit
3a500c87
authored
Feb 13, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RelationField should use selected document UID
Do not validate until user select one document
parent
1b117ada
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
34 deletions
+44
-34
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+13
-10
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_relationstringfield_js.xml
...eb_page_module/rjs_gadget_erp5_relationstringfield_js.xml
+31
-24
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
3a500c87
...
@@ -175,22 +175,22 @@ def renderField(field, meta_type=None):\n
...
@@ -175,22 +175,22 @@ def renderField(field, meta_type=None):\n
elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
elif meta_type in ("RelationStringField", "MultiRelationStringField"):\n
\n
\n
portal_type_list = field.get_value(\'portal_type\')\n
portal_type_list = field.get_value(\'portal_type\')\n
if len(portal_type_list) >
0:\n
if portal_type_list:\n
portal_types = portal_type_list[0]\n
portal_type_list = [x[0] for x in portal_type_list]\n
else:\n
\n
portal_types = []\n
\n
query = url_template_dict["jio_search_template"] % {\n
query = url_template_dict["jio_search_template"] % {\n
"query": make_query({"query": sql_catalog.buildQuery(\n
"query": make_query({"query": sql_catalog.buildQuery(\n
{"portal_type":
[x[0] for x in portal_types]
}\n
{"portal_type":
portal_type_list
}\n
).asSearchTextExpression(sql_catalog)})\n
).asSearchTextExpression(sql_catalog)})\n
}\n
}\n
result = {\n
result = {\n
"portal_types": portal_type
s
,\n
"portal_types": portal_type
_list
,\n
"query": query,\n
"query": query,\n
"catalog_index": field.get_value(\'catalog_index\'),\n
"catalog_index": field.get_value(\'catalog_index\'),\n
"allow_jump": field.get_value(\'allow_jump\'),\n
# "allow_jump": field.get_value(\'allow_jump\'),\n
"allow_creation": field.get_value(\'allow_creation\'),\n
"allow_jump": 0,\n
# "allow_creation": field.get_value(\'allow_creation\'),\n
"allow_creation": 0,\n
"type": meta_type,\n
"type": meta_type,\n
"key": field.generate_field_key(),\n
"key": field.generate_field_key(),\n
"default": field.get_value("default"),\n
"default": field.get_value("default"),\n
...
@@ -199,8 +199,11 @@ def renderField(field, meta_type=None):\n
...
@@ -199,8 +199,11 @@ def renderField(field, meta_type=None):\n
"hidden": field.get_value("hidden"),\n
"hidden": field.get_value("hidden"),\n
"description": field.get_value("description"),\n
"description": field.get_value("description"),\n
"title": field.get_value("title"),\n
"title": field.get_value("title"),\n
"required": field.get_value("required")
,
\n
"required": field.get_value("required")\n
}\n
}\n
result["relation_field_id"] = traversed_document.Field_getSubFieldKeyDict(field, "relation", key=result["key"])\n
result["relation_item_key"] = traversed_document.Field_getSubFieldKeyDict(field, "item", key=result["key"])\n
\n
elif meta_type == "CheckBoxField":\n
elif meta_type == "CheckBoxField":\n
result = {\n
result = {\n
"type": meta_type,\n
"type": meta_type,\n
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_relationstringfield_js.xml
View file @
3a500c87
...
@@ -173,7 +173,7 @@ promiseEventListener */\n
...
@@ -173,7 +173,7 @@ promiseEventListener */\n
\n
\n
subfield = document.createElement("input");\n
subfield = document.createElement("input");\n
subfield.setAttribute("type", "hidden");\n
subfield.setAttribute("type", "hidden");\n
subfield.setAttribute("name",
"subfield_" + field_json.key + "_relation"
);\n
subfield.setAttribute("name",
field_json.relation_item_key
);\n
subfield.setAttribute("value", "_newContent_" + info);\n
subfield.setAttribute("value", "_newContent_" + info);\n
\n
\n
default_subfield = document.createElement("input");\n
default_subfield = document.createElement("input");\n
...
@@ -205,7 +205,7 @@ promiseEventListener */\n
...
@@ -205,7 +205,7 @@ promiseEventListener */\n
// creates a set of autocomplete suggestings. Currently this is only a plain\n
// creates a set of autocomplete suggestings. Currently this is only a plain\n
// list of elements. The list will display the number of results (>
10 or \n
// list of elements. The list will display the number of results (>
10 or \n
// exact). Clicking on an option will set this option as field value\n
// exact). Clicking on an option will set this option as field value\n
function createResults(my_result_list) {\n
function createResults(my_result_list
, index
) {\n
var list = document.createElement("ul"),\n
var list = document.createElement("ul"),\n
head = document.createElement("li"),\n
head = document.createElement("li"),\n
str = "ui-li-static ui-body-inherit ui-icon-mail-forward " +\n
str = "ui-li-static ui-body-inherit ui-icon-mail-forward " +\n
...
@@ -238,12 +238,8 @@ promiseEventListener */\n
...
@@ -238,12 +238,8 @@ promiseEventListener */\n
//
NOTE:
if
doing
more
complex
UI,
beware
the
textContent
value
won\'t\n
//
NOTE:
if
doing
more
complex
UI,
beware
the
textContent
value
won\'t\n
//
work,
because
currently
it\'s
used
to
retrieve
the
link
from\n
//
work,
because
currently
it\'s
used
to
retrieve
the
link
from\n
//
the
last
autocomplete
query
results!\n
//
the
last
autocomplete
query
results!\n
for
(j
in
result)
{\n
item.textContent =
result[index];\n
if
(result.hasOwnProperty(j)
&&
j.indexOf("_")
!==
0)
{\n
item.setAttribute("name",
result["uid"]);\n
content
+=
result[j];\n
}\n
}\n
item.textContent =
content;\n
list.appendChild(item);\n
list.appendChild(item);\n
}\n
}\n
\n
\n
...
@@ -270,15 +266,15 @@ promiseEventListener */\n
...
@@ -270,15 +266,15 @@ promiseEventListener */\n
function
triggerAutocomplete(my_gadget,
my_value,
my_initial_call)
{\n
function
triggerAutocomplete(my_gadget,
my_value,
my_initial_call)
{\n
var
props =
my_gadget.property_dict,\n
var
props =
my_gadget.property_dict,\n
field_json =
props.field_json,\n
field_json =
props.field_json,\n
index =
[].concat(field_json.catalog_index)
,\n
index =
field_json.catalog_index
,\n
begin_from =
props.begin_from
||
0,\n
begin_from =
props.begin_from
||
0,\n
lines =
field_json.lines
||
11,\n
lines =
field_json.lines
||
11,\n
select_list =
index,\n
select_list =
[index,
"uid"],\n
value =
\':"\'
+
my_value
+
\'"
OR
\',\n
query_string =
" AND ("
+
index
+
\':"\'
+
my_value
+
\'")\',\n
value_query =
\'(\'
+
index.join(value)
+
value.replace("
OR
",
"")
+
\')\',\n
query_string =
" AND "
+
value_query,\n
result_dict;\n
result_dict;\n
\n
\n
delete
props.selected_uid;\n
\n
return
new
RSVP.Queue()\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
.push(function
()
{\n
\n
\n
...
@@ -298,9 +294,9 @@ promiseEventListener */\n
...
@@ -298,9 +294,9 @@ promiseEventListener */\n
props.spinner.className =
"ui-hidden-accessible"
;\n
props.spinner.className =
"ui-hidden-accessible"
;\n
\n
\n
//
skip
showing
single
result
on
render(),
only
set
link\n
//
skip
showing
single
result
on
render(),
only
set
link\n
if
(my_initial_call)
{\n
//
if
(my_initial_call)
{\n
return
{"target":
{"textContent":
my_value}};\n
//
return
{"target":
{"textContent":
my_value}};\n
}\n
//
}\n
\n
\n
//
show
"new"
tag
if
no
results
and
creation
allowed\n
//
show
"new"
tag
if
no
results
and
creation
allowed\n
if
(
result_dict.total_rows =
==
0
&&
field_json.allow_creation)
{\n
if
(
result_dict.total_rows =
==
0
&&
field_json.allow_creation)
{\n
...
@@ -329,7 +325,7 @@ promiseEventListener */\n
...
@@ -329,7 +325,7 @@ promiseEventListener */\n
return
new
RSVP.Queue()\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
.push(function
()
{\n
var
list;\n
var
list;\n
props.wrapper.appendChild(createResults(result_dict.rows));\n
props.wrapper.appendChild(createResults(result_dict.rows
,
index
));\n
list =
props.wrapper.querySelector("ul");\n
list =
props.wrapper.querySelector("ul");\n
\n
\n
return
RSVP.any([\n
return
RSVP.any([\n
...
@@ -353,9 +349,11 @@ promiseEventListener */\n
...
@@ -353,9 +349,11 @@ promiseEventListener */\n
\n
\n
//
take
entered
text,
set
to
input
and
clear
list
options\n
//
take
entered
text,
set
to
input
and
clear
list
options\n
selected_value =
my_selection_event.target.textContent;\n
selected_value =
my_selection_event.target.textContent;\n
props.selected_uid =
my_selection_event.target.getAttribute("name");\n
props.valid =
true;\n
props.wrapper.querySelector("input")
.value =
selected_value;\n
props.wrapper.querySelector("input")
.value =
selected_value;\n
clearResults(my_gadget,
"skip");\n
clearResults(my_gadget,
"skip");\n
\n
\n
//
retrieve
url
if
"allow_jump"
is
set\n
//
retrieve
url
if
"allow_jump"
is
set\n
if
(props.field_json.allow_jump)
{\n
if
(props.field_json.allow_jump)
{\n
for
(
i =
0;
i
<
result_dict.total_rows;
i
+=
1)
{\n
for
(
i =
0;
i
<
result_dict.total_rows;
i
+=
1)
{\n
...
@@ -425,6 +423,7 @@ promiseEventListener */\n
...
@@ -425,6 +423,7 @@ promiseEventListener */\n
//
expose
field_json
and
keep
last
value
to
prevent
trigger
on
no-change\n
//
expose
field_json
and
keep
last
value
to
prevent
trigger
on
no-change\n
field_gadget.property_dict.field_json =
field_json;\n
field_gadget.property_dict.field_json =
field_json;\n
field_gadget.property_dict.last_value =
value
||
"";\n
field_gadget.property_dict.last_value =
value
||
"";\n
field_gadget.property_dict.valid =
true;\n
\n
\n
input.setAttribute(\'value\',
value
||
"");\n
input.setAttribute(\'value\',
value
||
"");\n
input.setAttribute(\'name\',
field_json.key);\n
input.setAttribute(\'name\',
field_json.key);\n
...
@@ -439,10 +438,10 @@ promiseEventListener */\n
...
@@ -439,10 +438,10 @@ promiseEventListener */\n
//
input.setAttribute(\'disabled\',
\'disabled\');\n
//
input.setAttribute(\'disabled\',
\'disabled\');\n
}\n
}\n
\n
\n
//
set
relation
field
links
(without
showing
1
autocomplete
result)\n
/
*
/
/
set
relation
field
links
(without
showing
1
autocomplete
result)\n
if
(value)
{\n
if
(value)
{\n
return
triggerAutocomplete(field_gadget,
value,
true);\n
return
triggerAutocomplete(field_gadget,
value,
true);\n
}\n
}
*/
\n
})\n
})\n
\n
\n
//
get
content
(needs
hidden
fields,
too,
when
creating
new
records)\n
//
get
content
(needs
hidden
fields,
too,
when
creating
new
records)\n
...
@@ -457,13 +456,18 @@ promiseEventListener */\n
...
@@ -457,13 +456,18 @@ promiseEventListener */\n
input =
input_list[i];\n
input =
input_list[i];\n
result[input.getAttribute(\'name\')]
=
input.value;\n
result[input.getAttribute(\'name\')]
=
input.value;\n
}\n
}\n
\n
//
Always
return
the
document
UID
if
value
has
been
modified\n
if
(this.property_dict.selected_uid
!==
undefined)
{\n
result[this.property_dict.field_json.relation_field_id]
=
this.property_dict.selected_uid;\n
}\n
\n
\n
return
result;\n
return
result;\n
})\n
})\n
\n
\n
.declareMethod(\'checkValidity\',
function
()
{\n
.declareMethod(\'checkValidity\',
function
()
{\n
var
result;\n
var
result;\n
result =
this.element.querySelector(\'input\').checkValidity(
);\n
result =
(this.element.querySelector(\'input\').checkValidity())
&&
(this.property_dict.valid
);\n
if
(result)
{\n
if
(result)
{\n
return
this.notifyValid()\n
return
this.notifyValid()\n
.push(function
()
{\n
.push(function
()
{\n
...
@@ -499,8 +503,11 @@ promiseEventListener */\n
...
@@ -499,8 +503,11 @@ promiseEventListener */\n
\n
\n
//
empty
value,
do
nothing
but
notify\n
//
empty
value,
do
nothing
but
notify\n
if
(
value =
==
"")
{\n
if
(
value =
==
"")
{\n
field_gadget.property_dict.valid =
true;\n
return
notifyChange(field_gadget);\n
return
notifyChange(field_gadget);\n
}\n
}\n
\n
field_gadget.property_dict.valid =
false;\n
\n
\n
//
replace
existing
promise
in
case
it
has
not
triggered\n
//
replace
existing
promise
in
case
it
has
not
triggered\n
pending_promise =
props.pending_promise;\n
pending_promise =
props.pending_promise;\n
...
@@ -719,7 +726,7 @@ promiseEventListener */\n
...
@@ -719,7 +726,7 @@ promiseEventListener */\n
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
super_sve
n
</string>
</value>
<value>
<string>
romai
n
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -733,7 +740,7 @@ promiseEventListener */\n
...
@@ -733,7 +740,7 @@ promiseEventListener */\n
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
940.
39166.48303.39133
</string>
</value>
<value>
<string>
940.
60782.50245.64187
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -751,7 +758,7 @@ promiseEventListener */\n
...
@@ -751,7 +758,7 @@ promiseEventListener */\n
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
142
2461235.64
</float>
<float>
142
3756466.29
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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