dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39806
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20180: minor fix, enable/disable zero/aggregation type depending on selected value type
------------------------------------------------------------
revno: 20180
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-16 15:29:58 +0700
message:
minor fix, enable/disable zero/aggregation type depending on selected value type
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js
--
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-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2015-09-15 09:54:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2015-09-16 08:29:58 +0000
@@ -25,23 +25,30 @@
exportPdfByType(type, params);
}
-function changeValueType( value ) {
- enable('aggregationOperatorSelect');
- if( value == 'int' ) {
- showById('numberTypeTR');
- hideById('textTypeTR');
- enable('zeroIsSignificant');
+function isValueTypeNumeric(value) {
+ return value === 'INTEGER' ||
+ value === 'INTEGER_POSITIVE' ||
+ value === 'INTEGER_NEGATIVE' ||
+ value === 'INTEGER_ZERO_OR_POSITIVE' ||
+ value === 'NUMBER' ||
+ value === 'UNIT_INTERVAL' ||
+ value === 'PERCENTAGE';
+}
+
+function isValueTypeText(value) {
+ return value === 'TEXT' || value === 'LONG_TEXT';
+}
+
+function changeValueType(value) {
+ showById('aggregationOperatorSelect');
+ if( isValueTypeNumeric(value) ) {
+ showById('zeroIsSignificant');
} else {
- disable('zeroIsSignificant');
- hideById('numberTypeTR');
- hideById('textTypeTR');
- disable('aggregationOperatorSelect');
+ hideById('zeroIsSignificant');
+ hideById('aggregationOperatorSelect');
- if( value == 'string' ) {
- showById('textTypeTR');
- }
- else if( value == 'bool' ) {
- enable('aggregationOperatorSelect');
+ if( value == 'BOOLEAN' ) {
+ showById('aggregationOperatorSelect');
}
}
@@ -49,10 +56,10 @@
}
function updateAggreationOperation( value ) {
- if( value == 'string' || value == 'date' || value == 'trueOnly' ) {
- hideById("aggregationOperator");
+ if( isValueTypeText(value) || value == 'DATE' || value == 'TRUE_ONLY' ) {
+ hideById("aggregationType");
} else {
- showById("aggregationOperator");
+ showById("aggregationType");
}
}