From 6bc5426e0812600225b77e28c57fbcd4363d8d9b Mon Sep 17 00:00:00 2001 From: Alex Anto Navis L Date: Tue, 25 Aug 2020 22:51:03 +0530 Subject: [PATCH] Fixed #2904 - Recreated from another in-active PR (#3301) * Fixed #2904 - Recreated from another in-active PR - https://github.com/openMF/community-app/pull/2905 - Had merge conflicts and branch is inactive - Tested the scenarios * Fixed #2904 - Fixed the existing test --- .../organization/RoleController.js | 11 ++++ app/views/administration/roles.html | 56 +++++++++++-------- test/spec/controllers/RoleControllerSpec.js | 4 +- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/app/scripts/controllers/organization/RoleController.js b/app/scripts/controllers/organization/RoleController.js index 2c830ba1..bc572447 100644 --- a/app/scripts/controllers/organization/RoleController.js +++ b/app/scripts/controllers/organization/RoleController.js @@ -14,6 +14,17 @@ scope.isRoleEnable = function(value) { return value; }; + + if (!scope.searchCriteria.rolesFilterText) { + scope.searchCriteria.rolesFilterText = null; + scope.saveSC(); + } + scope.filterText = scope.searchCriteria.rolesFilterText || ''; + + scope.onFilter = function () { + scope.searchCriteria.rolesFilterText = scope.filterText; + scope.saveSC(); + }; } }); mifosX.ng.application.controller('RoleController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.RoleController]).run(function ($log) { diff --git a/app/views/administration/roles.html b/app/views/administration/roles.html index 83ebd648..54f14bf6 100644 --- a/app/views/administration/roles.html +++ b/app/views/administration/roles.html @@ -3,31 +3,39 @@
  • {{'label.anchor.system' | translate}}
  • {{'label.anchor.viewroles' | translate}}
  • -
    -   {{'label.button.addrole' | - translate}} -
    -
    - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}{{'label.heading.status' | translate}}
    {{role.name}}{{role.description}} -
    {{'label.heading.enabledrole' | translate }}
    -
    {{'label.heading.disabled' | translate }}
    -
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}{{'label.heading.status' | translate}}
    {{role.name}}{{role.description}} +
    {{'label.heading.enabledrole' | translate }}
    +
    {{'label.heading.disabled' | translate }}
    +
    +
    diff --git a/test/spec/controllers/RoleControllerSpec.js b/test/spec/controllers/RoleControllerSpec.js index 877dd5ee..bdc965e0 100644 --- a/test/spec/controllers/RoleControllerSpec.js +++ b/test/spec/controllers/RoleControllerSpec.js @@ -2,7 +2,9 @@ describe("RoleController", function () { var resourceCallback; beforeEach(function () { - this.scope = {}; + this.scope = jasmine.createSpyObj("$scope", ['saveSC']); + this.scope.searchCriteria = {} + this.resourceFactory = { roleResource: { getAllRoles: jasmine.createSpy('roleResource.getAllRoles()').andCallFake(function (params, callback) { resourceCallback = callback;