QuantEcon / quantecon-book-theme

A Jupyter Book Theme for QuantEcon Book Style Projects
BSD 3-Clause "New" or "Revised" License
41 stars 21 forks source link

👌 IMPROVE: Lhs menubar persistent #143

Closed DrDrij closed 3 years ago

DrDrij commented 3 years ago

This PR adds a function call if a sidebar status has been set in localStorage. If the sidebar is open, it will stay open across pages and sessions (persistent). Fixes #131

A variable check has been added {% if persistent_sidebar is defined and persistent_sidebar is sameas true %}. If true the sidebar will be persistent. Config entry being: persistent_sidebar: true

image
codecov[bot] commented 3 years ago

Codecov Report

Merging #143 (7c1229e) into master (13d5f7a) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #143   +/-   ##
=======================================
  Coverage   72.29%   72.29%           
=======================================
  Files           2        2           
  Lines         231      231           
=======================================
  Hits          167      167           
  Misses         64       64           
Flag Coverage Δ
pytests 72.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 13d5f7a...7c1229e. Read the comment docs.

DrDrij commented 3 years ago

Need to add a config option to toggle the persistent sidebar.

DrDrij commented 3 years ago

Tested with variable but doesn't seem to be working. I think the Jinja logic looks ok. Have I missed something obvious @AakashGfude ?

AakashGfude commented 3 years ago

@DrDrij needed to add the variable in theme.conf.j2 and use theme_persistent_sidebar instead of persistent_sidebar as sphinx attaches theme_ for each HTML theme option variable.

Using it inside:

sphinx:
  config:
    html_theme_options:
      persistent_sidebar: true
DrDrij commented 3 years ago

Thanks @AakashGfude. I think this is ready — however the new variable needs to be added to lecture source config. What would be the best way to proceed/test build here @mmcky?

mmcky commented 3 years ago

hey @DrDrij we open a PR on lecture-python.myst and mark it as [TEST] <description> and update the environment.yml to replace quantecon-book-theme=0.2.x with

git+https://github.com/quantecon/quantecon-book-theme@lhs-menubar-sticky
mmcky commented 3 years ago

@DrDrij I linked a test case above for you to look at for the python.quantecon.org site.

@AakashGfude can you document (if it isn't already) how to regenerate the fixtures for @DrDrij -- I am guessing that is what is causing the ci issues?

AakashGfude commented 3 years ago

@mmcky the ci issue is caused by codecov which I mentioned yesterday. Getting back to it now.