← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2288: Improved the common filter for data element, indicator, orgunit list, etc...

 

------------------------------------------------------------
revno: 2288
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-12-06 11:38:50 +0700
message:
  Improved the common filter for data element, indicator, orgunit list, etc...
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm


--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2010-12-06 04:38:50 +0000
@@ -1340,3 +1340,13 @@
 {
 	return isNumber( value ) && parseFloat( value ) == 0;
 }
+
+function getValueTrimById( valueId )
+{
+	return getValueTrim( getFieldValue( valueId ) );
+}
+
+function getValueTrim( value )
+{
+	return trim( value ).replace(/\s+/g, ' ');
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm	2010-12-03 08:08:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm	2010-12-06 04:38:50 +0000
@@ -116,7 +116,7 @@
 
 #macro( filterDiv $action )
 $i18n.getString( "filter_by_name" ):
-<form action="${action}.action" method="POST">
+<form action="${action}.action" method="POST" onsubmit="setFieldValue( 'key', getValueTrimById( 'key' ) );">
 	<div style="inline">
 		#set ($value = $encoder.htmlEncode( ${key} ))
 		<input type="text" id="key" name="key" value="$!value"/>