Allow changing max columns on split columns widget
This commit is contained in:
parent
863d4f117b
commit
c3c7f8b14f
3 changed files with 7 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue