Skip to content

Commit daaf289

Browse files
authored
Merge pull request #41 from conestack/layout_rework
Layout rework
2 parents b7b6248 + f580707 commit daaf289

19 files changed

Lines changed: 154 additions & 67 deletions

File tree

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Changes
44
2.0a1 (unreleased)
55
------------------
66

7+
- Remove no longer used ``mainmenu_fluid`` and ``columns_fluid`` properties
8+
from ``ILayoutConfig``. Replace with ``limit_content_width`` property.
9+
[lenadax]
10+
711
- Cleanup js widgets to prevent DOM memory leaks.
812
[lenadax]
913

docs/source/layout.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,39 +58,44 @@ one or more model classes with ``cone.app.layout_config`` decorator.
5858
def __init__(self, model, request):
5959
super(ExampleNodeLayoutConfig, self).__init__(model, request)
6060
self.mainmenu = True
61-
self.mainmenu_fluid = False
6261
self.livesearch = True
6362
self.personaltools = True
64-
self.columns_fluid = False
63+
self.limit_content_width = False
6564
self.pathbar = True
6665
self.sidebar_left = ['navtree']
6766
self.sidebar_right = ['my_tile']
67+
self.sidebar_left_min_width = 250
68+
self.sidebar_right_min_width = 250
6869
6970
Provided layout settings:
7071

7172
- **mainmenu**: Flag whether to display mainmenu.
7273

73-
- **mainmenu_fluid**: Flag whether mainmenu is fluid.
74-
7574
- **livesearch**: Flag whether to display livesearch.
7675

7776
- **personaltools**: Flag whether to display personaltools.
7877

79-
- **columns_fluid**: Flag whether columns are fluid.
78+
- **limit_content_width**: Flag whether content width should be limited on large screens.
8079

8180
- **pathbar**: Flag whether to display pathbar.
8281

83-
- **sidebar_left**: List of tiles by name which should be rendered in sidebar.
82+
- **sidebar_left**: List of tiles by name which should be rendered in left sidebar.
83+
84+
- **sidebar_left_min_width**: Minimum left sidebar width as integer (in px).
8485

85-
- **sidebar_left_grid_width**: Sidebar grid width as integer, total grid width
86-
is 12.
86+
- **sidebar_right**: List of tiles by name which should be rendered in right sidebar.
8787

88-
- **content_grid_width**: Content grid width as integer, total grid width
89-
is 12.
88+
- **sidebar_right_min_width**: Minimum right sidebar width as integer (in px).
9089

9190
.. note::
9291

93-
As of version 1.1, ``mainmenu_fluid`` defaults to ``True``.
92+
As of version 2.0, ``limit_content_width`` defaults to ``False``.
93+
94+
.. deprecated:: 2.0
95+
96+
``mainmenu_fluid`` and ``columns_fluid`` have been removed in ``cone.app 2.0``.
97+
The ``columns_fluid`` setting has been replaced with
98+
``limit_content_width``.
9499

95100
.. deprecated:: 1.1
96101

js/src/sidebar.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class Sidebar extends ResizeAware(ts.Motion) {
9797
constructor(elem) {
9898
super(elem);
9999
this.elem = elem;
100+
this.min_width = elem.data('min-width') || 115;
100101
elem.css('width', this.sidebar_width + 'px');
101102

102103
this.moving = false;
@@ -234,7 +235,7 @@ export class Sidebar extends ResizeAware(ts.Motion) {
234235
}
235236

236237
/**
237-
* Collapses the sidebar and.
238+
* Collapses the sidebar.
238239
*/
239240
collapse() {
240241
// Enable scroll to refresh page on mobile devices
@@ -392,10 +393,9 @@ export class SidebarLeft extends Sidebar {
392393
if ($('#sidebar_right').length > 0) {
393394
sidebar_w = $('#sidebar_right').outerWidth();
394395
}
395-
const min_w = 115;
396396
// Allow a minimal content area width of 300px.
397397
const max_w = $(window).width() - sidebar_w - 300;
398-
width = Math.max(min_w, Math.min(width, max_w));
398+
width = Math.max(this.min_width, Math.min(width, max_w));
399399

400400
return parseInt(width);
401401
}
@@ -490,10 +490,9 @@ export class SidebarRight extends Sidebar {
490490
if ($('#sidebar_left').length > 0) {
491491
sidebar_w = $('#sidebar_left').outerWidth();
492492
}
493-
const min_w = 115;
494493
// Allow a minimal content area width of 300px.
495494
const max_w = $(window).width() - sidebar_w - 300;
496-
width = Math.max(min_w, Math.min(width, max_w));
495+
width = Math.max(this.min_width, Math.min(width, max_w));
497496

498497
return parseInt(width);
499498
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"rollup": "^2.79.2",
1313
"rollup-plugin-cleanup": "^3.2.1",
1414
"rollup-plugin-postcss": "^4.0.2",
15-
"sass": "^1.94.2",
15+
"sass": "^1.97.2",
1616
"web-test-runner-qunit": "^2.0.0"
1717
},
1818
"packageManager": "pnpm@9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631"

scss/colors.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $color-mode-type: data;
2020

2121
/* dark mode */
2222
@include color-mode(dark) {
23-
#content {
23+
#content_area {
2424
color: $light;
2525
background-color: $dark;
2626
}
@@ -36,7 +36,6 @@ $color-mode-type: data;
3636

3737
#footer {
3838
color: $light;
39-
background-color: $black;
4039
}
4140

4241
#contextmenu {
@@ -59,7 +58,7 @@ $color-mode-type: data;
5958

6059
/* light mode */
6160
@include color-mode(light) {
62-
#content {
61+
#content_area {
6362
color: $dark;
6463
background-color: $gray-100;
6564
}
@@ -75,7 +74,6 @@ $color-mode-type: data;
7574

7675
#footer {
7776
color: $dark;
78-
background-color: $light;
7977
}
8078

8179
#contextmenu {

scss/content.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
/* content */
44
#content {
55
container: main-content / inline-size;
6-
height: calc(100% - 40px);
6+
height: 100%;
77
width: 100%;
88
position: relative;
99
}
1010

11+
#content_area {
12+
height: 100%;
13+
}
14+
// pathbar adds 40px height to layout
15+
#content_area.has-pathbar {
16+
height: calc(100% - 40px);
17+
}
18+
1119
#main-area {
1220
width: 0!important; /* prevent 'jumping' between 1400 and 1440px */
1321
}

scss/sidebar.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
.lock-state {
2727
position: relative;
28-
top: calc(100% - 4.5rem);
28+
top: calc(100% - 2rem);
2929
width: min-content;
3030
height: 0; // required, as else it will take up space in flexbox
3131
z-index: 100;
@@ -111,7 +111,7 @@
111111

112112
.collapse_btn {
113113
position: absolute;
114-
bottom: 0px;
114+
top: 100%;
115115
border-radius: 100%;
116116
z-index: 1000;
117117
}
@@ -127,6 +127,14 @@
127127
#sidebar_collapse .collapse_btn .btn-open {
128128
display: none;
129129
}
130+
.sidebar-controls {
131+
display: none;
132+
}
133+
}
134+
&.responsive-collapsed:not(.expanded) {
135+
.sidebar-controls {
136+
display: none;
137+
}
130138
}
131139
&.expanded {
132140
#sidebar_collapse .collapse_btn .btn-closed {

scss/styles.scss

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,35 @@ select.form-control.referencebrowser[multiple="multiple"] + .referencebrowser_tr
4040
}
4141
}
4242

43+
// SCROLLBARS
44+
45+
// WebKit (Chrome, Edge, Safari, Opera)
46+
::-webkit-scrollbar {
47+
width: 6px;
48+
height: 6px;
49+
}
50+
::-webkit-scrollbar-track {
51+
background: transparent;
52+
}
53+
::-webkit-scrollbar-thumb {
54+
background: var(--bs-primary);
55+
border-radius: 3px;
56+
}
57+
58+
// Firefox ONLY (prevent scrollbar-width from affecting chromium)
59+
@supports (-moz-appearance: none) {
60+
* {
61+
scrollbar-width: auto;
62+
scrollbar-color: var(--bs-primary) transparent;
63+
}
64+
}
65+
66+
// FOOTER
67+
#footer-spacer {
68+
flex: 1; // fill available space
69+
}
70+
71+
4372
@import 'content.scss';
4473
@import 'form.scss';
4574
@import 'header.scss';

src/cone/app/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ class DefaultLayoutConfig(LayoutConfig):
6868
def __init__(self, model=None, request=None):
6969
super(DefaultLayoutConfig, self).__init__(model=model, request=request)
7070
self.mainmenu = True
71-
self.mainmenu_fluid = True
7271
self.livesearch = True
7372
self.personaltools = True
74-
self.columns_fluid = True
73+
self.limit_content_width = True
7574
self.pathbar = True
7675
self.sidebar_left_mode = 'stacked' # 'toggle' or 'stacked'
7776
self.sidebar_left = ['navtree']

src/cone/app/browser/static/cone/cone.app.css

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/* sidebar colors */
88
/* dark mode */
9-
[data-bs-theme=dark] #content {
9+
[data-bs-theme=dark] #content_area {
1010
color: #f8f9fa;
1111
background-color: #212529;
1212
}
@@ -19,7 +19,6 @@
1919
}
2020
[data-bs-theme=dark] #footer {
2121
color: #f8f9fa;
22-
background-color: #000;
2322
}
2423
[data-bs-theme=dark] #contextmenu {
2524
color: #f8f9fa;
@@ -36,7 +35,7 @@
3635
}
3736

3837
/* light mode */
39-
[data-bs-theme=light] #content {
38+
[data-bs-theme=light] #content_area {
4039
color: #212529;
4140
background-color: #f8f9fa;
4241
}
@@ -49,7 +48,6 @@
4948
}
5049
[data-bs-theme=light] #footer {
5150
color: #212529;
52-
background-color: #f8f9fa;
5351
}
5452
[data-bs-theme=light] #contextmenu {
5553
color: #212529;
@@ -107,14 +105,46 @@ select.form-control.referencebrowser[multiple=multiple] + .referencebrowser_trig
107105
width: 100%;
108106
}
109107

108+
::-webkit-scrollbar {
109+
width: 6px;
110+
height: 6px;
111+
}
112+
113+
::-webkit-scrollbar-track {
114+
background: transparent;
115+
}
116+
117+
::-webkit-scrollbar-thumb {
118+
background: var(--bs-primary);
119+
border-radius: 3px;
120+
}
121+
122+
@supports (-moz-appearance: none) {
123+
* {
124+
scrollbar-width: auto;
125+
scrollbar-color: var(--bs-primary) transparent;
126+
}
127+
}
128+
#footer-spacer {
129+
flex: 1;
130+
}
131+
110132
/* content */
111133
#content {
112134
container: main-content/inline-size;
113-
height: calc(100% - 40px);
135+
height: 100%;
114136
width: 100%;
115137
position: relative;
116138
}
117139

140+
#content_area {
141+
height: 100%;
142+
}
143+
144+
#content_area.has-pathbar {
145+
height: calc(100% - 40px);
146+
}
147+
118148
#main-area {
119149
width: 0 !important; /* prevent 'jumping' between 1400 and 1440px */
120150
}
@@ -356,7 +386,7 @@ tr.selectable td {
356386

357387
/* sidebar colors */
358388
/* dark mode */
359-
[data-bs-theme=dark] #content {
389+
[data-bs-theme=dark] #content_area {
360390
color: #f8f9fa;
361391
background-color: #212529;
362392
}
@@ -369,7 +399,6 @@ tr.selectable td {
369399
}
370400
[data-bs-theme=dark] #footer {
371401
color: #f8f9fa;
372-
background-color: #000;
373402
}
374403
[data-bs-theme=dark] #contextmenu {
375404
color: #f8f9fa;
@@ -386,7 +415,7 @@ tr.selectable td {
386415
}
387416

388417
/* light mode */
389-
[data-bs-theme=light] #content {
418+
[data-bs-theme=light] #content_area {
390419
color: #212529;
391420
background-color: #f8f9fa;
392421
}
@@ -399,7 +428,6 @@ tr.selectable td {
399428
}
400429
[data-bs-theme=light] #footer {
401430
color: #212529;
402-
background-color: #f8f9fa;
403431
}
404432
[data-bs-theme=light] #contextmenu {
405433
color: #212529;
@@ -437,7 +465,7 @@ tr.selectable td {
437465
}
438466
#sidebar_left .lock-state, #sidebar_right .lock-state {
439467
position: relative;
440-
top: calc(100% - 4.5rem);
468+
top: calc(100% - 2rem);
441469
width: min-content;
442470
height: 0;
443471
z-index: 100;
@@ -508,7 +536,7 @@ tr.selectable td {
508536
}
509537
#sidebar_left #sidebar_collapse .collapse_btn, #sidebar_right #sidebar_collapse .collapse_btn {
510538
position: absolute;
511-
bottom: 0px;
539+
top: 100%;
512540
border-radius: 100%;
513541
z-index: 1000;
514542
}
@@ -522,6 +550,12 @@ tr.selectable td {
522550
#sidebar_left.collapsed #sidebar_collapse .collapse_btn .btn-open, #sidebar_right.collapsed #sidebar_collapse .collapse_btn .btn-open {
523551
display: none;
524552
}
553+
#sidebar_left.collapsed .sidebar-controls, #sidebar_right.collapsed .sidebar-controls {
554+
display: none;
555+
}
556+
#sidebar_left.responsive-collapsed:not(.expanded) .sidebar-controls, #sidebar_right.responsive-collapsed:not(.expanded) .sidebar-controls {
557+
display: none;
558+
}
525559
#sidebar_left.expanded #sidebar_collapse .collapse_btn .btn-closed, #sidebar_right.expanded #sidebar_collapse .collapse_btn .btn-closed {
526560
display: none;
527561
}

0 commit comments

Comments
 (0)