dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19593
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8611: mobile: minor fix for send reply
------------------------------------------------------------
revno: 8611
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-10-21 17:30:15 +0200
message:
mobile: minor fix for send reply
modified:
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.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-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm 2012-10-21 15:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm 2012-10-21 15:30:15 +0000
@@ -1,5 +1,33 @@
<script>
+ function bindSubmitHandler() {
+ $('#reply-form input:submit').bind('click', function ( e ) {
+ var msg = jQuery('#reply-text').val();
+
+ if ( msg.length == 0 ) {
+ e.preventDefault();
+ return;
+ }
+
+ $.mobile.showPageLoadingMsg();
+
+ $.ajax({
+ url : '$baseUrl/../api/messageConversations/${messageId}',
+ type : 'post',
+ contentType : 'text/plain',
+ data : msg
+ }).success(function () {
+ $.mobile.hidePageLoadingMsg();
+ location.reload(true);
+ }).error(function () {
+ $.mobile.showPageLoadingMsg($.mobile.pageLoadErrorMessageTheme, "Unable to send reply, please try again later", true);
+ setTimeout($.mobile.hidePageLoadingMsg, 1500);
+ });
+
+ e.preventDefault();
+ });
+ }
+
$(document).bind('pageinit', function() {
$.ajax({
url : '$baseUrl/../api/messageConversations/${messageId}.json',
@@ -12,36 +40,11 @@
);
$('section[data-role="content"]').trigger('create');
+ bindSubmitHandler();
}).error(function () {
$.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Unable to load message, please try again later", true );
setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
});
-
- $('#reply-form input:submit').bind('click', function(e) {
- var msg = jQuery('#reply-text').val();
-
- if(msg.length == 0) {
- e.preventDefault();
- return;
- }
-
- $.mobile.showPageLoadingMsg();
-
- $.ajax({
- url : '$baseUrl/../api/messageConversations/${messageId}',
- type : 'post',
- contentType : 'text/plain',
- data : msg
- }).success(function () {
- $.mobile.hidePageLoadingMsg();
- location.reload(true);
- }).error(function () {
- $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Unable to send reply, please try again later", true );
- setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
- });
-
- e.preventDefault();
- });
});
</script>