--- /dev/null
+
+class EntityPermissionsEditor {
+
+ constructor(elem) {
+ this.permissionsTable = elem.querySelector('[permissions-table]');
+
+ // Handle toggle all event
+ this.restrictedCheckbox = elem.querySelector('[name=restricted]');
+ this.restrictedCheckbox.addEventListener('change', this.updateTableVisibility.bind(this));
+ }
+
+ updateTableVisibility() {
+ this.permissionsTable.style.display =
+ this.restrictedCheckbox.checked
+ ? null
+ : 'none';
+ }
+}
+
+export default EntityPermissionsEditor;
\ No newline at end of file
import customCheckbox from "./custom-checkbox";
import bookSort from "./book-sort";
import settingAppColorPicker from "./setting-app-color-picker";
+import entityPermissionsEditor from "./entity-permissions-editor";
const componentMapping = {
'dropdown': dropdown,
'custom-checkbox': customCheckbox,
'book-sort': bookSort,
'setting-app-color-picker': settingAppColorPicker,
+ 'entity-permissions-editor': entityPermissionsEditor
};
window.components = {};
-<form action="{{ $model->getUrl('/permissions') }}" method="POST">
+<form action="{{ $model->getUrl('/permissions') }}" method="POST" entity-permissions-editor>
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
])
</div>
- <table permissions-table class="table permissions-table toggle-switch-list">
+ <table permissions-table class="table permissions-table toggle-switch-list" style="{{ !$model->restricted ? 'display: none' : '' }}">
<tr>
<th>{{ trans('common.role') }}</th>
<th @if($model->isA('page')) colspan="3" @else colspan="4" @endif>