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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
dbae3b09
Commit
dbae3b09
authored
Jul 21, 2017
by
Tomáš Peterka
Committed by
Romain Courteaud
Jul 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Use clojures instead of arrow functions because they are not fully supported
parent
4c403ec8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
28 deletions
+28
-28
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
+26
-26
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_js.js
View file @
dbae3b09
...
...
@@ -118,6 +118,13 @@
));
}
/** Clojure to ease finding in lists of lists by the first item **/
function
hasSameFirstItem
(
a
)
{
return
function
(
b
)
{
return
a
[
0
]
===
b
[
0
];
};
}
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// ready
...
...
@@ -268,7 +275,6 @@
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
sort_key
=
gadget
.
state
.
key
+
"
_sort_list:json
"
,
class_value
,
sort_list
,
column_list
,
sort_column_list
,
...
...
@@ -327,12 +333,8 @@
// construct array of links for sortable columns, undefined otherwise
return
RSVP
.
all
(
column_list
.
map
(
function
(
column
)
{
function
is_current_column
(
item
)
{
return
item
[
0
]
===
column
[
0
];
}
var
is_sortable
=
sort_column_list
.
find
(
is_current_column
)
!==
undefined
,
current_sort
=
sort_list
.
find
(
is_current_column
),
var
is_sortable
=
sort_column_list
.
find
(
hasSameFirstItem
(
column
))
!==
undefined
,
current_sort
=
sort_list
.
find
(
hasSameFirstItem
(
column
)),
options
=
{};
if
(
is_sortable
)
{
...
...
@@ -350,28 +352,26 @@
// so we can construct array of header objects to be rendered in the header template
var
hide_button_text
,
hide_button_name
,
current_sort
,
head_value_list
=
[];
for
(
i
=
0
;
i
<
column_list
.
length
;
i
+=
1
)
{
current_sort
=
sort_list
.
find
((
item
)
=>
item
[
0
]
===
column_list
[
i
][
0
]);
class_value
=
undefined
;
if
(
current_sort
!==
undefined
)
{
if
(
current_sort
[
1
]
===
'
ascending
'
)
{
class_value
=
"
ui-icon ui-icon-arrow-up
"
;
}
if
(
current_sort
[
1
]
===
'
descending
'
)
{
class_value
=
"
ui-icon ui-icon-arrow-down
"
;
head_value_list
=
column_list
.
map
(
function
(
column
,
index
)
{
var
current_sort
=
sort_list
.
find
(
hasSameFirstItem
(
column
)),
class_value
=
""
;
if
(
current_sort
!==
undefined
)
{
if
(
current_sort
[
1
]
===
'
ascending
'
)
{
class_value
=
"
ui-icon ui-icon-arrow-up
"
;
}
if
(
current_sort
[
1
]
===
'
descending
'
)
{
class_value
=
"
ui-icon ui-icon-arrow-down
"
;
}
}
}
head_value_list
.
push
({
"
data-i18n
"
:
column_list
[
i
][
1
],
"
class_value
"
:
class_value
,
"
sort_link
"
:
column_sort_link_list
[
i
],
"
text
"
:
column_list
[
i
][
1
]
return
{
"
data-i18n
"
:
column
[
1
],
"
class_value
"
:
class_value
,
"
sort_link
"
:
column_sort_link_list
[
index
],
"
text
"
:
column
[
1
]
};
});
}
if
(
gadget
.
state
.
show_line_selector
)
{
hide_button_text
=
'
Submit
'
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
dbae3b09
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
960.5
6198.53416.29457
</string>
</value>
<value>
<string>
960.5
7664.50157.3293
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
15006
26843.31
</float>
<float>
15006
56708.46
</float>
<string>
UTC
</string>
</tuple>
</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