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
iv
erp5
Commits
51f8f51a
Commit
51f8f51a
authored
Oct 07, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Use a job to render the listbox lines
parent
660050d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
103 deletions
+91
-103
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
+89
-101
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 @
51f8f51a
/*jslint indent: 2, maxerr: 3, nomen: true */
/*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, document, rJS, URI, RSVP,
loopEventListener,
/*global window, document, rJS, URI, RSVP,
SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory*/
SimpleQuery, ComplexQuery, Query, Handlebars, console, QueryFactory*/
(
function
(
window
,
document
,
rJS
,
URI
,
RSVP
,
loopEventListener
,
(
function
(
window
,
document
,
rJS
,
URI
,
RSVP
,
SimpleQuery
,
ComplexQuery
,
Query
,
Handlebars
,
console
,
QueryFactory
)
{
SimpleQuery
,
ComplexQuery
,
Query
,
Handlebars
,
console
,
QueryFactory
)
{
"
use strict
"
;
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
),
var
gadget_klass
=
rJS
(
window
),
...
@@ -311,6 +311,7 @@
...
@@ -311,6 +311,7 @@
})
})
.
push
(
function
(
my_html
)
{
.
push
(
function
(
my_html
)
{
gadget
.
props
.
element
.
querySelector
(
"
.thead
"
).
innerHTML
=
my_html
;
gadget
.
props
.
element
.
querySelector
(
"
.thead
"
).
innerHTML
=
my_html
;
gadget
.
renderContent
();
});
});
})
})
.
declareMethod
(
'
getListboxInfo
'
,
function
()
{
.
declareMethod
(
'
getListboxInfo
'
,
function
()
{
...
@@ -324,7 +325,7 @@
...
@@ -324,7 +325,7 @@
//////////////////////////////////////////////
//////////////////////////////////////////////
// render the listbox in an asynchronous way
// render the listbox in an asynchronous way
//////////////////////////////////////////////
//////////////////////////////////////////////
.
declare
Service
(
function
()
{
.
declare
Job
(
'
renderContent
'
,
function
()
{
var
gadget
=
this
,
var
gadget
=
this
,
props
=
gadget
.
props
,
props
=
gadget
.
props
,
field_json
=
props
.
field_json
,
field_json
=
props
.
field_json
,
...
@@ -525,109 +526,96 @@
...
@@ -525,109 +526,96 @@
return
data
;
return
data
;
});
});
})
})
.
declareService
(
function
(
)
{
.
onEvent
(
'
click
'
,
function
(
evt
)
{
var
gadget
=
this
,
var
gadget
=
this
,
sort_button
=
gadget
.
props
.
element
.
querySelector
(
'
button[name="Sort"]
'
),
hide_button
=
gadget
.
props
.
element
.
querySelector
(
'
button[name="Hide"]
'
),
url
,
url
,
options
=
{},
options
=
{};
sort_button
=
gadget
.
props
.
element
.
querySelector
(
'
button[name="Sort"]
'
);
if
(
evt
.
target
===
sort_button
)
{
return
loopEventListener
(
url
=
"
gadget_erp5_sort_editor.html
"
;
sort_button
,
options
.
sort_column_list
=
gadget
.
props
.
field_json
.
sort_column_list
;
"
click
"
,
options
.
sort_list
=
gadget
.
props
.
sort_list
;
false
,
options
.
key
=
gadget
.
props
.
field_json
.
key
+
"
_sort_list:json
"
;
function
()
{
return
gadget
.
renderEditorPanel
(
url
,
options
);
url
=
"
gadget_erp5_sort_editor.html
"
;
}
options
.
sort_column_list
=
gadget
.
props
.
field_json
.
sort_column_list
;
if
(
evt
.
target
===
hide_button
)
{
options
.
sort_list
=
gadget
.
props
.
sort_list
;
return
new
RSVP
.
Queue
()
options
.
key
=
gadget
.
props
.
field_json
.
key
+
"
_sort_list:json
"
;
.
push
(
function
()
{
return
gadget
.
renderEditorPanel
(
url
,
options
);
var
i
,
}
all_hide_elements
,
);
query_list
=
[],
})
search_query
,
.
declareService
(
function
()
{
thead_template
,
var
gadget
=
this
,
tbody_template
,
hide_button
=
gadget
.
props
.
element
.
querySelector
(
'
button[name="Hide"]
'
);
hide_button_html
,
return
loopEventListener
(
hide_elements
=
[];
hide_button
,
if
(
gadget
.
props
.
foot
.
colspan
===
gadget
.
props
.
foot
.
default_colspan
)
{
"
click
"
,
thead_template
=
listbox_show_thead_template
;
false
,
tbody_template
=
listbox_show_tbody_template
;
function
()
{
hide_button_html
=
"
Submit
"
;
return
new
RSVP
.
Queue
()
gadget
.
props
.
foot
.
colspan
+=
1
;
.
push
(
function
()
{
}
else
{
var
i
,
//hide closed
all_hide_elements
,
//maybe submit
query_list
=
[],
all_hide_elements
=
gadget
.
props
.
element
.
querySelectorAll
(
"
.hide_element
"
);
search_query
,
for
(
i
=
0
;
i
<
all_hide_elements
.
length
;
i
+=
1
)
{
thead_template
,
if
(
!
all_hide_elements
[
i
].
checked
)
{
tbody_template
,
hide_elements
.
push
(
all_hide_elements
[
i
]);
hide_button_html
,
hide_elements
=
[];
if
(
gadget
.
props
.
foot
.
colspan
===
gadget
.
props
.
foot
.
default_colspan
)
{
thead_template
=
listbox_show_thead_template
;
tbody_template
=
listbox_show_tbody_template
;
hide_button_html
=
"
Submit
"
;
gadget
.
props
.
foot
.
colspan
+=
1
;
}
else
{
//hide closed
//maybe submit
all_hide_elements
=
gadget
.
props
.
element
.
querySelectorAll
(
"
.hide_element
"
);
for
(
i
=
0
;
i
<
all_hide_elements
.
length
;
i
+=
1
)
{
if
(
!
all_hide_elements
[
i
].
checked
)
{
hide_elements
.
push
(
all_hide_elements
[
i
]);
}
}
}
if
(
hide_elements
.
length
)
{
}
for
(
i
=
0
;
i
<
hide_elements
.
length
;
i
+=
1
)
{
if
(
hide_elements
.
length
)
{
query_list
.
push
(
new
SimpleQuery
({
for
(
i
=
0
;
i
<
hide_elements
.
length
;
i
+=
1
)
{
key
:
"
catalog.uid
"
,
query_list
.
push
(
new
SimpleQuery
({
type
:
"
simple
"
,
key
:
"
catalog.uid
"
,
operator
:
"
!=
"
,
type
:
"
simple
"
,
value
:
hide_elements
[
i
].
getAttribute
(
"
value
"
)
operator
:
"
!=
"
,
}));
value
:
hide_elements
[
i
].
getAttribute
(
"
value
"
)
}
}));
if
(
gadget
.
props
.
extended_search
)
{
search_query
=
QueryFactory
.
create
(
gadget
.
props
.
extended_search
);
}
if
(
search_query
)
{
query_list
.
push
(
search_query
);
}
search_query
=
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
query_list
,
type
:
"
complex
"
});
return
gadget
.
redirect
({
command
:
'
store_and_change
'
,
options
:
{
"
extended_search
"
:
Query
.
objectToSearchText
(
search_query
)
}
});
}
}
if
(
gadget
.
props
.
extended_search
)
{
search_query
=
QueryFactory
.
create
(
gadget
.
props
.
extended_search
);
}
if
(
search_query
)
{
query_list
.
push
(
search_query
);
}
search_query
=
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
query_list
,
type
:
"
complex
"
});
gadget
.
props
.
foot
.
colspan
-=
1
;
return
gadget
.
redirect
({
hide_button_html
=
"
Hide Rows
"
;
command
:
'
store_and_change
'
,
thead_template
=
listbox_hidden_thead_template
;
options
:
{
tbody_template
=
listbox_hidden_tbody_template
;
"
extended_search
"
:
Query
.
objectToSearchText
(
search_query
)
}
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
renderListboxThead
(
gadget
,
thead_template
),
renderListboxTbody
(
gadget
,
tbody_template
),
renderListboxTfoot
(
gadget
,
listbox_tfoot_template
),
gadget
.
translate
(
hide_button_html
)
]);
})
.
push
(
function
(
all_innerHTML
)
{
//change hide button's text
hide_button
.
innerHTML
=
all_innerHTML
[
3
];
gadget
.
props
.
element
.
querySelector
(
"
.thead
"
).
innerHTML
=
all_innerHTML
[
0
];
gadget
.
props
.
element
.
querySelector
(
"
.tfoot
"
).
innerHTML
=
all_innerHTML
[
2
];
});
});
});
}
}
);
gadget
.
props
.
foot
.
colspan
-=
1
;
})
hide_button_html
=
"
Hide Rows
"
;
thead_template
=
listbox_hidden_thead_template
;
tbody_template
=
listbox_hidden_tbody_template
;
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
renderListboxThead
(
gadget
,
thead_template
),
renderListboxTbody
(
gadget
,
tbody_template
),
renderListboxTfoot
(
gadget
,
listbox_tfoot_template
),
gadget
.
translate
(
hide_button_html
)
]);
})
.
push
(
function
(
all_innerHTML
)
{
//change hide button's text
hide_button
.
innerHTML
=
all_innerHTML
[
3
];
gadget
.
props
.
element
.
querySelector
(
"
.thead
"
).
innerHTML
=
all_innerHTML
[
0
];
gadget
.
props
.
element
.
querySelector
(
"
.tfoot
"
).
innerHTML
=
all_innerHTML
[
2
];
});
});
}
},
false
,
false
)
.
allowPublicAcquisition
(
"
notifyInvalid
"
,
function
()
{
.
allowPublicAcquisition
(
"
notifyInvalid
"
,
function
()
{
return
;
return
;
...
@@ -637,5 +625,5 @@
...
@@ -637,5 +625,5 @@
return
;
return
;
});
});
}(
window
,
document
,
rJS
,
URI
,
RSVP
,
loopEventListener
,
}(
window
,
document
,
rJS
,
URI
,
RSVP
,
SimpleQuery
,
ComplexQuery
,
Query
,
Handlebars
,
console
,
QueryFactory
));
SimpleQuery
,
ComplexQuery
,
Query
,
Handlebars
,
console
,
QueryFactory
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
51f8f51a
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.2
5745.6524.38843
</string>
</value>
<value>
<string>
954.2
8831.10592.12339
</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>
1475
666953.92
</float>
<float>
1475
852314.74
</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