Sha256: 2ba7233c3f505767b143221027c1fe5ddb4ebc4b7599c4179f6207c7d7560a02

Contents?: true

Size: 659 Bytes

Versions: 4

Compression:

Stored size: 659 Bytes

Contents

document.observe("dom:loaded", function() {
  $$('.permission_manage').each(function(pm) {
    pm.observe('click', function(event) {  
      use_permission_clicked(event.element())
    });
    use_permission_clicked(pm)
  });

  function use_permission_clicked(obj) {
    var controller = obj.id.split('_')[1]
    var disabled_val = obj.checked ? 'disabled' : false;
    $('permission_' + controller + '_read').disabled = disabled_val;
    $('permission_' + controller + '_create').disabled = disabled_val;
    $('permission_' + controller + '_update').disabled = disabled_val;
    $('permission_' + controller + '_destroy').disabled = disabled_val;
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devisable-0.1.3 lib/generators/devisable/templates/partials/_permission_manage.js
devisable-0.1.2 lib/generators/devisable/templates/partials/_permission_manage.js
devisable-0.1.1 lib/generators/devisable/templates/partials/_permission_manage.js
devisable-0.1.0 lib/generators/devisable/templates/partials/_permission_manage.js