diff --git a/app/Http/Controllers/Admin/FieldMonsterCrudController.php b/app/Http/Controllers/Admin/FieldMonsterCrudController.php index 64f2a8d47..0e1459ace 100644 --- a/app/Http/Controllers/Admin/FieldMonsterCrudController.php +++ b/app/Http/Controllers/Admin/FieldMonsterCrudController.php @@ -33,6 +33,7 @@ protected function setupCreateOperation() Widget::add()->type('script')->content('assets/js/monster/test-unrequire-field.js'); Widget::add()->type('script')->content('assets/js/monster/test-custom-field.js'); Widget::add()->type('script')->content('assets/js/monster/test-onchange-field.js'); + Widget::add()->type('script')->content('assets/js/monster/test-readonly-field.js'); } protected function setupFieldsForTopScenarios() diff --git a/public/assets/js/monster/test-readonly-field.js b/public/assets/js/monster/test-readonly-field.js new file mode 100644 index 000000000..b010bd9dd --- /dev/null +++ b/public/assets/js/monster/test-readonly-field.js @@ -0,0 +1,27 @@ +/** + * This file tests the crud.field('name').readonly() method + * on all Monster field types, assuming the fields.js + * file is already loaded. + */ + +$('nav[aria-label=breadcrumb]').append('readonlyOn()'); +$('nav[aria-label=breadcrumb]').append('readonlyOff()'); + +function testCrudFieldReadonlyOn() { + // go through all Monster fields and disable them + for (var i = 0; i <= monsterFields.length - 1; i++) { + crud.field(monsterFields[i]).readonly(); + } + + alert('Calling readonly() on all monster fields. If you can see a field that is NOT readonly... then readonly() might not work on it, please investigate.'); +} + +function testCrudFieldReadonlyOff() { + // go through all Monster fields and disable them + for (var i = 0; i <= monsterFields.length - 1; i++) { + crud.field(monsterFields[i]).readonly(false); + } + + alert('Calling readonly(false) on all monster fields. If you can see a field that is STILL readonly after... then readonly() might not work on it, please investigate.'); +} +