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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
b89114c1
Commit
b89114c1
authored
Aug 29, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Move gadget url resolution (from its ERP5 type) to from Form to Label Gadget
parent
cf1a0610
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
74 deletions
+76
-74
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
...thTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
+11
-61
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
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
...ateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
+54
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
...teItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
...emplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
+5
-6
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
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
View file @
b89114c1
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, document, rJS, RSVP*/
/*global window, document, rJS, RSVP*/
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
/** Form is one of a complicated gadget!
"
use strict
"
;
/** Form is one of a complicated gadget!
*
*
* Editability - the form overrides editability of its fields. Editability is
* Editability - the form overrides editability of its fields. Editability is
* hard-coded changed either in Page Templates or soft-coded
* hard-coded changed either in Page Templates or soft-coded
* changed in FormBox gadget which renders form as a subgadget
* changed in FormBox gadget which renders form as a subgadget
**/
**/
function
getFieldTypeGadgetUrl
(
type
)
{
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
var
field_url
=
'
gadget_erp5_field_readonly.html
'
;
"
use strict
"
;
if
(
type
===
'
ListField
'
)
{
field_url
=
'
gadget_erp5_field_list.html
'
;
}
else
if
((
type
===
'
ParallelListField
'
)
||
(
type
===
'
MultiListField
'
))
{
field_url
=
'
gadget_erp5_field_multilist.html
'
;
}
else
if
(
type
===
'
CheckBoxField
'
)
{
field_url
=
'
gadget_erp5_field_checkbox.html
'
;
}
else
if
(
type
===
'
MultiCheckBoxField
'
)
{
field_url
=
'
gadget_erp5_field_multicheckbox.html
'
;
}
else
if
(
type
===
'
StringField
'
)
{
field_url
=
'
gadget_erp5_field_string.html
'
;
}
else
if
(
type
===
'
PasswordField
'
)
{
field_url
=
'
gadget_erp5_field_password.html
'
;
}
else
if
(
type
===
'
RelationStringField
'
)
{
field_url
=
'
gadget_erp5_field_relationstring.html
'
;
}
else
if
(
type
===
'
MultiRelationStringField
'
)
{
field_url
=
'
gadget_erp5_field_multirelationstring.html
'
;
}
else
if
(
type
===
'
TextAreaField
'
)
{
field_url
=
'
gadget_erp5_field_textarea.html
'
;
}
else
if
(
type
===
'
DateTimeField
'
)
{
field_url
=
'
gadget_erp5_field_datetime.html
'
;
}
else
if
(
type
===
'
FloatField
'
)
{
field_url
=
'
gadget_erp5_field_float.html
'
;
}
else
if
(
type
===
'
FileField
'
)
{
field_url
=
'
gadget_erp5_field_file.html
'
;
}
else
if
(
type
===
'
IntegerField
'
)
{
field_url
=
'
gadget_erp5_field_integer.html
'
;
}
else
if
(
type
===
'
ListBox
'
)
{
field_url
=
'
gadget_erp5_field_listbox.html
'
;
}
else
if
(
type
===
'
EditorField
'
)
{
field_url
=
'
gadget_erp5_field_editor.html
'
;
// field_url = 'gadget_codemirror.html';
// sandbox = 'iframe';
}
else
if
(
type
===
'
GadgetField
'
)
{
field_url
=
'
gadget_erp5_field_gadget.html
'
;
}
else
if
(
type
===
'
RadioField
'
)
{
field_url
=
'
gadget_erp5_field_radio.html
'
;
}
else
if
(
type
===
'
ImageField
'
)
{
field_url
=
'
gadget_erp5_field_image.html
'
;
}
else
if
(
type
===
'
EmailField
'
)
{
field_url
=
'
gadget_erp5_field_email.html
'
;
}
else
if
(
type
===
'
FormBox
'
)
{
field_url
=
'
gadget_erp5_field_formbox.html
'
;
}
return
field_url
;
}
/**
/**
* Physically append rendered field to DOM.
* Physically append rendered field to DOM.
...
@@ -79,7 +30,7 @@
...
@@ -79,7 +30,7 @@
suboptions
=
{
suboptions
=
{
hide_enabled
:
form_definition
.
hide_enabled
,
// listbox specific
hide_enabled
:
form_definition
.
hide_enabled
,
// listbox specific
extended_search
:
form_definition
.
extended_search
,
// searchfield specific
extended_search
:
form_definition
.
extended_search
,
// searchfield specific
field_
url
:
getFieldTypeGadgetUrl
(
rendered_document
[
field_name
].
type
)
,
field_
type
:
rendered_document
[
field_name
].
type
,
label
:
((
group_name
!==
"
bottom
"
)
&&
(
rendered_document
[
field_name
].
title
.
length
>
0
)),
// no label for bottom group and field without title
label
:
((
group_name
!==
"
bottom
"
)
&&
(
rendered_document
[
field_name
].
title
.
length
>
0
)),
// no label for bottom group and field without title
field_json
:
rendered_document
[
field_name
]
// pass
field_json
:
rendered_document
[
field_name
]
// pass
};
};
...
@@ -111,9 +62,11 @@
...
@@ -111,9 +62,11 @@
// XXX Hardcoded to get one listbox gadget
// XXX Hardcoded to get one listbox gadget
//pt form list gadget will get this listbox's info
//pt form list gadget will get this listbox's info
//then pass to search field gadget
//then pass to search field gadget
if
(
suboptions
.
field_
url
===
"
gadget_erp5_field_listbox.html
"
)
{
if
(
suboptions
.
field_
type
===
'
ListBox
'
)
{
form_gadget
.
props
.
listbox_gadget
=
label_gadget
;
form_gadget
.
props
.
listbox_gadget
=
label_gadget
;
}
}
// gadget_list hold references to all created gadgets
form_gadget
.
props
.
gadget_list
.
push
(
label_gadget
);
form_gadget
.
props
.
gadget_list
.
push
(
label_gadget
);
}
}
return
label_gadget
.
render
(
suboptions
);
return
label_gadget
.
render
(
suboptions
);
...
@@ -169,9 +122,6 @@
...
@@ -169,9 +122,6 @@
editable
:
undefined
editable
:
undefined
})
})
.
allowPublicAcquisition
(
"
getFieldTypeGadgetUrl
"
,
function
(
param_list
)
{
return
getFieldTypeGadgetUrl
(
param_list
[
0
]);
})
.
allowPublicAcquisition
(
"
getFormContent
"
,
function
(
param_list
)
{
.
allowPublicAcquisition
(
"
getFormContent
"
,
function
(
param_list
)
{
return
this
.
getContent
(
param_list
[
0
]);
return
this
.
getContent
(
param_list
[
0
]);
})
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
View file @
b89114c1
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
961.
18982.46006.23483
</string>
</value>
<value>
<string>
961.
37896.39526.64290
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
150
2268077.5
</float>
<float>
150
3478842.83
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
View file @
b89114c1
...
@@ -16,6 +16,59 @@
...
@@ -16,6 +16,59 @@
var
SCOPE
=
'
field
'
;
var
SCOPE
=
'
field
'
;
function
getFieldTypeGadgetUrl
(
field_type
)
{
var
field_url
=
'
gadget_erp5_field_readonly.html
'
;
if
(
field_type
===
'
ListField
'
)
{
field_url
=
'
gadget_erp5_field_list.html
'
;
}
else
if
((
field_type
===
'
ParallelListField
'
)
||
(
field_type
===
'
MultiListField
'
))
{
field_url
=
'
gadget_erp5_field_multilist.html
'
;
}
else
if
(
field_type
===
'
CheckBoxField
'
)
{
field_url
=
'
gadget_erp5_field_checkbox.html
'
;
}
else
if
(
field_type
===
'
MultiCheckBoxField
'
)
{
field_url
=
'
gadget_erp5_field_multicheckbox.html
'
;
}
else
if
(
field_type
===
'
StringField
'
)
{
field_url
=
'
gadget_erp5_field_string.html
'
;
}
else
if
(
field_type
===
'
LinesField
'
)
{
field_url
=
'
gadget_erp5_field_lines.html
'
;
}
else
if
(
field_type
===
'
PasswordField
'
)
{
field_url
=
'
gadget_erp5_field_password.html
'
;
}
else
if
(
field_type
===
'
RelationStringField
'
)
{
field_url
=
'
gadget_erp5_field_relationstring.html
'
;
}
else
if
(
field_type
===
'
MultiRelationStringField
'
)
{
field_url
=
'
gadget_erp5_field_multirelationstring.html
'
;
}
else
if
(
field_type
===
'
TextAreaField
'
)
{
field_url
=
'
gadget_erp5_field_textarea.html
'
;
}
else
if
(
field_type
===
'
DateTimeField
'
)
{
field_url
=
'
gadget_erp5_field_datetime.html
'
;
}
else
if
(
field_type
===
'
FloatField
'
)
{
field_url
=
'
gadget_erp5_field_float.html
'
;
}
else
if
(
field_type
===
'
FileField
'
)
{
field_url
=
'
gadget_erp5_field_file.html
'
;
}
else
if
(
field_type
===
'
IntegerField
'
)
{
field_url
=
'
gadget_erp5_field_integer.html
'
;
}
else
if
(
field_type
===
'
ListBox
'
)
{
field_url
=
'
gadget_erp5_field_listbox.html
'
;
}
else
if
(
field_type
===
'
EditorField
'
)
{
field_url
=
'
gadget_erp5_field_editor.html
'
;
// field_url = 'gadget_codemirror.html';
// sandbox = 'iframe';
}
else
if
(
field_type
===
'
GadgetField
'
)
{
field_url
=
'
gadget_erp5_field_gadget.html
'
;
}
else
if
(
field_type
===
'
RadioField
'
)
{
field_url
=
'
gadget_erp5_field_radio.html
'
;
}
else
if
(
field_type
===
'
ImageField
'
)
{
field_url
=
'
gadget_erp5_field_image.html
'
;
}
else
if
(
field_type
===
'
EmailField
'
)
{
field_url
=
'
gadget_erp5_field_email.html
'
;
}
else
if
(
field_type
===
'
FormBox
'
)
{
field_url
=
'
gadget_erp5_field_formbox.html
'
;
}
else
if
(
field_type
===
'
MatrixBox
'
)
{
field_url
=
'
gadget_erp5_field_matrixbox.html
'
;
}
return
field_url
;
}
rJS
(
window
)
rJS
(
window
)
.
setState
({
.
setState
({
label_text
:
''
,
label_text
:
''
,
...
@@ -35,7 +88,7 @@
...
@@ -35,7 +88,7 @@
var
state_dict
=
{
var
state_dict
=
{
label_text
:
options
.
field_json
.
title
||
''
,
label_text
:
options
.
field_json
.
title
||
''
,
label
:
options
.
label
,
label
:
options
.
label
,
field_url
:
options
.
field_url
,
field_url
:
getFieldTypeGadgetUrl
(
options
.
field_type
)
,
error_text
:
options
.
field_json
.
error_text
||
''
,
error_text
:
options
.
field_json
.
error_text
||
''
,
options
:
options
,
options
:
options
,
scope
:
options
.
field_json
.
key
,
scope
:
options
.
field_json
.
key
,
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
View file @
b89114c1
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
961.
17833.11141.14523
</string>
</value>
<value>
<string>
961.
46539.43459.6519
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
150
2198959.61
</float>
<float>
150
3932157.58
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
View file @
b89114c1
...
@@ -50,13 +50,13 @@
...
@@ -50,13 +50,13 @@
gadget
.
props
.
cell_gadget_list
=
[];
gadget
.
props
.
cell_gadget_list
=
[];
function
renderSubCell
(
element
,
sub_field_json
)
{
function
renderSubCell
(
element
,
sub_field_json
)
{
sub_field_json
.
editable
=
sub_field_json
.
editable
&&
gadget
.
state
.
editable
;
// XXX
sub_field_json
.
editable
=
sub_field_json
.
editable
&&
gadget
.
state
.
editable
;
// XXX
return
gadget
.
getFieldTypeGadgetUrl
(
sub_field_json
.
type
)
return
gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
element
:
element
,
scope
:
sub_field_json
.
key
})
.
push
(
function
(
gadget_url
)
{
return
gadget
.
declareGadget
(
gadget_url
,
{
element
:
element
});
})
.
push
(
function
(
cell_gadget
)
{
.
push
(
function
(
cell_gadget
)
{
gadget
.
props
.
cell_gadget_list
.
push
(
cell_gadget
);
gadget
.
props
.
cell_gadget_list
.
push
(
cell_gadget
);
return
cell_gadget
.
render
({
field_json
:
sub_field_json
});
return
cell_gadget
.
render
({
field_type
:
sub_field_json
.
type
,
field_json
:
sub_field_json
,
label
:
false
});
});
});
}
}
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
...
@@ -144,7 +144,6 @@
...
@@ -144,7 +144,6 @@
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getFieldTypeGadgetUrl
"
,
"
getFieldTypeGadgetUrl
"
)
.
declareAcquiredMethod
(
"
renderEditorPanel
"
,
"
renderEditorPanel
"
)
.
declareAcquiredMethod
(
"
renderEditorPanel
"
,
"
renderEditorPanel
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
.
declareAcquiredMethod
(
"
translate
"
,
"
translate
"
)
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
b89114c1
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
0.57664.50157.3293
</string>
</value>
<value>
<string>
96
1.37896.32571.61832
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
150
0656708.46
</float>
<float>
150
3406544.43
</float>
<string>
UTC
</string>
<string>
UTC
</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