← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16554: event capture - bug fix in saving boolean types

 

------------------------------------------------------------
revno: 16554
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-08-28 14:23:08 +0200
message:
  event capture - bug fix in saving boolean types
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.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-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2014-08-21 16:30:01 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2014-08-28 12:23:08 +0000
@@ -262,9 +262,10 @@
                                             this.getAttributesAsString(attributes) +
                                             ' ng-model="currentEvent.' + deId + '" ' +
                                             ' ng-required="programStageDataElements.' + deId + '.compulsory">' + 
-                                            'option value="">{{\'please_select\'| translate}}</option>' +
-                                            '<option value="0">{{\'no\'| translate}}</option>' + 
-                                            '<option value="1">{{\'yes\'| translate}}</option>';
+                                            '<option value="">{{\'please_select\'| translate}}</option>' +
+                                            '<option value="false">{{\'no\'| translate}}</option>' + 
+                                            '<option value="true">{{\'yes\'| translate}}</option>' +
+                                            '</select>';
                         }
                         if(programStageDataElements[deId].dataElement.type == "date"){
                             newInputField = '<input type="text" ' +

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2014-08-22 11:29:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2014-08-28 12:23:08 +0000
@@ -116,10 +116,10 @@
                                 <select ng-model="currentEvent[eventGridColumn.id]"                                                                
                                         ng-required={{eventGridColumn.compulsory}}
                                         name="foo" 
-                                        style="width:99%;"/>
+                                        style="width:99%;">
                                 <option value="">{{'please_select'| translate}}</option>                        
-                                <option value="0">{{'no'| translate}}</option>
-                                <option value="1">{{'yes'| translate}}</option>
+                                <option value="false">{{'no'| translate}}</option>
+                                <option value="true">{{'yes'| translate}}</option>
                                 </select>
                                 <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
                             </div>
@@ -282,10 +282,10 @@
                                         <select ng-model="currentEvent[de.dataElement.id]"                                                                
                                                 ng-required={{programStageDataElements[de.dataElement.id].compulsory}}
                                                 name="foo" 
-                                                style="width:99%;"/>
+                                                style="width:99%;">
                                         <option value="">{{'please_select'| translate}}</option>                        
-                                        <option value="0">{{'no'| translate}}</option>
-                                        <option value="1">{{'yes'| translate}}</option>
+                                        <option value="false">{{'no'| translate}}</option>
+                                        <option value="true">{{'yes'| translate}}</option>
                                         </select>
                                         <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
                                     </div>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2014-08-22 11:29:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2014-08-28 12:23:08 +0000
@@ -96,18 +96,22 @@
                     </thead>
                     <tbody id="list">
                         <tr ng-repeat="dhis2Event in dhis2Events | orderBy:sortHeader:reverse | gridFilter:filterText:filterTypes">
-                            
-                            <!--<td ng-repeat="eventGridColumn in eventGridColumns" ng-if="eventGridColumn.id === 'uid' && eventGridColumn.show">                                
-                                {{dhis2Event.event}}  
-                            </td>-->
-                            
+                           
                             <!-- Visible when event is not under editing -->
                             <td dhis-context-menu 
                                 selected-item={{dhis2Event}}
                                 ng-click="showEventList()"
                                 ng-hide="(currentEvent.event == dhis2Event.event) || !eventGridColumn.show || eventGridColumn.id === 'comment'" 
-                                ng-repeat="eventGridColumn in eventGridColumns">                                                
-                                {{dhis2Event[eventGridColumn.id]}}                                                
+                                ng-repeat="eventGridColumn in eventGridColumns">
+                                <span ng-switch="eventGridColumn.type">
+                                    <span ng-switch-when="bool">
+                                        <span ng-if="dhis2Event[eventGridColumn.id] == 'false'">{{'no'| translate}}</span>
+                                        <span ng-if="dhis2Event[eventGridColumn.id] == 'true'">{{'yes'| translate}}</span>
+                                    </span>
+                                    <span ng-switch-default>
+                                        {{dhis2Event[eventGridColumn.id]}}
+                                    </span>
+                                </span>                                
                             </td>
 
                             <!-- Visible when event is under editing - in grid -->
@@ -186,11 +190,10 @@
                                                     name="foo" 
                                                     style="width:98%;"
                                                     ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
-                                                    ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
-                                                    />
+                                                    ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]">
                                                 <option value="">{{'please_select'| translate}}</option>                        
-                                                <option value="0">{{'no'| translate}}</option>
-                                                <option value="1">{{'yes'| translate}}</option>
+                                                <option value="false">{{'no'| translate}}</option>
+                                                <option value="true">{{'yes'| translate}}</option>
                                             </select>
                                             <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
                                         </div>