Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Http/Controllers/Admin/FieldMonsterCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
27 changes: 27 additions & 0 deletions public/assets/js/monster/test-readonly-field.js
Original file line number Diff line number Diff line change
@@ -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('<a class="btn btn-warning ml-1 mb-4" href="javascript:testCrudFieldReadonlyOn()">readonlyOn()</a>');
$('nav[aria-label=breadcrumb]').append('<a class="btn btn-warning ml-1 mb-4" href="javascript:testCrudFieldReadonlyOff()">readonlyOff()</a>');

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.');
}