From 32244e3d9e93bd3170fa44995e37a7f26e685cd0 Mon Sep 17 00:00:00 2001 From: Dawid Mydlo Date: Tue, 4 Dec 2018 10:54:29 +0100 Subject: [PATCH] hide link to LS Dashboard in menu behind feature flag --- .../static/icds_reports/js/spec/navigation.directive.spec.js | 4 +++- .../static/js/directives/navigation/navigation.directive.js | 5 +++-- .../icds_reports/icds_app/navigation.directive.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/custom/icds_reports/static/icds_reports/js/spec/navigation.directive.spec.js b/custom/icds_reports/static/icds_reports/js/spec/navigation.directive.spec.js index df73965875df..4d511ed1931a 100644 --- a/custom/icds_reports/static/icds_reports/js/spec/navigation.directive.spec.js +++ b/custom/icds_reports/static/icds_reports/js/spec/navigation.directive.spec.js @@ -11,7 +11,9 @@ describe('Navigation Directive', function () { var $rootScope, $compile, $httpBackend, controller; var myScope; - beforeEach(module('icdsApp')); + beforeEach(module('icdsApp', function ($provide) { + $provide.constant("haveAccessToFeatures", false); + })); beforeEach(inject(function (_$rootScope_, _$compile_, _$httpBackend_) { $compile = _$compile_; diff --git a/custom/icds_reports/static/js/directives/navigation/navigation.directive.js b/custom/icds_reports/static/js/directives/navigation/navigation.directive.js index 560fc24ceff6..f38fb993cd58 100644 --- a/custom/icds_reports/static/js/directives/navigation/navigation.directive.js +++ b/custom/icds_reports/static/js/directives/navigation/navigation.directive.js @@ -2,10 +2,11 @@ var url = hqImport('hqwebapp/js/initial_page_data').reverse; -function NavigationController($window, $scope, $route, $routeParams, $location) { +function NavigationController($window, $scope, $route, $routeParams, $location, haveAccessToFeatures) { $scope.$route = $route; $scope.$location = $location; $scope.$routeParams = $routeParams; + $scope.haveAccessToFeatures = haveAccessToFeatures; var checkColapse = function(reports) { var path = _.filter(reports, function(report) { return $location.path().indexOf(report) !== -1; }); @@ -37,7 +38,7 @@ function NavigationController($window, $scope, $route, $routeParams, $location) }; } -NavigationController.$inject = ['$window', '$scope', '$route', '$routeParams', '$location']; +NavigationController.$inject = ['$window', '$scope', '$route', '$routeParams', '$location', 'haveAccessToFeatures']; window.angular.module('icdsApp').directive('navigation', function() { return { diff --git a/custom/icds_reports/templates/icds_reports/icds_app/navigation.directive.html b/custom/icds_reports/templates/icds_reports/icds_app/navigation.directive.html index a4ac0aae88b9..a7a613724559 100644 --- a/custom/icds_reports/templates/icds_reports/icds_app/navigation.directive.html +++ b/custom/icds_reports/templates/icds_reports/icds_app/navigation.directive.html @@ -137,7 +137,7 @@
{% trans "AWC Report" %}
-
  • +
  • {% trans "LS Dashboard" %}