Commit ca932707 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_web_renderjs_ui] Add possibility to hide panel in desktop view

parent 2c22f4ff
......@@ -169,6 +169,21 @@
return displayErrorContent(gadget, error);
}
function hideDesktopPanel(gadget, hide) {
gadget.props.hide_panel = hide;
if (hide) {
if (!gadget.element.classList.contains('desktop-panel-hidden')) {
gadget.element.classList.toggle('desktop-panel-hidden');
}
return route(gadget, "panel", "close");
} else {
if (gadget.element.classList.contains('desktop-panel-hidden')) {
gadget.element.classList.remove('desktop-panel-hidden');
}
return route(gadget, "panel", "open");
}
}
//////////////////////////////////////////
// Page rendering
//////////////////////////////////////////
......@@ -426,6 +441,9 @@
gadget.props.panel_argument_list = param_list[0];
})
.allowPublicAcquisition('hidePanel', function (param_list) {
return hideDesktopPanel(this, param_list[0]);
})
.allowPublicAcquisition('triggerPanel', function () {
return route(this, "panel", "toggle");
})
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.29105.23200.50073</string> </value>
<value> <string>964.7125.64671.33655</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1511971674.78</float>
<float>1513180213.26</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -436,6 +436,8 @@ div[data-gadget-scope='panel'] {
left: 0;
display: block;
z-index: 2000;
transition: transform 200ms ease-out;
transform: translate3d(0, 0, 0);
}
@media not screen and (min-width: 45em), only screen and (min-width: 45em) and (max-width: 85em) {
div[data-gadget-scope='panel'] {
......@@ -445,8 +447,6 @@ div[data-gadget-scope='panel'] {
@media not screen and (min-width: 45em), only screen and (min-width: 45em) and (max-width: 85em) {
div[data-gadget-scope='panel'] {
left: -186pt;
transition: transform 200ms ease-out;
transform: translate3d(0, 0, 0);
}
div[data-gadget-scope='panel'].visible {
transform: translate3d(186pt, 0, 0);
......@@ -686,7 +686,8 @@ div[data-gadget-scope='header'] .ui-header {
}
@media not screen and (max-width: 85em) {
div[data-gadget-scope='header'] .ui-header {
margin-left: 180pt;
transition: transform 200ms ease-out;
transform: translate3d(180pt, 0, 0);
}
}
div[data-gadget-scope='header'] .ui-header button,
......@@ -873,6 +874,7 @@ div[data-gadget-scope='header'] .ui-header ul {
div[data-gadget-scope='header'] .ui-header ul li a {
padding-top: 3pt;
padding-bottom: 3pt;
line-height: inherit;
white-space: nowrap;
overflow: hidden;
}
......@@ -1497,6 +1499,81 @@ div[data-gadget-scope='notification'] button.error {
}
}
/**********************************************
* Desktop Panel Hidden
**********************************************/
@media not screen and (max-width: 85em) {
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header {
margin-left: 0;
transform: translate3d(0, 0, 0);
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header .ui-controlgroup-controls button,
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header .ui-controlgroup-controls a {
background-color: #085078;
width: 8em;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header .ui-controlgroup-controls button[name="panel"],
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header .ui-controlgroup-controls a[name="panel"] {
display: block;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header > .ui-btn-right button,
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header > .ui-btn-right a {
border-left: 1px solid rgba(255, 255, 255, 0.55);
padding-left: 0;
padding-right: 0;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header h1 {
flex: 1;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header h1 > span {
padding-left: 16pt;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header h1 > span::before {
margin-right: 14pt;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header h1 a::before,
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header h1 form button::before {
text-align: center;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header .ui-subheader {
text-align: center;
flex: 1 100%;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header ul > li {
flex: 1;
border-left: 1px solid rgba(0, 0, 0, 0.55);
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header ul > li:first-child {
border-left: none;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header ul > li a {
display: block;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header ul > li a {
padding-top: 3pt;
padding-bottom: 3pt;
line-height: inherit;
white-space: nowrap;
overflow: hidden;
}
.desktop-panel-hidden div[data-gadget-scope="header"] .ui-header ul > li a::before {
font-size: 1.2em;
display: block;
}
.desktop-panel-hidden .gadget-content {
margin-left: 0;
padding-top: 7em;
}
.desktop-panel-hidden div[data-gadget-scope='panel'] {
transform: translate3d(-186pt, 0, 0);
}
.desktop-panel-hidden div[data-gadget-scope='panel'].visible {
transform: translate3d(0, 0, 0);
}
.desktop-panel-hidden div[data-gadget-scope='panel'] div[data-role="header"] button[data-i18n="Close"] {
display: block;
}
}
/**********************************************
* Class
**********************************************/
.content-iframe-maximize {
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.49524.2871.19182</string> </value>
<value> <string>964.7132.37648.59101</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1512052879.86</float>
<float>1513180665.25</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -545,10 +545,11 @@ div[data-gadget-scope='panel'] {
display: block;
z-index: 2000;
@media @smartphone, @tablet {
left: -@panelwidth - @margin-size;
transition: transform 200ms ease-out;
transform: translate3d(0, 0, 0);
@media @smartphone, @tablet {
left: -@panelwidth - @margin-size;
&.visible {
transform: translate3d(@panelwidth + @margin-size, 0, 0);
}
......@@ -816,6 +817,7 @@ div[data-gadget-scope='editor_panel'] {
.renderTabletSubLink() {
padding-top: @half-margin-size;
padding-bottom: @half-margin-size;
line-height: inherit;
white-space: nowrap;
overflow: hidden;
&::before {
......@@ -855,7 +857,8 @@ div[data-gadget-scope='header'] .ui-header {
width: 100%;
@media @desktop {
margin-left: @panelwidth;
transition: transform 200ms ease-out;
transform: translate3d(@panelwidth, 0, 0);
}
color: @white;
......@@ -1719,7 +1722,76 @@ div[data-gadget-scope='notification'] {
from {opacity:0;}
to {opacity:1;}
}
/**********************************************
* Desktop Panel Hidden
**********************************************/
@media @desktop {
.desktop-panel-hidden {
div[data-gadget-scope="header"] .ui-header {
margin-left: 0;
transform: translate3d(0, 0, 0);
.ui-controlgroup-controls {
button, a {
background-color: @colorheaderbackground;
width: 8em;
&[name="panel"] {
display: block;
}
}
}
& > .ui-btn-right {
button, a {
border-left: 1px solid rgba(255, 255, 255, 0.55);
padding-left: 0;
padding-right: 0;
}
}
h1 {
flex: 1;
& > span {
.renderTabletNotALinkTitle();
}
a, form button {
&::before {
text-align: center;
}
}
}
.ui-subheader {
text-align: center;
flex: 1 100%;
}
ul > li {
.renderTabletSubListElement();
a {
.renderTabletSubLink();
}
}
}
.gadget-content {
margin-left: 0;
padding-top: 7em;
}
div[data-gadget-scope='panel'] {
transform: translate3d(-@panelwidth - @margin-size, 0, 0);
&.visible {
transform: translate3d(0, 0, 0);
}
div[data-role="header"] {
button[data-i18n="Close"] {
display: block;
}
}
}
}
}
/**********************************************
* Class
**********************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment