← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21949: tracker-capture: while in first page of tracker capture, focus search field

 

------------------------------------------------------------
revno: 21949
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-02-11 14:47:50 +0100
message:
  tracker-capture: while in first page of tracker capture, focus search field
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2016-02-11 13:25:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2016-02-11 13:47:50 +0000
@@ -47,7 +47,7 @@
     
     //Searching
     $scope.showSearchDiv = false;
-    $scope.searchText = null;
+    $scope.model = {searchText: null};
     $scope.searchFilterExists = false;   
     $scope.defaultOperators = OperatorFactory.defaultOperators;
     $scope.boolOperators = OperatorFactory.boolOperators;
@@ -83,7 +83,7 @@
             SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
             
             $scope.trackedEntityList = null;            
-            $scope.searchText = null;
+            $scope.model.searchText = null;
             
             $scope.optionSets = CurrentSelection.getOptionSets();
             
@@ -182,7 +182,7 @@
         resetParams();
         $scope.selectedProgram = program;
         $scope.trackedEntityList = null;
-        $scope.searchText = null;
+        $scope.model.searchText = null;
         $scope.processAttributes();              
     };
     
@@ -248,8 +248,8 @@
         //check search mode
         if( $scope.selectedSearchMode === $scope.searchMode.freeText ){
             
-            if($scope.searchText){
-                $scope.queryUrl = 'query=LIKE:' + $scope.searchText;
+            if($scope.model.searchText){
+                $scope.queryUrl = 'query=LIKE:' + $scope.model.searchText;
             }
             else{
                 if(!$scope.selectedProgram || !$scope.selectedProgram.displayFrontPageList){
@@ -265,7 +265,7 @@
         
         if( $scope.selectedSearchMode === $scope.searchMode.attributeBased ){
             
-            $scope.searchText = null;
+            $scope.model.searchText = null;
             
             $scope.attributeUrl = EntityQueryFactory.getAttributesQuery($scope.attributes, $scope.enrollment);
             
@@ -279,7 +279,7 @@
         }
         
         if( $scope.selectedSearchMode === $scope.searchMode.listAll ){
-            $scope.searchText = null;            
+            $scope.model.searchText = null;            
             $scope.attributes = EntityQueryFactory.resetAttributesQuery($scope.attributes, $scope.enrollment);
             $scope.searchingOrgUnit = $scope.selectedSearchingOrgUnit && $scope.selectedSearchingOrgUnit.id ? $scope.selectedSearchingOrgUnit : $scope.selectedOrgUnit;
         }

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2016-02-11 13:25:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2016-02-11 13:47:50 +0000
@@ -39,12 +39,16 @@
 
 <div class="page" id="mainPage">
 
+    <!--- selected org unit begins -->
+    <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
+    <!--- selected org unit ends  -->
+        
     <div ng-if="treeLoaded && !selectedOrgUnit">
         <img src="../images/ajax-loader-bar.gif" alt="{{'in_progress'| translate}}"/><br>
         {{'loading_metadata'| translate}}
     </div> 
 
-    <div ng-show="selectedOrgUnit">
+    <div ng-show="selectedOrgUnit && selectedOrgUnit.id">
         
         <!-- top bar begins -->
         <div class="row top-bar">        
@@ -53,11 +57,7 @@
             </div>        
         </div>
         <!-- top bar ends -->
-
-        <!--- selected org unit begins -->
-        <input type="text" selected-org-unit ng-model="selectedOrgUnit.name" ng-hide=true>
-        <!--- selected org unit ends  -->
-
+        
         <!--- search and registration menu begins -->        
         <div class="row">
             
@@ -77,7 +77,7 @@
 
             <!-- simple/advanced search begins -->
             <div id="searchDropDownParent" class="input-group col-md-4 hideInPrint">
-                <input type="text" placeholder="{{searchCriteriaLabel}}" ng-model="searchText" class="form-control expanded" d2-enter="search(searchMode.freeText)" ng-class="{true: 'invalid - input'} [!searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv" d2-set-focus={{doSearch}}>
+                <input type="text" ng-if="selectedOrgUnit.id" placeholder="{{searchCriteriaLabel}}" ng-model="model.searchText" class="form-control expanded" d2-enter="search(searchMode.freeText)" ng-class="{true: 'invalid - input'} [!model.searchText && emptySearchText]" ng-focus="showHideSearch()" ng-disabled="showRegistrationDiv" d2-set-focus={{doSearch}}>
                 <div class="input-group-btn">
                     <button class="btn btn-default search-dropdown-button trim" type="button" title="{{advancedSearchLabel}}" data-toggle="dropdown" ng-disabled="showRegistrationDiv"><i class="fa fa-caret-down"></i></button>
                     <button class="btn btn-primary trim" type="button" title="{{searchLabel}}" ng-disabled="showRegistrationDiv" ng-click="search(searchMode.freeText)"><i class="fa fa-search"></i></button>
@@ -116,7 +116,7 @@
         <!--- search and registration menu ends -->
 
         <!--- Error display for search begins -->
-        <div class="vertical-spacing" ng-if="emptySearchAttribute || !searchText && emptySearchText">
+        <div class="vertical-spacing" ng-if="emptySearchAttribute || !model.searchText && emptySearchText">
             <div class="alert alert-warning">{{'search_input_required'| translate}}</div>
         </div>
         <!--- Error display for search ends -->