Sha256: 53766adacc2ce0f2f5a53059fcc0fd5cc5c40eefb403127e92a6436425f1aa01

Contents?: true

Size: 1.94 KB

Versions: 5

Compression:

Stored size: 1.94 KB

Contents

//= require jquery
//= require jquery_ujs
//= require active_admin/base

$(function() {
  $(document).on('click touchstart', '#sidebar', function(e) {
    var position = $(this).position();
    var width = $(this).width();
    var target = e.target;
    if ((e.pageX < position.left) && (target.tagName != 'SELECT') && (target.tagName != 'OPTION')) {
      if ($(this).css('right') == '0px') {
        $(this).css('position', 'fixed');
        $(this).animate({
          right: "-="+width
        }, 600, function() {
          $(this).removeAttr('style');
          animationFilterDone = true;
        });
      } else {
        $(this).animate({
          right: "+="+width
        }, 600, function() {
          $(this).css('position', 'absolute');
          animationFilterDone = true;
        });
      }
    }
  });

  var animationDone = true;
  $(document).on('click touchstart', '#utility_nav', function(e) {
    var position = $(this).position();
    var tabs = $('#tabs');
    var width = Math.round(tabs[0].getBoundingClientRect().width);

    if (e.pageX < (position.left + 40)) {
      if(animationDone == true) {
        animationDone = false;
        if (tabs.css('left') == '0px') {
          tabs.animate({
            left: "-="+width
          }, 400, function() {
            animationDone = true;
          });
        } else {
          tabs.animate({
            left: "+="+width
          }, 400, function() {
            animationDone = true;
          });
        }
      }
    }
  });

  $(document).on('click touchstart', 'body', function(e) {
    var tabs = $('#tabs');
    var width = Math.round(tabs[0].getBoundingClientRect().width);
    if (tabs.css('left') == '0px') {
      if (e.pageX > width && e.pageY > 60) {
        if(animationDone == true) {
          animationDone = false;
          tabs.animate({
            left: "-="+width
          }, 400, function() {
            animationDone = true;
          });
        }
      }
    }
  });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arctic_admin-2.0.2 app/assets/javascripts/arctic_admin/base.js
arctic_admin-2.0.1 app/assets/javascripts/arctic_admin/base.js
arctic_admin-2.0.0 app/assets/javascripts/arctic_admin/base.js
arctic_admin-1.5.2 app/assets/javascripts/arctic_admin/base.js
arctic_admin-1.5.1 app/assets/javascripts/arctic_admin/base.js