mirror of
https://github.com/Xevion/glance.git
synced 2025-12-17 18:12:02 -06:00
Make the first full column the primary on mobile rather than the last
This commit is contained in:
@@ -75,6 +75,7 @@ type Page struct {
|
||||
HideDesktopNavigation bool `yaml:"hide-desktop-navigation"`
|
||||
CenterVertically bool `yaml:"center-vertically"`
|
||||
Columns []Column `yaml:"columns"`
|
||||
PrimaryColumnIndex int8 `yaml:"-"`
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
@@ -140,15 +141,24 @@ func NewApplication(config *Config) (*Application, error) {
|
||||
}
|
||||
|
||||
for p := range config.Pages {
|
||||
if config.Pages[p].Slug == "" {
|
||||
config.Pages[p].Slug = titleToSlug(config.Pages[p].Title)
|
||||
page := &config.Pages[p]
|
||||
page.PrimaryColumnIndex = -1
|
||||
|
||||
if page.Slug == "" {
|
||||
page.Slug = titleToSlug(page.Title)
|
||||
}
|
||||
|
||||
app.slugToPage[config.Pages[p].Slug] = &config.Pages[p]
|
||||
app.slugToPage[page.Slug] = page
|
||||
|
||||
for c := range config.Pages[p].Columns {
|
||||
for w := range config.Pages[p].Columns[c].Widgets {
|
||||
widget := config.Pages[p].Columns[c].Widgets[w]
|
||||
for c := range page.Columns {
|
||||
column := &page.Columns[c]
|
||||
|
||||
if page.PrimaryColumnIndex == -1 && column.Size == "full" {
|
||||
page.PrimaryColumnIndex = int8(c)
|
||||
}
|
||||
|
||||
for w := range column.Widgets {
|
||||
widget := column.Widgets[w]
|
||||
app.widgetByID[widget.GetID()] = widget
|
||||
|
||||
widget.SetProviders(providers)
|
||||
|
||||
Reference in New Issue
Block a user