mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 18:31:24 +02:00
Allow changing max columns on split columns widget
This commit is contained in:
parent
863d4f117b
commit
c3c7f8b14f
@ -948,6 +948,7 @@ Example:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Split Column
|
### Split Column
|
||||||
|
<!-- TODO: update -->
|
||||||
Splits a full sized column in half, allowing you to place widgets side by side. This is converted to a single column on mobile devices or if not enough width is available. Widgets are defined using a `widgets` property exactly as you would on a page column.
|
Splits a full sized column in half, allowing you to place widgets side by side. This is converted to a single column on mobile devices or if not enough width is available. Widgets are defined using a `widgets` property exactly as you would on a page column.
|
||||||
|
|
||||||
Example of a full page with an effective 4 column layout using two split column widgets inside of two full sized columns:
|
Example of a full page with an effective 4 column layout using two split column widgets inside of two full sized columns:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{{ define "widget-content-classes" }}widget-content-frameless{{ end }}
|
{{ define "widget-content-classes" }}widget-content-frameless{{ end }}
|
||||||
|
|
||||||
{{ define "widget-content" }}
|
{{ define "widget-content" }}
|
||||||
<div class="masonry" data-max-columns="2">
|
<div class="masonry" data-max-columns="{{ .MaxColumns }}">
|
||||||
{{ range .Widgets }}
|
{{ range .Widgets }}
|
||||||
{{ .Render }}
|
{{ .Render }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
type SplitColumn struct {
|
type SplitColumn struct {
|
||||||
widgetBase `yaml:",inline"`
|
widgetBase `yaml:",inline"`
|
||||||
containerWidgetBase `yaml:",inline"`
|
containerWidgetBase `yaml:",inline"`
|
||||||
|
MaxColumns int `yaml:"max-columns"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *SplitColumn) Initialize() error {
|
func (widget *SplitColumn) Initialize() error {
|
||||||
@ -22,6 +23,10 @@ func (widget *SplitColumn) Initialize() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if widget.MaxColumns < 2 {
|
||||||
|
widget.MaxColumns = 2
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user