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
Xavier Thompson
erp5
Commits
cc56ac36
Commit
cc56ac36
authored
May 21, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Disable listbox button by default
Forbid click if the event listener is not activated yet
parent
2e760fba
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
10 deletions
+47
-10
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html
...ateItem/web_page_module/rjs_gadget_erp5_listbox_html.html
+3
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.xml
...lateItem/web_page_module/rjs_gadget_erp5_listbox_html.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
+30
-3
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
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/Zuite_CommonTemplateForRenderjsUi.zpt
...eb_renderjs_ui_test/Zuite_CommonTemplateForRenderjsUi.zpt
+10
-0
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html
View file @
cc56ac36
...
@@ -193,9 +193,9 @@
...
@@ -193,9 +193,9 @@
<script
id=
"listbox-template"
type=
"text/x-handlebars-template"
>
<script
id=
"listbox-template"
type=
"text/x-handlebars-template"
>
<
div
class
=
"
ui-table-header ui-header ui-bar-c ui-corner-all
"
>
<
div
class
=
"
ui-table-header ui-header ui-bar-c ui-corner-all
"
>
<
h1
data
-
i18n
=
"
{{title}}
"
class
=
"
ui-title ui-override-theme
"
>
{{
title
}}
<
span
>
<
span
class
=
"
listboxloader ui-icon-spinner ui-btn-icon-left
"
><
/span></
span
><
/h1
>
<
h1
data
-
i18n
=
"
{{title}}
"
class
=
"
ui-title ui-override-theme
"
>
{{
title
}}
<
span
>
<
span
class
=
"
listboxloader ui-icon-spinner ui-btn-icon-left
"
><
/span></
span
><
/h1
>
<
button
data
-
rel
=
"
hide
"
data
-
i18n
=
"
{{hide_button_text}}
"
name
=
"
{{hide_button_name}}
"
type
=
"
button
"
class
=
"
submit responsive ui-last-child ui-btn ui-icon-low-vision ui-btn-icon-left {{hide_class}}
"
>
{{
hide_button_text
}}
<
/button
>
<
button
{{
disabled
}}
data
-
rel
=
"
hide
"
data
-
i18n
=
"
{{hide_button_text}}
"
name
=
"
{{hide_button_name}}
"
type
=
"
button
"
class
=
"
submit responsive ui-last-child ui-btn ui-icon-low-vision ui-btn-icon-left {{hide_class}}
"
>
{{
hide_button_text
}}
<
/button
>
<
button
data
-
rel
=
"
configure_columns
"
data
-
i18n
=
"
Configure
"
name
=
"
Configure
"
type
=
"
button
"
class
=
"
submit responsive ui-last-child ui-btn ui-icon-wrench ui-btn-icon-left {{configure_class}}
"
>
Configure
<
/button
>
<
button
{{
disabled
}}
data
-
rel
=
"
configure_columns
"
data
-
i18n
=
"
Configure
"
name
=
"
Configure
"
type
=
"
button
"
class
=
"
submit responsive ui-last-child ui-btn ui-icon-wrench ui-btn-icon-left {{configure_class}}
"
>
Configure
<
/button
>
<
button
data
-
rel
=
"
Sort
"
data
-
i18n
=
"
Sort
"
name
=
"
Sort
"
type
=
"
button
"
class
=
"
submit responsive ui-last-child ui-btn ui-icon-sort-amount-desc ui-btn-icon-left {{sort_class}}
"
>
Sort
<
/button
>
<
button
{{
disabled
}}
data
-
rel
=
"
Sort
"
data
-
i18n
=
"
Sort
"
name
=
"
Sort
"
type
=
"
button
"
class
=
"
submit responsive ui-last-child ui-btn ui-icon-sort-amount-desc ui-btn-icon-left {{sort_class}}
"
>
Sort
<
/button
>
<
/div
>
<
/div
>
<
table
class
=
"
ui-responsive ui-body-c ui-table-inset
"
>
<
table
class
=
"
ui-responsive ui-body-c ui-table-inset
"
>
<
thead
class
=
"
ui-bar-inherit thead
"
><
/thead
>
<
thead
class
=
"
ui-bar-inherit thead
"
><
/thead
>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.xml
View file @
cc56ac36
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
967.
24634.17714.15001
</string>
</value>
<value>
<string>
967.
44841.15161.33928
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1526
286250.56
</float>
<float>
1526
894643.05
</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 @
cc56ac36
...
@@ -129,6 +129,7 @@
...
@@ -129,6 +129,7 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// ready
// ready
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
setState
({
disabled
:
true
})
// Init local properties
// Init local properties
.
ready
(
function
()
{
.
ready
(
function
()
{
this
.
props
=
{
this
.
props
=
{
...
@@ -316,7 +317,11 @@
...
@@ -316,7 +317,11 @@
sort_column_list
,
sort_column_list
,
i
,
i
,
j
,
j
,
result_queue
=
new
RSVP
.
Queue
();
result_queue
=
new
RSVP
.
Queue
(),
button_selector_list
=
[
'
button[name="Sort"]
'
,
'
button[name="Hide"]
'
,
'
button[name="Configure"]
'
,
'
button[name="SelectRows"]
'
],
button
;
/*
/*
if (modification_dict.hasOwnProperty('error_text') && this.state.error_text !== undefined) {
if (modification_dict.hasOwnProperty('error_text') && this.state.error_text !== undefined) {
...
@@ -348,7 +353,16 @@
...
@@ -348,7 +353,16 @@
});
});
}
}
if
(
modification_dict
.
hasOwnProperty
(
'
disabled
'
))
{
// Mark buttons as enabled/disabled
// so that Zelenium can explicitely wait for enabled button
for
(
i
=
0
;
i
<
button_selector_list
.
length
;
i
+=
1
)
{
button
=
gadget
.
element
.
querySelector
(
button_selector_list
[
i
]);
if
(
button
!==
null
)
{
button
.
disabled
=
gadget
.
state
.
disabled
;
}
}
}
if
((
modification_dict
.
hasOwnProperty
(
'
sort_list_json
'
))
||
if
((
modification_dict
.
hasOwnProperty
(
'
sort_list_json
'
))
||
(
modification_dict
.
hasOwnProperty
(
'
column_list_json
'
))
||
(
modification_dict
.
hasOwnProperty
(
'
column_list_json
'
))
||
...
@@ -426,7 +440,8 @@
...
@@ -426,7 +440,8 @@
configure_class
:
gadget
.
state
.
configure_class
,
configure_class
:
gadget
.
state
.
configure_class
,
title
:
gadget
.
state
.
title
,
title
:
gadget
.
state
.
title
,
hide_button_text
:
hide_button_text
,
hide_button_text
:
hide_button_text
,
hide_button_name
:
hide_button_name
hide_button_name
:
hide_button_name
,
disabled
:
gadget
.
state
.
disabled
?
'
disabled
'
:
''
})),
})),
gadget
.
translateHtml
(
listbox_thead_template
({
gadget
.
translateHtml
(
listbox_thead_template
({
head_value
:
head_value_list
,
head_value
:
head_value_list
,
...
@@ -819,6 +834,12 @@
...
@@ -819,6 +834,12 @@
},
{
mutex
:
'
changestate
'
})
},
{
mutex
:
'
changestate
'
})
.
onEvent
(
'
click
'
,
function
click
(
evt
)
{
.
onEvent
(
'
click
'
,
function
click
(
evt
)
{
// For some reason, Zelenium can click even if button has the disabled
// attribute. So, it is needed for now to manually checks
if
(
this
.
state
.
disabled
)
{
return
;
}
var
gadget
=
this
,
var
gadget
=
this
,
sort_button
=
gadget
.
element
.
querySelector
(
'
button[name="Sort"]
'
),
sort_button
=
gadget
.
element
.
querySelector
(
'
button[name="Sort"]
'
),
hide_button
=
gadget
.
element
.
querySelector
(
'
button[name="Hide"]
'
),
hide_button
=
gadget
.
element
.
querySelector
(
'
button[name="Hide"]
'
),
...
@@ -905,6 +926,12 @@
...
@@ -905,6 +926,12 @@
},
false
,
false
)
},
false
,
false
)
.
declareService
(
function
enableButton
()
{
// click event listener is now activated
// Change the state of the gadget
return
this
.
changeState
({
disabled
:
false
});
})
.
allowPublicAcquisition
(
"
notifyInvalid
"
,
function
notifyInvalid
()
{
.
allowPublicAcquisition
(
"
notifyInvalid
"
,
function
notifyInvalid
()
{
return
;
return
;
})
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
cc56ac36
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
967.
35176.12886.11639
</string>
</value>
<value>
<string>
967.
44855.43962.32563
</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>
1526
654510.2
</float>
<float>
1526
894963.13
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/Zuite_CommonTemplateForRenderjsUi.zpt
View file @
cc56ac36
...
@@ -624,6 +624,11 @@
...
@@ -624,6 +624,11 @@
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Sort']</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Sort']</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Sort' and @disabled]</td>
<td></td>
</tr>
<tr>
<tr>
<td>click</td>
<td>click</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Sort']</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Sort']</td>
...
@@ -791,6 +796,11 @@
...
@@ -791,6 +796,11 @@
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Configure']</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Configure']</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Configure' and @disabled]</td>
<td></td>
</tr>
<tr>
<tr>
<td>click</td>
<td>click</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Configure']</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//button[@data-i18n='Configure']</td>
...
...
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