← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8306: mobile: implemented reply to messageConversations

 

------------------------------------------------------------
revno: 8306
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-01 00:01:41 +0700
message:
  mobile: implemented reply to messageConversations
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-09-30 14:58:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm	2012-09-30 17:01:41 +0000
@@ -16,6 +16,29 @@
             console.log('error fetching message')
         });
     });
+
+    jQuery(document).bind('pageinit', function() {
+       $('#reply-form input:submit').bind('click', function() {
+            var msg = jQuery('#reply-text').val();
+
+           if(msg.length == 0) {
+               return false;
+           }
+
+           $.ajax({
+               url         : '$baseUrl/../api/messageConversations/${messageId}',
+               type        : 'post',
+               contentType : 'text/plain',
+               data        : msg
+           }).success(function () {
+               location.reload(true);
+           }).error(function () {
+               console.log("failed to send message");
+           });
+
+           return false;
+       });
+    });
 </script>
 
 <script id="message-template" type="text/template">
@@ -28,6 +51,14 @@
             <p style="white-space: normal !important"><%= message.name %></p>
             <p class="ui-li-aside"><strong><%= d %></strong></p>
         </li>
+        <% if( idx == 0 ) { %>
+        <li>
+        <form id='reply-form'>
+            <textarea id='reply-text'></textarea>
+            <input type="submit" value="Reply" />
+        </form>
+        </li>
+        <% } %>
         <% }); %>
     </ul>
 </script>