@@ -4,12 +4,12 @@ import { RoleServiceProxy, CreateRoleDto, ListResultDtoOfPermissionDto } from '@
44import { AppComponentBase } from '@shared/app-component-base' ;
55
66@Component ( {
7- selector : 'create-role-modal' ,
8- templateUrl : './create-role.component.html'
7+ selector : 'create-role-modal' ,
8+ templateUrl : './create-role.component.html'
99} )
1010export class CreateRoleComponent extends AppComponentBase implements OnInit {
11- @ViewChild ( 'createRoleModal' ) modal : ModalDirective ;
12- @ViewChild ( 'modalContent' ) modalContent : ElementRef ;
11+ @ViewChild ( 'createRoleModal' ) modal : ModalDirective ;
12+ @ViewChild ( 'modalContent' ) modalContent : ElementRef ;
1313
1414 active : boolean = false ;
1515 saving : boolean = false ;
@@ -27,8 +27,7 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit {
2727
2828 ngOnInit ( ) : void {
2929 this . _roleService . getAllPermissions ( )
30- . subscribe ( ( permissions :ListResultDtoOfPermissionDto ) =>
31- {
30+ . subscribe ( ( permissions : ListResultDtoOfPermissionDto ) => {
3231 this . permissions = permissions ;
3332 } ) ;
3433 }
@@ -42,31 +41,20 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit {
4241
4342 onShown ( ) : void {
4443 $ . AdminBSB . input . activate ( $ ( this . modalContent . nativeElement ) ) ;
45-
46- $ ( '#frm_create_role' ) . validate ( {
47- highlight : input => {
48- $ ( input ) . parents ( '.form-line' ) . addClass ( 'error' ) ;
49- } ,
50- unhighlight : input => {
51- $ ( input ) . parents ( '.form-line' ) . removeClass ( 'error' ) ;
52- } ,
53- errorPlacement : ( error , element ) => {
54- $ ( element ) . parents ( '.form-group' ) . append ( error ) ;
55- }
56- } ) ;
5744 }
5845
5946 save ( ) : void {
6047 var permissions = [ ] ;
6148 $ ( this . modalContent . nativeElement ) . find ( "[name=permission]" ) . each (
6249 ( index : number , elem : Element ) => {
63- if ( $ ( elem ) . is ( ":checked" ) == true ) {
50+ if ( $ ( elem ) . is ( ":checked" ) ) {
6451 permissions . push ( elem . getAttribute ( "value" ) . valueOf ( ) ) ;
6552 }
6653 }
6754 ) ;
6855
6956 this . role . permissions = permissions ;
57+
7058 this . saving = true ;
7159 this . _roleService . create ( this . role )
7260 . finally ( ( ) => { this . saving = false ; } )
0 commit comments