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
amrani
erp5
Commits
7c2504d2
Commit
7c2504d2
authored
Oct 05, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Allow the report_view to be rendered multiple times
parent
becaeaf4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
45 deletions
+67
-45
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_html.html
.../web_page_module/rjs_gadget_erp5_pt_report_view_html.html
+0
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_html.xml
...m/web_page_module/rjs_gadget_erp5_pt_report_view_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_report_view_js.js
+63
-40
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_report_view_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_html.html
View file @
7c2504d2
...
...
@@ -11,7 +11,6 @@
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_report_view.js"
type=
"text/javascript"
></script>
</head>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_html.xml
View file @
7c2504d2
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.56654.6216.48605
</string>
</value>
<value>
<string>
9
52.64761.25287.18397
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
14
58134709.24
</float>
<float>
14
75671995.87
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_js.js
View file @
7c2504d2
...
...
@@ -3,7 +3,8 @@
(
function
(
window
,
document
,
rJS
,
RSVP
,
URI
)
{
"
use strict
"
;
function
createSectionGadget
(
gadget
,
queue
,
report_section
)
{
function
createSectionGadget
(
gadget
,
queue
,
report_section
,
section_list_element
)
{
var
uri
=
new
URI
(
report_section
.
_links
.
form_definition
.
href
),
form_definition
;
queue
...
...
@@ -12,9 +13,7 @@
})
.
push
(
function
(
result
)
{
form_definition
=
result
;
var
section_list_element
=
gadget
.
props
.
element
.
querySelector
(
'
.report_section_list
'
),
section_element
=
document
.
createElement
(
'
div
'
);
var
section_element
=
document
.
createElement
(
'
div
'
);
section_list_element
.
appendChild
(
section_element
);
return
gadget
.
declareGadget
(
'
gadget_erp5_pt_form_view.html
'
,
{
element
:
section_element
...
...
@@ -37,24 +36,7 @@
});
}
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.
ready
(
function
(
g
)
{
g
.
props
=
{};
})
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
})
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
...
...
@@ -67,43 +49,84 @@
.
allowPublicAcquisition
(
'
updateHeader
'
,
function
(
argument_list
,
scope
)
{
// Fetch menu configuration from main form
if
(
scope
===
'
form_view
'
)
{
return
this
.
updateHeader
.
apply
(
this
,
argument_list
);
// report are not supposed to be editable
var
options
=
argument_list
[
0
];
delete
options
.
save_action
;
return
this
.
updateHeader
(
options
);
}
return
;
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
erp5_document
=
options
.
erp5_document
,
form_definition
=
options
.
form_definition
,
rendered_form
=
erp5_document
.
_embedded
.
_view
,
gadget
=
this
,
report_section_list
=
rendered_form
.
report_section_list
,
form_gadget_url
;
delete
options
.
erp5_document
;
delete
options
.
form_definition
;
var
form_gadget_url
;
if
(
options
.
editable
)
{
form_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
}
else
{
form_gadget_url
=
'
gadget_erp5_pt_form_view.html
'
;
}
return
this
.
changeState
({
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
form_gadget_url
:
form_gadget_url
});
})
.
declareMethod
(
'
updateDOM
'
,
function
(
modification_dict
)
{
var
gadget
=
this
,
form_gadget
,
section_container_element
=
document
.
createElement
(
'
div
'
),
report_section_list
=
gadget
.
state
.
erp5_document
.
_embedded
.
_view
.
report_section_list
;
return
new
RSVP
.
Queue
()
return
gadget
.
declareGadget
(
form_gadget_url
,
{
element
:
gadget
.
props
.
element
.
querySelector
(
'
.form_view
'
),
scope
:
'
form_view
'
})
.
push
(
function
(
view_gadget
)
{
return
view_gadget
.
render
({
erp5_document
:
erp5_document
,
form_definition
:
form_definition
});
// Render the erp5 form
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
form_gadget_url
'
))
{
return
gadget
.
declareGadget
(
gadget
.
state
.
form_gadget_url
,
{
scope
:
'
form_view
'
});
}
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
result
)
{
form_gadget
=
result
;
return
form_gadget
.
render
({
erp5_document
:
gadget
.
state
.
erp5_document
,
form_definition
:
gadget
.
state
.
form_definition
});
})
// Render the report sections
.
push
(
function
()
{
var
i
,
queue
=
new
RSVP
.
Queue
();
for
(
i
=
0
;
i
<
report_section_list
.
length
;
i
+=
1
)
{
createSectionGadget
(
gadget
,
queue
,
report_section_list
[
i
]);
createSectionGadget
(
gadget
,
queue
,
report_section_list
[
i
],
section_container_element
);
}
return
queue
;
})
// Modify the DOM if needed
.
push
(
function
()
{
var
form_view_element
=
gadget
.
element
.
querySelector
(
'
.form_view
'
),
section_element
=
gadget
.
element
.
querySelector
(
'
.report_section_list
'
);
if
(
modification_dict
.
hasOwnProperty
(
'
form_gadget_url
'
))
{
// Clear first to DOM, append after to reduce flickering/manip
while
(
form_view_element
.
firstChild
)
{
form_view_element
.
removeChild
(
form_view_element
.
firstChild
);
}
form_view_element
.
appendChild
(
form_gadget
.
element
);
}
// Always replace the report section
// XXX It could certainly be improved
// Clear first to DOM, append after to reduce flickering/manip
while
(
section_element
.
firstChild
)
{
section_element
.
removeChild
(
section_element
.
firstChild
);
}
section_element
.
appendChild
(
section_container_element
);
});
});
}(
window
,
document
,
rJS
,
RSVP
,
URI
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_report_view_js.xml
View file @
7c2504d2
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.28705.60351.34013
</string>
</value>
<value>
<string>
95
4.25917.62680.11605
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
14
60375525.08
</float>
<float>
14
75677438.49
</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