From b016e3909c36c9ebfa5c01b2d41ab0d9f577378a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 4 Jul 2017 14:34:40 +0300 Subject: [PATCH] Remove unnecessary validation code #75 --- .../create-role/create-role.component.ts | 26 +++++-------------- .../roles/edit-role/edit-role.component.html | 8 +----- .../roles/edit-role/edit-role.component.ts | 12 --------- angular/src/app/roles/roles.component.html | 11 ++------ .../create-tenant/create-tenant.component.ts | 12 --------- .../edit-tenant/edit-tenant.component.ts | 12 --------- .../create-user/create-user.component.ts | 12 --------- .../users/edit-user/edit-user.component.ts | 13 +--------- .../shared/service-proxies/service-proxies.ts | 8 +----- .../Roles/Dto/CreateRoleDto.cs | 2 -- .../SourceFiles/AbpProjectName-tr.xml | 2 ++ .../SourceFiles/AbpProjectName.xml | 1 + 12 files changed, 15 insertions(+), 104 deletions(-) diff --git a/angular/src/app/roles/create-role/create-role.component.ts b/angular/src/app/roles/create-role/create-role.component.ts index 214997af1..6f016dd1f 100644 --- a/angular/src/app/roles/create-role/create-role.component.ts +++ b/angular/src/app/roles/create-role/create-role.component.ts @@ -4,12 +4,12 @@ import { RoleServiceProxy, CreateRoleDto, ListResultDtoOfPermissionDto } from '@ import { AppComponentBase } from '@shared/app-component-base'; @Component({ - selector: 'create-role-modal', - templateUrl: './create-role.component.html' + selector: 'create-role-modal', + templateUrl: './create-role.component.html' }) export class CreateRoleComponent extends AppComponentBase implements OnInit { -@ViewChild('createRoleModal') modal: ModalDirective; -@ViewChild('modalContent') modalContent: ElementRef; + @ViewChild('createRoleModal') modal: ModalDirective; + @ViewChild('modalContent') modalContent: ElementRef; active: boolean = false; saving: boolean = false; @@ -27,8 +27,7 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit { ngOnInit(): void { this._roleService.getAllPermissions() - .subscribe((permissions:ListResultDtoOfPermissionDto) => - { + .subscribe((permissions: ListResultDtoOfPermissionDto) => { this.permissions = permissions; }); } @@ -42,31 +41,20 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit { onShown(): void { $.AdminBSB.input.activate($(this.modalContent.nativeElement)); - - $('#frm_create_role').validate({ - highlight: input => { - $(input).parents('.form-line').addClass('error'); - }, - unhighlight: input => { - $(input).parents('.form-line').removeClass('error'); - }, - errorPlacement: (error, element) => { - $(element).parents('.form-group').append(error); - } - }); } save(): void { var permissions = []; $(this.modalContent.nativeElement).find("[name=permission]").each( (index: number, elem: Element) => { - if ($(elem).is(":checked") == true) { + if ($(elem).is(":checked")) { permissions.push(elem.getAttribute("value").valueOf()); } } ); this.role.permissions = permissions; + this.saving = true; this._roleService.create(this.role) .finally(() => { this.saving = false; }) diff --git a/angular/src/app/roles/edit-role/edit-role.component.html b/angular/src/app/roles/edit-role/edit-role.component.html index bf0e94b10..3e586f137 100644 --- a/angular/src/app/roles/edit-role/edit-role.component.html +++ b/angular/src/app/roles/edit-role/edit-role.component.html @@ -10,7 +10,7 @@ -
-
-

Static Role

-
-
-

Permissions

diff --git a/angular/src/app/roles/edit-role/edit-role.component.ts b/angular/src/app/roles/edit-role/edit-role.component.ts index 533c748f1..1511eade1 100644 --- a/angular/src/app/roles/edit-role/edit-role.component.ts +++ b/angular/src/app/roles/edit-role/edit-role.component.ts @@ -46,18 +46,6 @@ export class EditRoleComponent extends AppComponentBase implements OnInit { onShown(): void { $.AdminBSB.input.activate($(this.modalContent.nativeElement)); - - $('#frm_edit_role').validate({ - highlight: function (input) { - $(input).parents('.form-line').addClass('error'); - }, - unhighlight: function (input) { - $(input).parents('.form-line').removeClass('error'); - }, - errorPlacement: function (error, element) { - $(element).parents('.form-group').append(error); - } - }); } checkPermission(permissionName: string): string { diff --git a/angular/src/app/roles/roles.component.html b/angular/src/app/roles/roles.component.html index c5af233fd..2f7de9688 100644 --- a/angular/src/app/roles/roles.component.html +++ b/angular/src/app/roles/roles.component.html @@ -23,21 +23,14 @@

{{l('RoleName')}} - {{l('Description')}} - -
{{l('IsActive')}}
- + {{l('DisplayName')}} {{l('Actions')}} + {{role.name}} {{role.displayName}} - {{role.description}} - - check_box - indeterminate_check_box -