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
Labels
Merge Requests
147
Merge Requests
147
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
cbeaa84a
Commit
cbeaa84a
authored
Nov 04, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_project_ui: refactoring and cleanup
parent
bf40a06e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
49 deletions
+26
-49
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/gadget_project_info.html.html
...rtal_skins/erp5_web_project/gadget_project_info.html.html
+1
-18
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/gadget_project_info.js.js
...m/portal_skins/erp5_web_project/gadget_project_info.js.js
+25
-31
No files found.
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/gadget_project_info.html.html
View file @
cbeaa84a
...
...
@@ -6,32 +6,16 @@
<title>
Project info gadget
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<!-- <script src="handlebars.js" type="text/javascript"></script>
<script id="panel-template-body-list" type="text/x-handlebars-template"></script>-->
<script
src=
"handlebars.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_project_info.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"gadget_project_info.css"
>
<!-- worklist -->
<script
id=
"table-template"
type=
"text/x-handlebars-template"
>
{{
#
if
document_list
}}
<
ul
data
-
role
=
"
listview
"
data
-
theme
=
"
c
"
class
=
"
document-listview ui-listview-inset ui-corner-all
"
>
{{
#
each
document_list
}}
<
li
class
=
"
ui-li-has-count
"
data
-
icon
=
"
false
"
><
a
class
=
"
ui-body-inherit
"
href
=
"
{{link}}
"
>
{{
title
}}
<
span
id
=
"
{{id}}
"
class
=
"
ui-li-count
"
>
{{
count
}}
<
/span></
a
><
/li
>
{{
/
each
}}
<
/ul
>
{{
else
}}
<
p
>
All
work
caught
up
!<
/p
>
{{
/
if
}}
</script>
</head>
<body>
<div
class=
"ui-field-contain"
style=
"top:50px;"
>
<div
class=
"bottom"
>
<a
id=
"rss_link"
target=
"_blank"
class=
"first-line-buttons ui-disabled"
data-i18n=
"[value]Generate RSS"
disabled
>
Generate RSS
</a>
</div>
</div>
<div
class=
"ui-field-contain"
style=
"top:100px;"
>
<p>
<a
id=
"milestone_link"
class=
"first-line-buttons ui-disabled"
data-i18n=
"[value]Milestones"
disabled
>
Milestones
</a>
...
...
@@ -72,6 +56,5 @@
<div
class=
"ui-field-contain"
style=
"top:350px;"
>
<div
data-gadget-url=
"gadget_editor.html"
data-gadget-scope=
"editor"
></div>
</div>
</body>
</html>
bt5/erp5_web_project_ui/SkinTemplateItem/portal_skins/erp5_web_project/gadget_project_info.js.js
View file @
cbeaa84a
/*jslint nomen: true, indent: 2 */
/*global window, rJS, RSVP, document, FileReader, Blob, jIO, ensureArray,
lockGadgetInQueue, unlockGadgetInQueue
, Handlebars
*/
lockGadgetInQueue, unlockGadgetInQueue*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
FileReader
,
Blob
,
jIO
,
ensureArray
,
lockGadgetInQueue
,
unlockGadgetInQueue
,
Handlebars
)
{
lockGadgetInQueue
,
unlockGadgetInQueue
)
{
"
use strict
"
;
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
table-template
"
)
.
innerHTML
,
table_template
=
Handlebars
.
compile
(
source
);
function
enableLink
(
link_element
,
url
)
{
link_element
.
href
=
url
;
link_element
.
disabled
=
false
;
...
...
@@ -46,13 +39,13 @@ lockGadgetInQueue, unlockGadgetInQueue, Handlebars*/
});
}
function
getWebPage
(
gadget
,
project_reference
)
{
function
getWebPage
Info
(
gadget
,
project_reference
)
{
var
query
=
'
portal_type:="Web Page" AND reference:"
'
+
project_reference
+
'
-Home.Page" AND validation_state:"published_alive"
'
,
id
,
content
,
edit_view
;
return
gadget
.
jio_allDocs
({
query
:
query
,
limit
:
1
,
select_list
:
[
'
id
'
,
'
text_content
'
]
select_list
:
[
'
text_content
'
]
})
.
push
(
function
(
result_list
)
{
if
(
result_list
.
data
.
rows
)
{
...
...
@@ -82,11 +75,9 @@ lockGadgetInQueue, unlockGadgetInQueue, Handlebars*/
};
}
gadget_klass
rJS
(
window
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
...
...
@@ -101,18 +92,23 @@ lockGadgetInQueue, unlockGadgetInQueue, Handlebars*/
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
base_site
=
window
.
location
.
origin
+
window
.
location
.
pathname
,
project_url
=
base_site
+
modification_dict
.
jio_key
,
web_page_info
;
setLastTestResult
(
gadget
,
modification_dict
.
project_title
,
document
.
getElementById
(
"
test_result_span
"
));
return
getWebPage
(
gadget
,
modification_dict
.
project_reference
)
.
push
(
function
(
result
)
{
web_page_info
=
result
;
return
gadget
.
jio_getAttachment
(
modification_dict
.
jio_key
,
"
links
"
);
web_page_info
,
editor
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
getWebPageInfo
(
gadget
,
modification_dict
.
project_reference
),
gadget
.
jio_getAttachment
(
modification_dict
.
jio_key
,
"
links
"
),
gadget
.
getDeclaredGadget
(
"
editor
"
)
]);
})
.
push
(
function
(
erp5_document
)
{
var
milestone_view
=
getActionListByName
(
ensureArray
(
erp5_document
.
_links
.
view
),
"
milestone
"
);
return
gadget
.
getUrlForList
([
getUrlParameters
(
'
milestone_module
'
,
milestone_view
,
[[
"
stop_date
"
,
"
ascending
"
]]),
.
push
(
function
(
result_list
)
{
var
milestone_view
=
getActionListByName
(
ensureArray
(
result_list
[
1
].
_links
.
view
),
"
milestone
"
);
web_page_info
=
result_list
[
0
];
editor
=
result_list
[
2
];
editor
.
render
({
"
editor
"
:
"
fck_editor
"
,
"
editable
"
:
false
,
"
value
"
:
web_page_info
.
content
});
return
gadget
.
getUrlForList
([
getUrlParameters
(
'
milestone_module
'
,
milestone_view
,
[[
"
stop_date
"
,
"
ascending
"
]]),
getUrlParameters
(
'
task_module
'
,
"
view
"
,
[[
"
delivery.start_date
"
,
"
descending
"
]],
[
"
title
"
,
"
delivery.start_date
"
,
"
delivery.stop_date
"
,
"
destination_decision_title
"
,
"
source_title
"
,
"
destination_title
"
,
"
total_quantity
"
,
"
task_line_quantity_unit_title
"
],
...
...
@@ -141,7 +137,8 @@ lockGadgetInQueue, unlockGadgetInQueue, Handlebars*/
[
"
title
"
,
"
delivery.start_date
"
,
"
delivery.stop_date
"
,
"
destination_decision_title
"
,
"
source_title
"
,
"
destination_title
"
,
"
total_quantity
"
,
"
task_line_quantity_unit_title
"
],
(
'
source_project_title: "
'
+
modification_dict
.
project_title
+
'
" AND selection_domain_state_task_domain: "not_confirmed"
'
)),
getUrlParameters
(
web_page_info
.
id
,
web_page_info
.
edit_view
)
]);
getUrlParameters
(
web_page_info
.
id
,
web_page_info
.
edit_view
)
]);
})
.
push
(
function
(
url_list
)
{
enableLink
(
document
.
getElementById
(
"
milestone_link
"
),
url_list
[
0
]);
...
...
@@ -157,10 +154,7 @@ lockGadgetInQueue, unlockGadgetInQueue, Handlebars*/
if
(
web_page_info
.
id
)
{
enableLink
(
document
.
getElementById
(
"
web_page_link
"
),
url_list
[
10
]);
}
return
gadget
.
getDeclaredGadget
(
"
editor
"
);
})
.
push
(
function
(
editor
)
{
editor
.
render
({
"
editor
"
:
"
fck_editor
"
,
"
editable
"
:
false
,
"
value
"
:
web_page_info
.
content
});
setLastTestResult
(
gadget
,
modification_dict
.
project_title
,
document
.
getElementById
(
"
test_result_span
"
));
});
})
...
...
@@ -173,4 +167,4 @@ lockGadgetInQueue, unlockGadgetInQueue, Handlebars*/
});
}(
window
,
rJS
,
RSVP
,
document
,
FileReader
,
Blob
,
jIO
,
ensureArray
,
lockGadgetInQueue
,
unlockGadgetInQueue
,
Handlebars
));
\ No newline at end of file
lockGadgetInQueue
,
unlockGadgetInQueue
));
\ No newline at end of file
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