mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 18:31:24 +02:00
Make the first full column the primary on mobile rather than the last
This commit is contained in:
parent
ab0b11cc92
commit
3cfbe65855
@ -44,7 +44,7 @@
|
|||||||
<div class="mobile-navigation-icons">
|
<div class="mobile-navigation-icons">
|
||||||
<a class="mobile-navigation-label" href="#top">↑</a>
|
<a class="mobile-navigation-label" href="#top">↑</a>
|
||||||
{{ range $i, $column := .Page.Columns }}
|
{{ range $i, $column := .Page.Columns }}
|
||||||
<label class="mobile-navigation-label"><input type="radio" class="mobile-navigation-input" name="column" value="{{ $i }}" autocomplete="off"{{ if eq "full" $column.Size }} checked{{ end }}><div class="mobile-navigation-pill"></div></label>
|
<label class="mobile-navigation-label"><input type="radio" class="mobile-navigation-input" name="column" value="{{ $i }}" autocomplete="off"{{ if eq $i $.Page.PrimaryColumnIndex }} checked{{ end }}><div class="mobile-navigation-pill"></div></label>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<label class="mobile-navigation-label"><input type="checkbox" class="mobile-navigation-page-links-input" autocomplete="on"><div class="hamburger-icon"></div></label>
|
<label class="mobile-navigation-label"><input type="checkbox" class="mobile-navigation-page-links-input" autocomplete="on"><div class="hamburger-icon"></div></label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -75,6 +75,7 @@ type Page struct {
|
|||||||
HideDesktopNavigation bool `yaml:"hide-desktop-navigation"`
|
HideDesktopNavigation bool `yaml:"hide-desktop-navigation"`
|
||||||
CenterVertically bool `yaml:"center-vertically"`
|
CenterVertically bool `yaml:"center-vertically"`
|
||||||
Columns []Column `yaml:"columns"`
|
Columns []Column `yaml:"columns"`
|
||||||
|
PrimaryColumnIndex int8 `yaml:"-"`
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,15 +141,24 @@ func NewApplication(config *Config) (*Application, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for p := range config.Pages {
|
for p := range config.Pages {
|
||||||
if config.Pages[p].Slug == "" {
|
page := &config.Pages[p]
|
||||||
config.Pages[p].Slug = titleToSlug(config.Pages[p].Title)
|
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 c := range page.Columns {
|
||||||
for w := range config.Pages[p].Columns[c].Widgets {
|
column := &page.Columns[c]
|
||||||
widget := config.Pages[p].Columns[c].Widgets[w]
|
|
||||||
|
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
|
app.widgetByID[widget.GetID()] = widget
|
||||||
|
|
||||||
widget.SetProviders(providers)
|
widget.SetProviders(providers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user