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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
preetwinder
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
Show 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 @@
...
@@ -11,7 +11,6 @@
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<script
src=
"URI.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_report_view.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_pt_report_view.js"
type=
"text/javascript"
></script>
</head>
</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 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<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>
14
58134709.24
</float>
<float>
14
75671995.87
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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 @@
...
@@ -3,7 +3,8 @@
(
function
(
window
,
document
,
rJS
,
RSVP
,
URI
)
{
(
function
(
window
,
document
,
rJS
,
RSVP
,
URI
)
{
"
use strict
"
;
"
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
),
var
uri
=
new
URI
(
report_section
.
_links
.
form_definition
.
href
),
form_definition
;
form_definition
;
queue
queue
...
@@ -12,9 +13,7 @@
...
@@ -12,9 +13,7 @@
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
form_definition
=
result
;
form_definition
=
result
;
var
section_list_element
=
gadget
.
props
var
section_element
=
document
.
createElement
(
'
div
'
);
.
element
.
querySelector
(
'
.report_section_list
'
),
section_element
=
document
.
createElement
(
'
div
'
);
section_list_element
.
appendChild
(
section_element
);
section_list_element
.
appendChild
(
section_element
);
return
gadget
.
declareGadget
(
'
gadget_erp5_pt_form_view.html
'
,
{
return
gadget
.
declareGadget
(
'
gadget_erp5_pt_form_view.html
'
,
{
element
:
section_element
element
:
section_element
...
@@ -37,24 +36,7 @@
...
@@ -37,24 +36,7 @@
});
});
}
}
// Precompile the templates while loading the first gadget instance
rJS
(
window
)
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
;
});
})
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -67,43 +49,84 @@
...
@@ -67,43 +49,84 @@
.
allowPublicAcquisition
(
'
updateHeader
'
,
function
(
argument_list
,
scope
)
{
.
allowPublicAcquisition
(
'
updateHeader
'
,
function
(
argument_list
,
scope
)
{
// Fetch menu configuration from main form
// Fetch menu configuration from main form
if
(
scope
===
'
form_view
'
)
{
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
;
return
;
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
erp5_document
=
options
.
erp5_document
,
var
form_gadget_url
;
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
;
if
(
options
.
editable
)
{
if
(
options
.
editable
)
{
form_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
form_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
}
else
{
}
else
{
form_gadget_url
=
'
gadget_erp5_pt_form_view.html
'
;
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
,
{
// Render the erp5 form
element
:
gadget
.
props
.
element
.
querySelector
(
'
.form_view
'
),
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
form_gadget_url
'
))
{
return
gadget
.
declareGadget
(
gadget
.
state
.
form_gadget_url
,
{
scope
:
'
form_view
'
scope
:
'
form_view
'
});
}
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
})
.
push
(
function
(
view_gadget
)
{
.
push
(
function
(
result
)
{
return
view_gadget
.
render
({
erp5_document
:
erp5_document
,
form_gadget
=
result
;
form_definition
:
form_definition
});
return
form_gadget
.
render
({
erp5_document
:
gadget
.
state
.
erp5_document
,
form_definition
:
gadget
.
state
.
form_definition
});
})
})
// Render the report sections
// Render the report sections
.
push
(
function
()
{
.
push
(
function
()
{
var
i
,
var
i
,
queue
=
new
RSVP
.
Queue
();
queue
=
new
RSVP
.
Queue
();
for
(
i
=
0
;
i
<
report_section_list
.
length
;
i
+=
1
)
{
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
;
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
));
}(
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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
60375525.08
</float>
<float>
14
75677438.49
</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