File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+ class EntityPermissionsEditor {
3+
4+ constructor ( elem ) {
5+ this . permissionsTable = elem . querySelector ( '[permissions-table]' ) ;
6+
7+ // Handle toggle all event
8+ this . restrictedCheckbox = elem . querySelector ( '[name=restricted]' ) ;
9+ this . restrictedCheckbox . addEventListener ( 'change' , this . updateTableVisibility . bind ( this ) ) ;
10+ }
11+
12+ updateTableVisibility ( ) {
13+ this . permissionsTable . style . display =
14+ this . restrictedCheckbox . checked
15+ ? null
16+ : 'none' ;
17+ }
18+ }
19+
20+ export default EntityPermissionsEditor ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import permissionsTable from "./permissions-table";
2626import customCheckbox from "./custom-checkbox" ;
2727import bookSort from "./book-sort" ;
2828import settingAppColorPicker from "./setting-app-color-picker" ;
29+ import entityPermissionsEditor from "./entity-permissions-editor" ;
2930
3031const componentMapping = {
3132 'dropdown' : dropdown ,
@@ -56,6 +57,7 @@ const componentMapping = {
5657 'custom-checkbox' : customCheckbox ,
5758 'book-sort' : bookSort ,
5859 'setting-app-color-picker' : settingAppColorPicker ,
60+ 'entity-permissions-editor' : entityPermissionsEditor
5961} ;
6062
6163window . components = { } ;
Original file line number Diff line number Diff line change 1- <form action =" {{ $model -> getUrl (' /permissions' ) } }" method =" POST" >
1+ <form action =" {{ $model -> getUrl (' /permissions' ) } }" method =" POST" entity-permissions-editor >
22 {!! csrf_field () ! !}
33 <input type =" hidden" name =" _method" value =" PUT" >
44
1111 ] )
1212 </div >
1313
14- <table permissions-table class =" table permissions-table toggle-switch-list" >
14+ <table permissions-table class =" table permissions-table toggle-switch-list" style = " {{ ! $model -> restricted ? ' display: none ' : ' ' } } " >
1515 <tr >
1616 <th >{{ trans (' common.role' ) } } </th >
1717 <th @if ($model -> isA (' page' ) ) colspan =" 3" @else colspan =" 4" @endif >
You can’t perform that action at this time.
0 commit comments