Sha256: 15a2ef05cb17b334603d588fe1cff42938ecd93e67d21ae51646f0fdbf89f5f1

Contents?: true

Size: 1.06 KB

Versions: 77

Compression:

Stored size: 1.06 KB

Contents

Spree.ready(function() {
  if (window.screen.width <= 1024 && !document.cookie.includes("admin_nav_hidden")) {
    // Set default nav to collapse on small screens - but don't override user preference
    document.body.classList.add("admin-nav-hidden");
    document.cookie = "admin_nav_hidden=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
  }

  var adminNavToggle = document.querySelector("#admin-nav-toggle");

  if (adminNavToggle) {
    adminNavToggle.addEventListener("click", function(e) {
      e.preventDefault();
      document.body.classList.toggle("admin-nav-hidden");
      $(document.body).trigger("sticky_kit:recalc");
      adminNavToggle.classList.toggle("fa-chevron-circle-left");
      adminNavToggle.classList.toggle("fa-chevron-circle-right");
      document.cookie = "admin_nav_hidden=" + document.body.classList.contains("admin-nav-hidden") + "; expires=Fri, 31 Dec 9999 23:59:59 GMT";
    });
  }

  if (document.body.classList.contains('admin-nav-hidden')) {
    $(adminNavToggle).removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right');
  }
});

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
solidus_backend-4.1.5 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.1.4 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.1.3 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.0.4 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.4.6 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.0.3 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.1.2 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.4.5 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.1.1 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.0.2 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.4.4 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.3.4 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.2.9 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.2.8 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.3.3 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.4.3 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.0.1 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.1.0 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-4.0.0 app/assets/javascripts/spree/backend/components/admin_nav.js
solidus_backend-3.4.2 app/assets/javascripts/spree/backend/components/admin_nav.js