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
Frederic Thoma
erp5
Commits
0c945082
Commit
0c945082
authored
Aug 09, 2021
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: use more domsugar API instead of appendChild from DOM API
parent
ffdc1a45
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
248 additions
and
232 deletions
+248
-232
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
+1
-0
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
+3
-3
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
+242
-227
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_listbox_html.html
View file @
0c945082
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"interface_erp5_form_content_provider.html"
>
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"interface_erp5_form_content_provider.html"
>
<!-- renderjs -->
<!-- renderjs -->
<script
src=
"domsugar.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"jiodev.js"
type=
"text/javascript"
></script>
<script
src=
"jiodev.js"
type=
"text/javascript"
></script>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.xml
View file @
0c945082
...
@@ -224,7 +224,7 @@
...
@@ -224,7 +224,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
georg
e
</string>
</value>
<value>
<string>
zop
e
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -238,7 +238,7 @@
...
@@ -238,7 +238,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
86.65426.46809.56012
</string>
</value>
<value>
<string>
9
93.55171.44758.6877
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -256,7 +256,7 @@
...
@@ -256,7 +256,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
01544175.96
</float>
<float>
16
28545474.29
</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 @
0c945082
/*jslint indent: 2, maxerr: 3, nomen: true */
/*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, document, rJS, URI, RSVP, isEmpty, console*/
/*global window, document, rJS, URI, RSVP, isEmpty, console
, domsugar
*/
(
function
(
window
,
document
,
rJS
,
URI
,
RSVP
,
isEmpty
,
console
)
{
(
function
(
window
,
document
,
rJS
,
URI
,
RSVP
,
isEmpty
,
console
,
domsugar
)
{
"
use strict
"
;
"
use strict
"
;
var
variable
=
{},
var
variable
=
{},
...
@@ -85,102 +85,118 @@
...
@@ -85,102 +85,118 @@
{{/each}}
{{/each}}
</tbody>
</tbody>
*/
*/
var
tbody_element
=
document
.
createElement
(
'
tbody
'
),
var
i
,
i
,
j
,
j
,
row
,
row
,
cell
,
cell
,
tr_element
,
element_data
,
td_element
,
sub_element
,
sub_element
,
a_element
;
a_element
,
sub_element_list
,
td_element_list
,
tr_element_list
=
[];
for
(
i
=
0
;
i
<
options
.
row_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
options
.
row_list
.
length
;
i
+=
1
)
{
t
r_element
=
document
.
createElement
(
'
tr
'
)
;
t
d_element_list
=
[]
;
row
=
options
.
row_list
[
i
];
row
=
options
.
row_list
[
i
];
if
(
options
.
show_anchor
)
{
if
(
options
.
show_anchor
)
{
td_element
=
document
.
createElement
(
'
td
'
);
td_element
_list
.
push
(
domsugar
(
'
td
'
,
[
sub_element
=
document
.
createElement
(
'
a
'
);
domsugar
(
'
a
'
,
{
sub_element
.
setAttribute
(
'
class
'
,
'
ui-icon-carat-r ui-btn-icon-notext
'
);
"
class
"
:
'
ui-icon-carat-r ui-btn-icon-notext
'
,
sub_element
.
href
=
row
.
jump
;
"
href
"
:
row
.
jump
,
sub_element
.
textContent
=
'
'
;
"
text
"
:
'
'
td_element
.
appendChild
(
sub_element
);
})
tr_element
.
appendChild
(
td_element
);
])
);
}
}
for
(
j
=
0
;
j
<
row
.
cell_list
.
length
;
j
+=
1
)
{
for
(
j
=
0
;
j
<
row
.
cell_list
.
length
;
j
+=
1
)
{
cell
=
row
.
cell_list
[
j
];
cell
=
row
.
cell_list
[
j
];
td_element
=
document
.
createElement
(
'
td
'
)
;
sub_element_list
=
[]
;
if
(
options
.
show_line_selector
||
(
options
.
form_id
===
'
form_dialog
'
&&
options
.
show_select
))
{
if
(
options
.
show_line_selector
||
(
options
.
form_id
===
'
form_dialog
'
&&
options
.
show_select
))
{
if
(
j
===
0
)
{
if
(
j
===
0
)
{
// If first cell, show a checkbox to select the line
element_data
=
{
sub_element
=
document
.
createElement
(
'
input
'
);
"
data-uid
"
:
row
.
uid
,
sub_element
.
setAttribute
(
'
data-uid
'
,
row
.
uid
);
"
type
"
:
"
checkbox
"
,
sub_element
.
setAttribute
(
'
type
'
,
'
checkbox
'
);
"
class
"
:
"
hide_element
"
,
sub_element
.
setAttribute
(
'
class
'
,
'
hide_element
'
);
"
id
"
:
'
listbox_line_
'
+
row
.
uid
sub_element
.
setAttribute
(
'
id
'
,
'
listbox_line_
'
+
row
.
uid
)
;
}
;
if
(
row
.
checked
)
{
if
(
row
.
checked
)
{
sub_element
.
setAttribute
(
'
checked
'
,
'
checked
'
)
;
element_data
.
checked
=
'
checked
'
;
}
}
td_element
.
appendChild
(
sub_element
);
// If first cell, show a checkbox to select the line
sub_element_list
.
push
(
domsugar
(
'
input
'
,
element_data
));
}
}
element_data
=
{
"
for
"
:
'
listbox_line_
'
+
row
.
uid
};
// Create a label, to update the checkbox when clicking the text
// Create a label, to update the checkbox when clicking the text
sub_element
=
document
.
createElement
(
'
label
'
);
sub_element
.
setAttribute
(
'
for
'
,
'
listbox_line_
'
+
row
.
uid
);
if
(
cell
.
type
)
{
if
(
cell
.
type
)
{
sub_element
.
setAttribute
(
'
class
'
,
'
editable_div
'
)
;
element_data
[
"
class
"
]
=
'
editable_div
'
;
sub_element
.
setAttribute
(
'
data-column
'
,
cell
.
column
)
;
element_data
[
'
data-column
'
]
=
cell
.
column
;
sub_element
.
setAttribute
(
'
data-line
'
,
cell
.
line
)
;
element_data
[
'
data-line
'
]
=
cell
.
line
;
}
else
{
}
else
{
sub_element
.
textContent
=
cell
.
default
;
element_data
.
text
=
cell
[
"
default
"
]
;
}
}
td_element
.
appendChild
(
sub_element
);
sub_element_list
.
push
(
domsugar
(
'
label
'
,
element_data
)
);
}
else
{
}
else
{
if
(
cell
.
type
)
{
if
(
cell
.
type
)
{
sub_element
=
document
.
createElement
(
'
div
'
);
sub_element
=
domsugar
(
'
div
'
,
{
sub_element
.
setAttribute
(
'
class
'
,
'
editable_div
'
);
'
class
'
:
'
editable_div
'
,
sub_element
.
setAttribute
(
'
data-column
'
,
cell
.
column
);
'
data-column
'
:
cell
.
column
,
sub_element
.
setAttribute
(
'
data-line
'
,
cell
.
line
);
'
data-line
'
:
cell
.
line
});
if
(
cell
.
editable
||
!
cell
.
href
)
{
if
(
cell
.
editable
||
!
cell
.
href
)
{
td_element
.
appendChild
(
sub_element
);
sub_element_list
.
push
(
sub_element
);
}
else
{
}
else
{
a_element
=
do
cument
.
createElement
(
'
a
'
);
a_element
=
do
msugar
(
'
a
'
,
{
a_element
.
href
=
cell
.
href
;
"
href
"
:
cell
.
href
a_element
.
appendChild
(
sub_element
);
},
[
sub_element
]
);
td_element
.
appendChild
(
a_element
);
sub_element_list
.
push
(
a_element
);
}
}
}
else
{
}
else
{
if
(
cell
.
href
)
{
if
(
cell
.
href
)
{
sub_element
=
document
.
createElement
(
'
a
'
);
sub_element
=
domsugar
(
'
a
'
,
{
sub_element
.
href
=
cell
.
href
;
"
href
"
:
cell
.
href
,
"
text
"
:
cell
[
"
default
"
]
});
}
else
{
}
else
{
sub_element
=
document
.
createElement
(
'
p
'
);
sub_element
=
domsugar
(
'
p
'
,
{
"
text
"
:
cell
[
"
default
"
]
});
}
}
sub_element
.
textContent
=
cell
.
default
;
sub_element_list
.
push
(
sub_element
);
td_element
.
appendChild
(
sub_element
);
}
}
}
}
td_element_list
.
push
(
tr_element
.
appendChild
(
td_element
);
domsugar
(
'
td
'
,
sub_element_list
)
);
}
}
if
(
row
.
line_icon
)
{
if
(
row
.
line_icon
)
{
td_element
=
document
.
createElement
(
'
td
'
);
td_element_list
.
push
(
sub_element
=
document
.
createElement
(
'
a
'
);
domsugar
(
'
td
'
,
[
sub_element
.
setAttribute
(
'
class
'
,
'
ui-btn-icon-right ui-icon-sign-in
'
);
domsugar
(
'
a
'
,
{
sub_element
.
href
=
row
.
jump
;
'
class
'
:
'
ui-btn-icon-right ui-icon-sign-in
'
,
td_element
.
appendChild
(
sub_element
);
'
href
'
:
row
.
jump
tr_element
.
appendChild
(
td_element
);
})
])
);
}
}
tbody_element
.
appendChild
(
tr_element
);
tr_element_list
.
push
(
domsugar
(
'
tr
'
,
td_element_list
)
);
}
}
return
tbody_element
;
return
domsugar
(
'
tbody
'
,
tr_element_list
)
;
}
}
function
listbox_tfoot_template
(
options
)
{
function
listbox_tfoot_template
(
options
)
{
...
@@ -212,43 +228,55 @@
...
@@ -212,43 +228,55 @@
{{/each}}
{{/each}}
</tfoot>
</tfoot>
*/
*/
var
tfoot_element
=
document
.
createElement
(
'
tfoot
'
),
var
i
,
i
,
j
,
j
,
row
,
row
,
cell
,
cell
,
tr_element
,
sub_element_list
,
td_element
,
tfoot_element_list
=
[],
div_element
;
div_element
,
td_element_list
,
td_data
;
for
(
i
=
0
;
i
<
options
.
row_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
options
.
row_list
.
length
;
i
+=
1
)
{
tr_element
=
document
.
createElement
(
'
tr
'
);
td_element_list
=
[];
if
(
options
.
show_anchor
)
{
if
(
options
.
show_anchor
)
{
td_element
=
document
.
createElement
(
'
td
'
);
td_element_list
.
push
(
td_element
.
textContent
=
'
Total
'
;
domsugar
(
'
td
'
,
{
tr_element
.
appendChild
(
td_element
);
"
text
"
:
'
Total
'
})
);
}
}
row
=
options
.
row_list
[
i
];
row
=
options
.
row_list
[
i
];
for
(
j
=
0
;
j
<
row
.
cell_list
.
length
;
j
+=
1
)
{
for
(
j
=
0
;
j
<
row
.
cell_list
.
length
;
j
+=
1
)
{
sub_element_list
=
[];
td_data
=
{};
cell
=
row
.
cell_list
[
j
];
cell
=
row
.
cell_list
[
j
];
td_element
=
document
.
createElement
(
'
td
'
);
if
(
cell
.
type
)
{
if
(
cell
.
type
)
{
div_element
=
document
.
createElement
(
'
div
'
);
div_element
=
domsugar
(
'
div
'
,
{
div_element
.
setAttribute
(
'
class
'
,
'
editable_div
'
);
'
class
'
:
'
editable_div
'
,
div_element
.
setAttribute
(
'
data-column
'
,
cell
.
column
);
'
data-column
'
:
cell
.
column
,
div_element
.
setAttribute
(
'
data-line
'
,
cell
.
line
);
'
data-line
'
:
cell
.
line
td_element
.
appendChild
(
div_element
);
});
sub_element_list
.
push
(
div_element
);
}
else
{
}
else
{
if
(
cell
.
default
)
{
if
(
cell
[
"
default
"
]
)
{
td_
element
.
textContent
=
cell
.
default
;
td_
data
.
text
=
cell
[
"
default
"
]
;
}
else
if
((
!
options
.
show_anchor
)
&&
(
j
===
0
))
{
}
else
if
((
!
options
.
show_anchor
)
&&
(
j
===
0
))
{
td_
element
.
textConten
t
=
'
Total
'
;
td_
data
.
tex
t
=
'
Total
'
;
}
}
}
}
tr_element
.
appendChild
(
td_element
);
td_element_list
.
push
(
domsugar
(
'
td
'
,
td_data
,
sub_element_list
)
);
}
}
tfoot_element
.
appendChild
(
tr_element
);
tfoot_element_list
.
push
(
domsugar
(
'
tr
'
,
td_element_list
)
);
}
}
return
tfoot_element
;
return
domsugar
(
'
tfoot
'
,
tfoot_element_list
)
;
}
}
function
renderSubField
(
gadget
,
element
,
sub_field_json
)
{
function
renderSubField
(
gadget
,
element
,
sub_field_json
)
{
...
@@ -582,30 +610,20 @@
...
@@ -582,30 +610,20 @@
</a>
</a>
</div>
</div>
*/
*/
var
container
=
gadget
.
element
.
querySelector
(
"
.document_table
"
),
return
domsugar
(
gadget
.
element
.
querySelector
(
"
.document_table
"
),
[
div_element
=
document
.
createElement
(
'
div
'
),
domsugar
(
'
div
'
,
[
a_element
=
document
.
createElement
(
'
a
'
),
domsugar
(
'
a
'
,
{
span_element
;
"
href
"
:
result_list
[
0
]
a_element
.
href
=
result_list
[
0
];
},
[
domsugar
(
'
span
'
,
{
span_element
=
document
.
createElement
(
'
span
'
);
'
class
'
:
'
ui-info-error
'
,
span_element
.
setAttribute
(
'
class
'
,
'
ui-info-error
'
);
'
text
'
:
result_list
[
1
][
0
]
span_element
.
textContent
=
result_list
[
1
][
0
];
}),
a_element
.
appendChild
(
span_element
);
domsugar
(
'
span
'
,
{
"
text
"
:
'
-
'
}),
domsugar
(
'
span
'
,
{
"
text
"
:
result_list
[
1
][
1
]})
span_element
=
document
.
createElement
(
'
span
'
);
])
span_element
.
textContent
=
'
-
'
;
])
a_element
.
appendChild
(
span_element
);
]);
span_element
=
document
.
createElement
(
'
span
'
);
span_element
.
textContent
=
result_list
[
1
][
1
];
a_element
.
appendChild
(
span_element
);
div_element
.
appendChild
(
a_element
);
while
(
container
.
firstChild
)
{
container
.
removeChild
(
container
.
firstChild
);
}
container
.
appendChild
(
div_element
);
});
});
}
}
...
@@ -707,139 +725,142 @@
...
@@ -707,139 +725,142 @@
url_for_index
=
0
,
url_for_index
=
0
,
column
,
column
,
current_sort
,
current_sort
,
fragment
=
document
.
createDocumentFragment
(),
div_element_list
=
[
div_element
=
document
.
createElement
(
'
div
'
),
domsugar
(
'
h1
'
,
{
table_element
=
document
.
createElement
(
'
table
'
),
// For an unknown reason, the title used to be translated previously,
button_element
,
// which is unexpected, as the value can't be hardcoded in the gadget
h1_element
=
document
.
createElement
(
'
h1
'
),
// <h1>{{title}} <span class="listboxloader ui-icon-spinner ui-btn-icon-left"></span></h1>
span_element
=
document
.
createElement
(
'
span
'
),
"
text
"
:
gadget
.
state
.
title
+
'
'
},
[
domsugar
(
'
span
'
,
{
"
class
"
:
'
listboxloader ui-icon-spinner ui-btn-icon-left
'
})
])
],
table_element
=
domsugar
(
'
table
'
,
[
domsugar
(
"
thead
"
,
{
"
class
"
:
"
thead
"
},
[
domsugar
(
"
tr
"
)
]),
domsugar
(
"
tbody
"
),
domsugar
(
"
tfoot
"
)
]),
th_element_list
=
[],
tr_element
,
tr_element
,
th_element
,
th_element
;
a_element
;
div_element
.
setAttribute
(
'
class
'
,
'
ui-table-header ui-header
'
);
// For an unknown reason, the title used to be translated previously,
// which is unexpected, as the value can't be hardcoded in the gadget
// <h1>{{title}} <span class="listboxloader ui-icon-spinner ui-btn-icon-left"></span></h1>
h1_element
.
textContent
=
gadget
.
state
.
title
+
'
'
;
span_element
.
setAttribute
(
'
class
'
,
'
listboxloader ui-icon-spinner ui-btn-icon-left
'
);
h1_element
.
appendChild
(
span_element
);
div_element
.
appendChild
(
h1_element
);
if
(
gadget
.
state
.
show_select_action
)
{
if
(
gadget
.
state
.
show_select_action
)
{
for
(
k
=
0
;
k
<
select_option_list
.
length
;
k
+=
1
)
{
for
(
k
=
0
;
k
<
select_option_list
.
length
;
k
+=
1
)
{
// Add include button
// Add include button
// <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button>
// <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
setAttribute
(
'
data-rel
'
,
'
hide
'
);
'
data-rel
'
:
'
hide
'
,
button_element
.
setAttribute
(
'
data-select-action
'
,
select_option_list
[
k
].
action
);
'
data-select-action
'
:
select_option_list
[
k
].
action
,
button_element
.
setAttribute
(
'
name
'
,
'
SelectAction
'
);
'
name
'
:
'
SelectAction
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-
'
+
select_option_list
[
k
].
icon
+
'
ui-btn-icon-left
'
);
'
class
'
:
'
ui-icon-
'
+
select_option_list
[
k
].
icon
+
'
ui-btn-icon-left
'
,
button_element
.
textContent
=
select_option_list
[
k
].
title
;
'
text
'
:
select_option_list
[
k
].
title
div_element
.
appendChild
(
button_element
);
})
);
}
}
// Add cancel button
// Add cancel button
// <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button>
// <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
setAttribute
(
'
data-rel
'
,
'
hide
'
);
'
data-rel
'
:
'
hide
'
,
button_element
.
setAttribute
(
'
name
'
,
'
CancelSelect
'
);
'
name
'
:
'
CancelSelect
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-times ui-btn-icon-left
'
);
'
class
'
:
'
ui-icon-times ui-btn-icon-left
'
,
button_element
.
textContent
=
translation_list
[
4
];
'
text
'
:
translation_list
[
4
]
div_element
.
appendChild
(
button_element
);
})
);
}
else
if
(
gadget
.
state
.
show_clipboard_action
)
{
}
else
if
(
gadget
.
state
.
show_clipboard_action
)
{
for
(
k
=
0
;
k
<
select_option_list
.
length
;
k
+=
1
)
{
for
(
k
=
0
;
k
<
select_option_list
.
length
;
k
+=
1
)
{
// Add include button
// Add include button
// <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button>
// <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
setAttribute
(
'
data-rel
'
,
'
clipboard
'
);
'
data-rel
'
:
'
clipboard
'
,
button_element
.
setAttribute
(
'
data-clipboard-action
'
,
select_option_list
[
k
].
action
);
'
data-clipboard-action
'
:
select_option_list
[
k
].
action
,
button_element
.
setAttribute
(
'
name
'
,
'
ClipboardAction
'
);
'
name
'
:
'
ClipboardAction
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-
'
+
select_option_list
[
k
].
icon
+
'
ui-btn-icon-left
'
);
'
class
'
:
'
ui-icon-
'
+
select_option_list
[
k
].
icon
+
'
ui-btn-icon-left
'
,
button_element
.
textContent
=
select_option_list
[
k
].
title
;
'
text
'
:
select_option_list
[
k
].
title
div_element
.
appendChild
(
button_element
);
})
);
}
}
// Add cancel button
// Add cancel button
// <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button>
// <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
setAttribute
(
'
data-rel
'
,
'
hide
'
);
'
data-rel
'
:
'
hide
'
,
button_element
.
setAttribute
(
'
name
'
,
'
CancelSelect
'
);
'
name
'
:
'
CancelSelect
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-times ui-btn-icon-left
'
);
'
class
'
:
'
ui-icon-times ui-btn-icon-left
'
,
button_element
.
textContent
=
translation_list
[
4
];
'
text
'
:
translation_list
[
4
]
div_element
.
appendChild
(
button_element
);
})
);
}
else
{
}
else
{
// Add Configure button
// Add Configure button
// <button {{disabled}} data-rel="configure_columns" data-i18n="Configure" name="Configure" type="button" class="ui-icon-wrench ui-btn-icon-left {{configure_class}}"></button>
// <button {{disabled}} data-rel="configure_columns" data-i18n="Configure" name="Configure" type="button" class="ui-icon-wrench ui-btn-icon-left {{configure_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
disabled
=
gadget
.
state
.
disabled
;
'
disabled
'
:
gadget
.
state
.
disabled
,
button_element
.
setAttribute
(
'
data-rel
'
,
'
configure_columns
'
);
'
data-rel
'
:
'
configure_columns
'
,
button_element
.
setAttribute
(
'
name
'
,
'
Configure
'
);
'
name
'
:
'
Configure
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-wrench ui-btn-icon-left
'
+
gadget
.
state
.
configure_class
);
'
class
'
:
'
ui-icon-wrench ui-btn-icon-left
'
+
gadget
.
state
.
configure_class
,
button_element
.
textContent
=
translation_list
[
2
];
'
text
'
:
translation_list
[
2
]
div_element
.
appendChild
(
button_element
);
})
);
// Add Sort button
// Add Sort button
// <button {{disabled}} data-rel="Sort" data-i18n="Sort" name="Sort" type="button" class="ui-icon-sort-amount-desc ui-btn-icon-left {{sort_class}}"></button>
// <button {{disabled}} data-rel="Sort" data-i18n="Sort" name="Sort" type="button" class="ui-icon-sort-amount-desc ui-btn-icon-left {{sort_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
disabled
=
gadget
.
state
.
disabled
;
'
disabled
'
:
gadget
.
state
.
disabled
,
button_element
.
setAttribute
(
'
data-rel
'
,
'
Sort
'
);
'
data-rel
'
:
'
Sort
'
,
button_element
.
setAttribute
(
'
name
'
,
'
Sort
'
);
'
name
'
:
'
Sort
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-sort-amount-desc ui-btn-icon-left
'
+
gadget
.
state
.
sort_class
);
'
class
'
:
'
ui-icon-sort-amount-desc ui-btn-icon-left
'
+
gadget
.
state
.
sort_class
,
button_element
.
textContent
=
translation_list
[
3
];
'
text
'
:
translation_list
[
3
]
div_element
.
appendChild
(
button_element
);
})
);
// Add Do button
// Add Do button
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
setAttribute
(
'
data-rel
'
,
'
clipboard
'
);
'
disabled
'
:
gadget
.
state
.
disabled
,
button_element
.
setAttribute
(
'
name
'
,
'
Clipboard
'
);
'
data-rel
'
:
'
clipboard
'
,
button_element
.
type
=
'
button
'
;
'
name
'
:
'
Clipboard
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-list-ul ui-btn-icon-left
'
);
'
type
'
:
'
button
'
,
button_element
.
textContent
=
translation_list
[
5
];
'
class
'
:
'
ui-icon-list-ul ui-btn-icon-left
'
,
div_element
.
appendChild
(
button_element
);
'
text
'
:
translation_list
[
5
]
}));
// Add Select button
// Add Select button
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
button_element
=
document
.
createElement
(
'
button
'
);
div_element_list
.
push
(
domsugar
(
'
button
'
,
{
button_element
.
disabled
=
gadget
.
state
.
disabled
;
'
disabled
'
:
gadget
.
state
.
disabled
,
button_element
.
setAttribute
(
'
data-rel
'
,
'
hide
'
);
'
data-rel
'
:
'
hide
'
,
button_element
.
setAttribute
(
'
name
'
,
'
Hide
'
);
'
name
'
:
'
Hide
'
,
button_element
.
type
=
'
button
'
;
'
type
'
:
'
button
'
,
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-check-square-o ui-btn-icon-left
'
+
gadget
.
state
.
hide_class
);
'
class
'
:
'
ui-icon-check-square-o ui-btn-icon-left
'
+
gadget
.
state
.
hide_class
,
button_element
.
textContent
=
translation_list
[
1
];
'
text
'
:
translation_list
[
1
]
div_element
.
appendChild
(
button_element
);
})
);
}
}
fragment
.
appendChild
(
div_element
);
table_element
.
innerHTML
=
'
<thead class="thead"><tr></tr></thead><tbody></tbody><tfoot></tfoot>
'
;
tr_element
=
table_element
.
querySelector
(
'
tr
'
);
if
(
gadget
.
state
.
show_anchor
)
{
if
(
gadget
.
state
.
show_anchor
)
{
th_element
=
document
.
createElement
(
'
th
'
);
th_element_list
.
push
(
th_element
.
textContent
=
translation_list
[
0
];
domsugar
(
'
th
'
,
{
tr_element
.
appendChild
(
th_element
);
"
text
"
:
translation_list
[
0
]
})
);
}
}
for
(
k
=
0
;
k
<
column_list
.
length
;
k
+=
1
)
{
for
(
k
=
0
;
k
<
column_list
.
length
;
k
+=
1
)
{
column
=
column_list
[
k
];
column
=
column_list
[
k
];
th_element
=
do
cument
.
createElement
(
'
th
'
);
th_element
=
do
msugar
(
'
th
'
);
current_sort
=
sort_list
.
find
(
hasSameFirstItem
(
column
));
current_sort
=
sort_list
.
find
(
hasSameFirstItem
(
column
));
if
(
current_sort
!==
undefined
)
{
if
(
current_sort
!==
undefined
)
{
if
(
current_sort
[
1
]
===
'
ascending
'
)
{
if
(
current_sort
[
1
]
===
'
ascending
'
)
{
th_element
.
setAttribute
(
'
class
'
,
"
ui-icon
ui-icon-sort-amount-asc
"
);
th_element
.
classList
.
add
(
"
ui-icon
"
,
"
ui-icon-sort-amount-asc
"
);
}
else
if
(
current_sort
[
1
]
===
'
descending
'
)
{
}
else
if
(
current_sort
[
1
]
===
'
descending
'
)
{
th_element
.
setAttribute
(
'
class
'
,
"
ui-icon
ui-icon-sort-amount-desc
"
);
th_element
.
classList
.
add
(
"
ui-icon
"
,
"
ui-icon-sort-amount-desc
"
);
}
}
}
}
...
@@ -850,33 +871,34 @@
...
@@ -850,33 +871,34 @@
if
(
is_sortable_list
[
k
])
{
if
(
is_sortable_list
[
k
])
{
// <th class="{{class_value}}"><a href="{{sort_link}}">{{text}}</a></th>
// <th class="{{class_value}}"><a href="{{sort_link}}">{{text}}</a></th>
a_element
=
document
.
createElement
(
'
a
'
);
domsugar
(
th_element
,
[
a_element
.
textContent
=
column
[
1
];
domsugar
(
'
a
'
,
{
a_element
.
href
=
url_for_list
[
url_for_index
];
"
text
"
:
column
[
1
],
th_element
.
appendChild
(
a_element
);
"
href
"
:
url_for_list
[
url_for_index
]
})
]);
url_for_index
+=
1
;
url_for_index
+=
1
;
}
else
{
}
else
{
// <th class="{{class_value}}">{{text}}</th>
// <th class="{{class_value}}">{{text}}</th>
th_element
.
textContent
=
column
[
1
];
th_element
.
textContent
=
column
[
1
];
}
}
}
}
th_element_list
.
push
(
th_element
);
tr_element
.
appendChild
(
th_element
);
}
}
if
(
gadget
.
state
.
line_icon
)
{
if
(
gadget
.
state
.
line_icon
)
{
th_element
=
document
.
createElement
(
'
th
'
);
th_element_list
.
push
(
domsugar
(
'
th
'
));
tr_element
.
appendChild
(
th_element
);
}
}
fragment
.
appendChild
(
table_elemen
t
);
domsugar
(
table_element
.
querySelector
(
'
tr
'
),
th_element_lis
t
);
fragment
.
appendChild
(
document
.
createElement
(
'
nav
'
));
domsugar
(
container
,
[
domsugar
(
'
div
'
,
{
while
(
container
.
firstChild
)
{
"
class
"
:
'
ui-table-header ui-header
'
container
.
removeChild
(
container
.
firstChild
);
},
div_element_list
),
}
table_element
,
container
.
appendChild
(
fragment
);
domsugar
(
'
nav
'
)
]);
});
});
}
}
...
@@ -1046,8 +1068,6 @@
...
@@ -1046,8 +1068,6 @@
next_url
=
url_list
[
1
],
next_url
=
url_list
[
1
],
previous_classname
=
"
ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child
"
,
previous_classname
=
"
ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child
"
,
next_classname
=
"
ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child
"
,
next_classname
=
"
ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child
"
,
fragment
=
document
.
createDocumentFragment
(),
sub_element
,
nav_element
=
gadget
.
element
.
querySelector
(
'
nav
'
),
nav_element
=
gadget
.
element
.
querySelector
(
'
nav
'
),
from_index
;
from_index
;
...
@@ -1080,27 +1100,22 @@
...
@@ -1080,27 +1100,22 @@
// <a class="{{previous_classname}}" data-i18n="Previous" href="{{previous_url}}">Previous</a>
// <a class="{{previous_classname}}" data-i18n="Previous" href="{{previous_url}}">Previous</a>
// <a class="{{next_classname}}" data-i18n="Next" href="{{next_url}}">Next</a>
// <a class="{{next_classname}}" data-i18n="Next" href="{{next_url}}">Next</a>
// <span class="ui-disabled">{{record}}</span>
// <span class="ui-disabled">{{record}}</span>
sub_element
=
document
.
createElement
(
'
a
'
);
domsugar
(
nav_element
,
[
sub_element
.
setAttribute
(
'
class
'
,
previous_classname
);
domsugar
(
'
a
'
,
{
sub_element
.
href
=
previous_url
;
'
class
'
:
previous_classname
,
sub_element
.
textContent
=
result_list
[
0
][
1
];
'
href
'
:
previous_url
,
fragment
.
appendChild
(
sub_element
);
'
text
'
:
result_list
[
0
][
1
]
}),
sub_element
=
document
.
createElement
(
'
a
'
);
domsugar
(
'
a
'
,
{
sub_element
.
setAttribute
(
'
class
'
,
next_classname
);
'
class
'
:
next_classname
,
sub_element
.
href
=
next_url
;
'
href
'
:
next_url
,
sub_element
.
textContent
=
result_list
[
0
][
2
];
'
text
'
:
result_list
[
0
][
2
]
fragment
.
appendChild
(
sub_element
);
}),
domsugar
(
'
span
'
,
{
sub_element
=
document
.
createElement
(
'
span
'
);
'
class
'
:
'
ui-disabled
'
,
sub_element
.
setAttribute
(
'
class
'
,
'
ui-disabled
'
);
'
text
'
:
record
sub_element
.
textContent
=
record
;
})
fragment
.
appendChild
(
sub_element
);
]);
while
(
nav_element
.
firstChild
)
{
nav_element
.
removeChild
(
nav_element
.
firstChild
);
}
nav_element
.
appendChild
(
fragment
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
var
result_sum
=
(
allDocs_result
.
sum
||
{}).
rows
||
[],
// render summary footer if available
var
result_sum
=
(
allDocs_result
.
sum
||
{}).
rows
||
[],
// render summary footer if available
...
@@ -1424,4 +1439,4 @@
...
@@ -1424,4 +1439,4 @@
return
;
return
;
});
});
}(
window
,
document
,
rJS
,
URI
,
RSVP
,
isEmpty
,
console
));
}(
window
,
document
,
rJS
,
URI
,
RSVP
,
isEmpty
,
console
,
domsugar
));
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
0c945082
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
99
0.17151.25214.12134
</string>
</value>
<value>
<string>
99
4.13949.44825.36573
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -258,7 +258,7 @@
...
@@ -258,7 +258,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
14290750.17
</float>
<float>
16
29394496.1
</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