Skip to main content

force_app_navigation_state

force_app_navigation_state is a hook which forces the app navigation sidebar's state to :open or :closed on page load.

General

Whenever the sidebar's state is toggled by a user the state is saved as a preference in a cookie. The sidebar will keep that state across pages and visits. This hook temporarily overrides the user's preference wherever it is set. However, it does not overwrite the user's preference.

This is a Standard (3-Option) Hook, which can be set as normal.

Usage

The sidebar's forced-state is controlled by this hook using one of two values:

  • :open
  • :closed

All other values are ignored.

Examples

<%= content_for :force_app_navigation_state, :open %>