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
f4e03d67
Commit
f4e03d67
authored
Nov 09, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Nov 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] LinesField works in non-editable mode
/#/bug_module/20171103-82F24A /reviewed-on
nexedi/erp5!489
parent
4c925ae7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
71 deletions
+63
-71
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
...lateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
+30
-56
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_textareafield_js.js
...eItem/web_page_module/rjs_gadget_erp5_textareafield_js.js
+7
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_textareafield_js.xml
...Item/web_page_module/rjs_gadget_erp5_textareafield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testDialogLinesField.zpt
...ts/renderjs_ui_lines_field_zuite/testDialogLinesField.zpt
+8
-5
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testEmptyLine.zpt
...tal_tests/renderjs_ui_lines_field_zuite/testEmptyLine.zpt
+14
-6
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
View file @
f4e03d67
...
@@ -8,79 +8,53 @@
...
@@ -8,79 +8,53 @@
return
lines
;
return
lines
;
}
}
function
listToBR
(
lines
)
{
if
(
Array
.
isArray
(
lines
))
{
return
lines
.
join
(
"
<br/>
\n
"
);
}
return
lines
;
}
rJS
(
window
)
rJS
(
window
)
.
setState
({
.
declareMethod
(
'
render
'
,
function
(
options
)
{
gadget_rendered
:
false
return
this
.
changeState
(
options
.
field_json
);
})
})
.
onStateChange
(
function
(
modification_dict
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
,
url
,
new_state
=
{
value
;
"
default
"
:
listToNewlines
(
options
.
field_json
.
default
),
"
editable
"
:
options
.
field_json
.
editable
,
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
"
required
"
:
options
.
field_json
.
required
,
if
(
gadget
.
state
.
editable
)
{
"
hidden
"
:
options
.
field_json
.
hidden
,
url
=
'
gadget_html5_textarea.html
'
;
"
title
"
:
options
.
field_json
.
title
,
value
=
listToNewlines
(
gadget
.
state
.
value
||
gadget
.
state
.
default
||
[]);
"
key
"
:
options
.
field_json
.
key
}
else
{
};
url
=
'
gadget_html5_element.html
'
;
value
=
listToBR
(
gadget
.
state
.
value
||
gadget
.
state
.
default
||
[]);
if
(
this
.
state
.
gadget_rendered
===
false
)
{
}
return
gadget
.
declareGadget
(
"
gadget_erp5_field_textarea.html
"
,
{
scope
:
'
sub
'
})
return
this
.
declareGadget
(
url
,
{
scope
:
'
sub
'
})
.
push
(
function
(
subgadget
)
{
.
push
(
function
(
sub_gadget
)
{
gadget
.
element
.
appendChild
(
subgadget
.
element
);
// Clear first to DOM, append after to reduce flickering/manip
new_state
.
gadget_rendered
=
true
;
while
(
gadget
.
element
.
firstChild
)
{
return
gadget
.
changeState
(
new_state
);
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
gadget
.
element
.
appendChild
(
sub_gadget
.
element
);
// Use full-blown render when the widget is new
return
sub_gadget
.
render
({
value
:
value
,
name
:
gadget
.
state
.
key
,
editable
:
gadget
.
state
.
editable
,
required
:
gadget
.
state
.
required
,
title
:
gadget
.
state
.
title
,
hidden
:
gadget
.
state
.
hidden
});
});
});
}
}
return
this
.
changeState
(
new_state
);
})
return
gadget
.
getDeclaredGadget
(
'
sub
'
)
.
onStateChange
(
function
()
{
.
push
(
function
(
input
)
{
var
gadget
=
this
;
if
(
modification_dict
.
hasOwnProperty
(
"
value
"
))
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
if
(
gadget
.
state
.
editable
)
{
.
push
(
function
(
subgadget
)
{
modification_dict
.
value
=
listToNewlines
(
modification_dict
.
value
);
return
subgadget
.
render
({
field_json
:
gadget
.
state
});
}
else
{
modification_dict
.
value
=
listToBR
(
modification_dict
.
value
);
}
}
// when we only receive changes we can simply pass (minimaly modified) modification dictionary
return
input
.
render
(
modification_dict
);
});
});
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
var
gadget
=
this
;
return
this
.
getDeclaredGadget
(
'
sub
'
)
return
gadget
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
sub_gadget
)
{
.
push
(
function
(
sub_gadget
)
{
return
sub_gadget
.
getContent
();
return
sub_gadget
.
getContent
();
});
});
})
})
.
declareMethod
(
'
checkValidity
'
,
function
()
{
.
declareMethod
(
'
checkValidity
'
,
function
()
{
if
(
this
.
state
.
editable
)
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
return
this
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
gadget
)
{
.
push
(
function
(
sub
gadget
)
{
return
gadget
.
checkValidity
();
return
sub
gadget
.
checkValidity
();
});
});
}
return
true
;
});
});
}(
window
,
rJS
));
}(
window
,
rJS
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
View file @
f4e03d67
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
1.56527.16709.20804
</string>
</value>
<value>
<string>
96
3.41690.30150.51729
</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>
151
0071879.23
</float>
<float>
151
1408348.35
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_textareafield_js.js
View file @
f4e03d67
...
@@ -50,6 +50,13 @@
...
@@ -50,6 +50,13 @@
});
});
})
})
.
declareMethod
(
'
checkValidity
'
,
function
()
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
subgadget
)
{
return
subgadget
.
checkValidity
();
});
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
if
(
this
.
state
.
editable
)
{
if
(
this
.
state
.
editable
)
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
return
this
.
getDeclaredGadget
(
'
sub
'
)
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_textareafield_js.xml
View file @
f4e03d67
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
54.45675.44850.53452
</string>
</value>
<value>
<string>
9
60.5523.58984.43537
</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>
1
479375229.95
</float>
<float>
1
511311791.54
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testDialogLinesField.zpt
View file @
f4e03d67
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
<td>
//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//textarea
</td><td></td></tr>
<td>
//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//textarea
</td><td></td></tr>
<tr><td>
type
</td>
<tr><td>
type
</td>
<td>
field_my_lines_list
</td>
<td>
field_my_lines_list
</td>
<td>
foo
<br/>
bar
</td></tr>
<td>
foo
<br/>
<!-- tags and comments get stripped away -->
bar
</td></tr>
<!-- Change sorting of the listbox -->
<!-- Change sorting of the listbox -->
<tr><td>
waitForElementPresent
</td>
<tr><td>
waitForElementPresent
</td>
...
@@ -32,7 +33,8 @@
...
@@ -32,7 +33,8 @@
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr><td>
assertValue
</td>
<tr><td>
assertValue
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
foo
<br/>
bar
</td></tr>
<td>
foo
<br/>
bar
</td></tr>
<!-- Save and force unloading of Form and its content from the memory by going back -->
<!-- Save and force unloading of Form and its content from the memory by going back -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
...
@@ -49,10 +51,12 @@
...
@@ -49,10 +51,12 @@
<!-- Assert value still holds and change it -->
<!-- Assert value still holds and change it -->
<tr><td>
assertValue
</td>
<tr><td>
assertValue
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
foo
<br/>
bar
</td></tr>
<td>
foo
<br/>
bar
</td></tr>
<tr><td>
assertValue
</td>
<tr><td>
assertValue
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
foo
<br/>
bar
</td></tr>
<td>
foo
<br/>
bar
</td></tr>
<tr><td>
type
</td>
<tr><td>
type
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
//textarea[@name='field_my_lines_list']
</td>
<td>
foo bar
</td></tr>
<td>
foo bar
</td></tr>
...
@@ -68,7 +72,6 @@
...
@@ -68,7 +72,6 @@
<!-- Save and force unloading of Form and its content from the memory by going back -->
<!-- Save and force unloading of Form and its content from the memory by going back -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<tr><td>
click
</td>
<tr><td>
click
</td>
<td>
//div[@data-role='header']//h1/a
</td><td></td></tr>
<td>
//div[@data-role='header']//h1/a
</td><td></td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testEmptyLine.zpt
View file @
f4e03d67
...
@@ -25,12 +25,7 @@
...
@@ -25,12 +25,7 @@
<td>
a
<td>
a
b
b
</td></tr>
</td></tr>
<tr><td>
waitForElementPresent
</td>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<td>
//button[@data-i18n='Save']
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//button[@data-i18n='Save']
</td><td></td></tr>
<tr><td>
waitForTextPresent
</td>
<td>
Data updated.
</td><td></td></tr>
<!-- Force unloading of Form and its content from the memory by going back -->
<!-- Force unloading of Form and its content from the memory by going back -->
<tr><td>
click
</td>
<tr><td>
click
</td>
<td>
//div[@data-role='header']//h1/a
</td><td></td></tr>
<td>
//div[@data-role='header']//h1/a
</td><td></td></tr>
...
@@ -46,5 +41,18 @@ b
...
@@ -46,5 +41,18 @@ b
<td>
a
<td>
a
b
b
</td></tr>
</td></tr>
<tr><td>
click
</td>
<td>
//button[@name='panel']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url="${renderjs_url}/gadget_erp5_panel.html"]//input[@name='editable' and @type='checkbox']
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//div[@data-gadget-url="${renderjs_url}/gadget_erp5_panel.html"]//input[@name='editable' and @type='checkbox']
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//div[@data-gadget-url="${renderjs_url}/gadget_html5_element.html"]/pre
</td><td></td></tr>
<tr><td>
assertText
</td>
<td>
//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_lines.html"]//div[@data-gadget-url="${renderjs_url}/gadget_html5_element.html"]/pre
</td>
<td>
a
b
</td></tr>
</body>
</body>
</html>
</html>
\ 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