Skip to content

A self-hosted dashboard that puts all your feeds in one place

Allow changing max columns on split columns widget

Svilen Markovc3c7f8b14f50
diff --git a/docs/configuration.md b/docs/configuration.md
index c35df8c..bada197 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -948,6 +948,7 @@ Example:
```
### 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.
Example of a full page with an effective 4 column layout using two split column widgets inside of two full sized columns:
diff --git a/internal/assets/templates/split-column.html b/internal/assets/templates/split-column.html
index d1d3386..63b4aea 100644
--- a/internal/assets/templates/split-column.html
+++ b/internal/assets/templates/split-column.html
@@ -3,7 +3,7 @@
{{ define "widget-content-classes" }}widget-content-frameless{{ end }}
{{ define "widget-content" }}
-<div class="masonry" data-max-columns="2">
+<div class="masonry" data-max-columns="{{ .MaxColumns }}">
{{ range .Widgets }}
{{ .Render }}
{{ end }}
diff --git a/internal/widget/split-column.go b/internal/widget/split-column.go
index 88b9edb..74cb3d1 100644
--- a/internal/widget/split-column.go
+++ b/internal/widget/split-column.go
@@ -11,6 +11,7 @@ import (
type SplitColumn struct {
widgetBase `yaml:",inline"`
containerWidgetBase `yaml:",inline"`
+ MaxColumns int `yaml:"max-columns"`
}
func (widget *SplitColumn) Initialize() error {
@@ -22,6 +23,10 @@ func (widget *SplitColumn) Initialize() error {
}
}
+ if widget.MaxColumns < 2 {
+ widget.MaxColumns = 2
+ }
+
return nil
}