ソースを参照

Merge pull request #249 from ralphocdol/default-expand-mobile-navigation

Default expand mobile navigation
Svilen Markov 7 ヶ月 前
コミット
40d3053df9
3 ファイル変更15 行追加10 行削除
  1. 4 0
      docs/configuration.md
  2. 1 1
      internal/assets/templates/page.html
  3. 10 9
      internal/glance/glance.go

+ 4 - 0
docs/configuration.md

@@ -315,6 +315,7 @@ pages:
 | width | string | no | |
 | center-vertically | boolean | no | false |
 | hide-desktop-navigation | boolean | no | false |
+| expand-mobile-page-navigation | boolean | no | false |
 | show-mobile-header | boolean | no | false |
 | columns | array | yes | |
 
@@ -341,6 +342,9 @@ When set to `true`, vertically centers the content on the page. Has no effect if
 #### `hide-desktop-navigation`
 Whether to show the navigation links at the top of the page on desktop.
 
+#### `expand-mobile-page-navigation`
+Whether the mobile page navigation should be expanded by default.
+
 #### `show-mobile-header`
 Whether to show a header displaying the name of the page on mobile. The header purposefully has a lot of vertical whitespace in order to push the content down and make it easier to reach on tall devices.
 

+ 1 - 1
internal/assets/templates/page.html

@@ -46,7 +46,7 @@
             {{ 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 $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>
+            <label class="mobile-navigation-label"><input type="checkbox" class="mobile-navigation-page-links-input" autocomplete="on"{{ if .Page.ExpandMobilePageNavigation }} checked{{ end }}><div class="hamburger-icon"></div></label>
         </div>
         <div class="mobile-navigation-page-links">
             {{ template "navigation-links" . }}

+ 10 - 9
internal/glance/glance.go

@@ -68,15 +68,16 @@ type templateData struct {
 }
 
 type Page struct {
-	Title                 string   `yaml:"name"`
-	Slug                  string   `yaml:"slug"`
-	Width                 string   `yaml:"width"`
-	ShowMobileHeader      bool     `yaml:"show-mobile-header"`
-	HideDesktopNavigation bool     `yaml:"hide-desktop-navigation"`
-	CenterVertically      bool     `yaml:"center-vertically"`
-	Columns               []Column `yaml:"columns"`
-	PrimaryColumnIndex    int8     `yaml:"-"`
-	mu                    sync.Mutex
+	Title                      string   `yaml:"name"`
+	Slug                       string   `yaml:"slug"`
+	Width                      string   `yaml:"width"`
+	ShowMobileHeader           bool     `yaml:"show-mobile-header"`
+	ExpandMobilePageNavigation bool     `yaml:"expand-mobile-page-navigation"`
+	HideDesktopNavigation      bool     `yaml:"hide-desktop-navigation"`
+	CenterVertically           bool     `yaml:"center-vertically"`
+	Columns                    []Column `yaml:"columns"`
+	PrimaryColumnIndex         int8     `yaml:"-"`
+	mu                         sync.Mutex
 }
 
 func (p *Page) UpdateOutdatedWidgets() {