From c3c7f8b14f50793eae0d0ed5f9df80a2f70f7169 Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:23:39 +0000 Subject: [PATCH] Allow changing max columns on split columns widget --- docs/configuration.md | 1 + internal/assets/templates/split-column.html | 2 +- internal/widget/split-column.go | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) 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 + 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" }} -
+
{{ 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 }