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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
52b7898c
Commit
52b7898c
authored
Jun 30, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_js_style: calculate the web section related document list
parent
3f358c43
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
104 additions
and
13 deletions
+104
-13
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebSection_generateNavigationHTML.py
...erp5_web_js_style_ui/WebSection_generateNavigationHTML.py
+14
-2
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebSection_generateNavigationHTML.xml
...rp5_web_js_style_ui/WebSection_generateNavigationHTML.xml
+1
-1
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/dialog_main.zpt
...ateItem/portal_skins/erp5_web_js_style_ui/dialog_main.zpt
+1
-1
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.css.css
...ateItem/portal_skins/erp5_web_js_style_ui/jsstyle.css.css
+14
-4
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
...plateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
+21
-0
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.less.bin
...teItem/portal_skins/erp5_web_js_style_ui/jsstyle.less.bin
+21
-4
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/view_main.zpt
...plateItem/portal_skins/erp5_web_js_style_ui/view_main.zpt
+1
-1
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDemoStyle.zpt
...Item/portal_tests/js_style_zuite/testJsStyleDemoStyle.zpt
+6
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNoStyle.zpt
...teItem/portal_tests/js_style_zuite/testJsStyleNoStyle.zpt
+6
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/ERP5Site_createWebJSStyleZuiteTestData.py
...b_js_style_test/ERP5Site_createWebJSStyleZuiteTestData.py
+4
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo.html.html
...ortal_skins/erp5_web_js_style_test/jsstyle_demo.html.html
+1
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo.js.js
...em/portal_skins/erp5_web_js_style_test/jsstyle_demo.js.js
+14
-0
No files found.
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebS
ite
_generateNavigationHTML.py
→
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebS
ection
_generateNavigationHTML.py
View file @
52b7898c
import
cgi
import
cgi
import
re
import
re
web_site
=
context
web_section
=
context
web_site
=
web_section
.
getWebSiteValue
()
def
_
(
string_to_escape
):
def
_
(
string_to_escape
):
return
cgi
.
escape
(
"%s"
%
string_to_escape
,
quote
=
False
)
return
cgi
.
escape
(
"%s"
%
string_to_escape
,
quote
=
False
)
...
@@ -23,6 +24,14 @@ def generateSectionListHTML(result_list, section_list):
...
@@ -23,6 +24,14 @@ def generateSectionListHTML(result_list, section_list):
result_list
.
append
(
'</ul>'
)
result_list
.
append
(
'</ul>'
)
def
generateDocumentListHTML
(
result_list
,
document_list
):
if
(
document_list
):
result_list
.
append
(
'<aside id="document_list"><ul>'
)
for
section
in
document_list
:
result_list
.
append
(
'<li><a href="%s">%s</a></li>'
%
(
__
(
section
[
'url'
]),
_
(
section
[
'translated_title'
])))
result_list
.
append
(
'</ul></aside>'
)
# Language
# Language
result_list
=
[
'<nav id="language"><ul>'
]
result_list
=
[
'<nav id="language"><ul>'
]
...
@@ -46,7 +55,10 @@ result_list.append('</ul></nav>')
...
@@ -46,7 +55,10 @@ result_list.append('</ul></nav>')
# Sitemap
# Sitemap
result_list
.
append
(
'<nav id="sitemap">'
)
result_list
.
append
(
'<nav id="sitemap">'
)
result_list
.
append
(
'<a href="%s">%s</a>'
%
(
__
(
web_site
.
absolute_url
()),
_
(
web_site
.
getTranslatedTitle
())))
result_list
.
append
(
'<a href="%s">%s</a>'
%
(
__
(
web_site
.
absolute_url
()),
_
(
web_site
.
getTranslatedTitle
())))
generateSectionListHTML
(
result_list
,
web_site
.
WebSection_getSiteMapTree
(
depth
=
99
))
generateSectionListHTML
(
result_list
,
web_site
.
WebSection_getSiteMapTree
(
include_document
=
False
,
depth
=
99
))
result_list
.
append
(
'</nav>'
)
result_list
.
append
(
'</nav>'
)
# Documents
generateDocumentListHTML
(
result_list
,
web_section
.
WebSection_getSiteMapTree
(
include_subsection
=
False
,
exclude_default_document
=
True
,
depth
=
1
))
return
''
.
join
(
result_list
)
return
''
.
join
(
result_list
)
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebS
ite
_generateNavigationHTML.xml
→
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebS
ection
_generateNavigationHTML.xml
View file @
52b7898c
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebS
ite
_generateNavigationHTML
</string>
</value>
<value>
<string>
WebS
ection
_generateNavigationHTML
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/dialog_main.zpt
View file @
52b7898c
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
</head>
</head>
<body
tal:attributes=
"data-nostyle-gadget-url no_style_gadget_url;
<body
tal:attributes=
"data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url"
>
data-nostyle-css-url no_style_css_url"
>
<tal:block
tal:content=
"structure python: web_s
ite.WebSite
_generateNavigationHTML()"
></tal:block>
<tal:block
tal:content=
"structure python: web_s
ection.WebSection
_generateNavigationHTML()"
></tal:block>
<main>
<main>
<p
tal:content=
"request/portal_status_message | nothing"
id=
"portal_status_message"
/>
<p
tal:content=
"request/portal_status_message | nothing"
id=
"portal_status_message"
/>
...
...
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.css.css
View file @
52b7898c
body
{
body
{
display
:
grid
;
display
:
grid
;
grid-template-raws
:
repeat
(
3
,
1
fr
);
grid-gap
:
1em
;
grid-template-areas
:
"header"
"content"
"sidebar"
"footer"
;
}
@media
only
screen
and
(
min-width
:
50em
)
{
body
{
grid-template-areas
:
"header header header"
"content content sidebar"
"footer footer footer"
;
}
}
}
body
>
nav
#sitemap
{
body
>
nav
#sitemap
{
grid-
row
:
1
;
grid-
area
:
header
;
background-color
:
#DDD
;
background-color
:
#DDD
;
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
...
@@ -31,7 +37,7 @@ body > nav#sitemap a:not(:first-child) {
...
@@ -31,7 +37,7 @@ body > nav#sitemap a:not(:first-child) {
padding
:
0
1em
;
padding
:
0
1em
;
}
}
body
main
{
body
main
{
grid-
row
:
2
;
grid-
area
:
content
;
}
}
body
main
fieldset
{
body
main
fieldset
{
border
:
none
;
border
:
none
;
...
@@ -45,8 +51,12 @@ body main fieldset > div > label {
...
@@ -45,8 +51,12 @@ body main fieldset > div > label {
font-weight
:
bold
;
font-weight
:
bold
;
min-width
:
10%
;
min-width
:
10%
;
}
}
body
>
aside
#document_list
{
grid-area
:
sidebar
;
background-color
:
#DDD
;
}
body
>
nav
#language
{
body
>
nav
#language
{
grid-
row
:
3
;
grid-
area
:
footer
;
background-color
:
#DDD
;
background-color
:
#DDD
;
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
...
...
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
View file @
52b7898c
...
@@ -109,6 +109,24 @@
...
@@ -109,6 +109,24 @@
return
sitemap
;
return
sitemap
;
}
}
function
parseDocumentListElement
(
document_list_element
)
{
var
document_list
=
[],
li_list
,
i
;
if
(
document_list_element
===
null
)
{
return
document_list
;
}
li_list
=
document_list_element
.
querySelectorAll
(
'
a
'
);
for
(
i
=
0
;
i
<
li_list
.
length
;
i
+=
1
)
{
document_list
.
push
({
href
:
li_list
[
i
].
href
,
text
:
li_list
[
i
].
textContent
});
}
return
document_list
;
}
function
parseFormElement
(
form_element
)
{
function
parseFormElement
(
form_element
)
{
if
(
form_element
!==
null
)
{
if
(
form_element
!==
null
)
{
return
form_element
.
outerHTML
;
return
form_element
.
outerHTML
;
...
@@ -162,6 +180,9 @@
...
@@ -162,6 +180,9 @@
sitemap
:
parseSitemapElement
(
sitemap
:
parseSitemapElement
(
body_element
.
querySelector
(
'
nav#sitemap
'
)
body_element
.
querySelector
(
'
nav#sitemap
'
)
),
),
document_list
:
parseDocumentListElement
(
body_element
.
querySelector
(
'
aside#document_list
'
)
),
form_html_content
:
parseFormElement
(
form_html_content
:
parseFormElement
(
body_element
.
querySelector
(
'
form#main_form
'
)
body_element
.
querySelector
(
'
form#main_form
'
)
),
),
...
...
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.less.bin
View file @
52b7898c
...
@@ -30,16 +30,28 @@
...
@@ -30,16 +30,28 @@
body {
body {
display: grid;
display: grid;
grid-template-raws: repeat(3, 1fr);
grid-gap: 1em;
grid-template-areas:
"header"
"content"
"sidebar"
"footer";
@media only screen and (min-width: 50em) {
grid-template-areas:
"header header header"
"content content sidebar"
"footer footer footer";
}
> nav#sitemap {
> nav#sitemap {
grid-
row: 1
;
grid-
area: header
;
.flattenNav();
.flattenNav();
}
}
main {
main {
grid-
row: 2
;
grid-
area: content
;
fieldset {
fieldset {
border: none;
border: none;
...
@@ -55,8 +67,13 @@ body {
...
@@ -55,8 +67,13 @@ body {
}
}
}
}
> aside#document_list {
grid-area: sidebar;
background-color: #DDD;
}
> nav#language {
> nav#language {
grid-
row: 3
;
grid-
area: footer
;
.flattenNav();
.flattenNav();
}
}
...
...
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/view_main.zpt
View file @
52b7898c
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</head>
</head>
<body
tal:attributes=
"data-nostyle-gadget-url no_style_gadget_url;
<body
tal:attributes=
"data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url"
>
data-nostyle-css-url no_style_css_url"
>
<tal:block
tal:content=
"structure python: web_s
ite.WebSite
_generateNavigationHTML()"
></tal:block>
<tal:block
tal:content=
"structure python: web_s
ection.WebSection
_generateNavigationHTML()"
></tal:block>
<p
tal:content=
"request/portal_status_message | nothing"
id=
"portal_status_message"
/>
<p
tal:content=
"request/portal_status_message | nothing"
id=
"portal_status_message"
/>
<main><tal:block
metal:define-slot=
"main"
/></main>
<main><tal:block
metal:define-slot=
"main"
/></main>
...
...
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDemoStyle.zpt
View file @
52b7898c
...
@@ -67,6 +67,12 @@
...
@@ -67,6 +67,12 @@
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//aside[@id='document_list']//a[text()='erp5_web_js_style_test_contentpage']
</td>
<td></td>
</tr>
<tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
assertElementNotPresent
</td>
<td>
//div[@class='input']/span[@class='headline' and text()='Demo Style']
</td>
<td>
//div[@class='input']/span[@class='headline' and text()='Demo Style']
</td>
...
...
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNoStyle.zpt
View file @
52b7898c
...
@@ -61,6 +61,12 @@
...
@@ -61,6 +61,12 @@
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//aside[@id='document_list']//a[text()='erp5_web_js_style_test_contentpage']
</td>
<td></td>
</tr>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
assertElementPresent
</td>
<td>
//div[@class='input']/span[@class='headline' and text()='No Style']
</td>
<td>
//div[@class='input']/span[@class='headline' and text()='No Style']
</td>
...
...
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/ERP5Site_createWebJSStyleZuiteTestData.py
View file @
52b7898c
...
@@ -198,8 +198,12 @@ web_site = module.newContent(
...
@@ -198,8 +198,12 @@ web_site = module.newContent(
id
=
web_site_id
,
id
=
web_site_id
,
skin_selection_name
=
"Jsstyle"
,
skin_selection_name
=
"Jsstyle"
,
layout_configuration_form_id
=
"WebSection_viewJsstylePreference"
,
layout_configuration_form_id
=
"WebSection_viewJsstylePreference"
,
site_map_document_parent
=
True
,
criterion_property_list
=
(
'title'
,),
**
configuration_dict
[
configuration
]
**
configuration_dict
[
configuration
]
)
)
web_site
.
setCriterion
(
'title'
,
identity
=
'erp5_web_js_style_test_contentpage'
)
web_section
=
web_site
.
newContent
(
web_section
=
web_site
.
newContent
(
portal_type
=
web_section_portal_type
,
portal_type
=
web_section_portal_type
,
id
=
'%s1'
%
web_section_id_prefix
,
id
=
'%s1'
%
web_section_id_prefix
,
...
...
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo.html.html
View file @
52b7898c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<p
id=
"portal_status_message"
></p>
<p
id=
"portal_status_message"
></p>
<nav
id=
"language"
></nav>
<nav
id=
"language"
></nav>
<nav
id=
"sitemap"
></nav>
<nav
id=
"sitemap"
></nav>
<aside
id=
"document_list"
></aside>
<main></main>
<main></main>
</body>
</body>
</html>
</html>
\ No newline at end of file
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo.js.js
View file @
52b7898c
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
})
})
.
declareMethod
(
"
render
"
,
function
(
html_content
,
parsed_content
)
{
.
declareMethod
(
"
render
"
,
function
(
html_content
,
parsed_content
)
{
var
state
=
{
var
state
=
{
document_list
:
JSON
.
stringify
(
parsed_content
.
document_list
||
[]),
language_list
:
JSON
.
stringify
(
parsed_content
.
language_list
||
[]),
language_list
:
JSON
.
stringify
(
parsed_content
.
language_list
||
[]),
sitemap
:
JSON
.
stringify
(
parsed_content
.
sitemap
||
{}),
sitemap
:
JSON
.
stringify
(
parsed_content
.
sitemap
||
{}),
page_title
:
parsed_content
.
page_title
||
""
,
page_title
:
parsed_content
.
page_title
||
""
,
...
@@ -49,6 +50,7 @@
...
@@ -49,6 +50,7 @@
.
onStateChange
(
function
(
modification_dict
)
{
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
var
gadget
=
this
,
language_list
,
language_list
,
document_list
,
child_list
,
child_list
,
i
;
i
;
...
@@ -97,6 +99,18 @@
...
@@ -97,6 +99,18 @@
domsugar
(
gadget
.
element
.
querySelector
(
'
nav#language
'
),
domsugar
(
gadget
.
element
.
querySelector
(
'
nav#language
'
),
[
domsugar
(
'
ul
'
,
child_list
)]);
[
domsugar
(
'
ul
'
,
child_list
)]);
}
}
if
(
modification_dict
.
hasOwnProperty
(
'
document_list
'
))
{
document_list
=
JSON
.
parse
(
gadget
.
state
.
document_list
);
child_list
=
[];
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
child_list
.
push
(
domsugar
(
'
li
'
,
[
domsugar
(
'
a
'
,
{
text
:
document_list
[
i
].
text
,
href
:
document_list
[
i
].
href
})]));
}
domsugar
(
gadget
.
element
.
querySelector
(
'
aside#document_list
'
),
[
domsugar
(
'
ul
'
,
child_list
)]);
}
if
(
modification_dict
.
hasOwnProperty
(
'
sitemap
'
))
{
if
(
modification_dict
.
hasOwnProperty
(
'
sitemap
'
))
{
renderSitemap
(
JSON
.
parse
(
gadget
.
state
.
sitemap
),
renderSitemap
(
JSON
.
parse
(
gadget
.
state
.
sitemap
),
gadget
.
element
.
querySelector
(
'
nav#sitemap
'
));
gadget
.
element
.
querySelector
(
'
nav#sitemap
'
));
...
...
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