Make the first full column the primary on mobile rather than the last
This commit is contained in:
parent
ab0b11cc92
commit
3cfbe65855
2 changed files with 17 additions and 7 deletions
|
@ -44,7 +44,7 @@
|
|||
<div class="mobile-navigation-icons">
|
||||
<a class="mobile-navigation-label" href="#top">↑</a>
|
||||
{{ 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 }}
|
||||
<label class="mobile-navigation-label"><input type="checkbox" class="mobile-navigation-page-links-input" autocomplete="on"><div class="hamburger-icon"></div></label>
|
||||
</div>
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue