Sha256: e942fb4ed6975b5bd346c38089b5b1da63ae9e51b23c802268d83544dd38f7be

Contents?: true

Size: 559 Bytes

Versions: 7

Compression:

Stored size: 559 Bytes

Contents

(function($) {
  authorize_elements = function(roles) {
    if($.inArray('superuser', roles) > -1) {
      var elements = $('.visible_for');
    } else {
      var elements = [];
      $.each(roles, function() {
        $.each($('.' + this.toString()), function() {
          elements.push(this);
        });
      });
    }

    $.each(elements, function() {
      element = $(this);
      if(element) {
        element.removeClass('visible_for');
      }
    })
  }

  $(document).ready(function() {
    authorize_elements(['anonymous']);
  });
})(jQuery);

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
adva-0.1.4 app/assets/javascripts/adva_cms/jquery.roles.js
adva-0.1.3 app/assets/javascripts/adva_cms/jquery.roles.js
adva-0.1.2 app/assets/javascripts/adva_cms/jquery.roles.js
adva-0.1.1 app/assets/javascripts/adva_cms/jquery.roles.js
adva-0.1.0 app/assets/javascripts/adva_cms/jquery.roles.js
adva_cms-0.0.1 app/assets/javascripts/adva_cms/jquery.roles.js
adva-0.0.1 adva_cms/app/assets/javascripts/adva_cms/jquery.roles.js