← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8583: mobile: made recipient selection support adding/removing recipients

 

------------------------------------------------------------
revno: 8583
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-18 16:06:57 +0200
message:
  mobile: made recipient selection support adding/removing recipients
modified:
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-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/new-message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-10 09:29:10 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-18 14:06:57 +0000
@@ -19,17 +19,17 @@
             if( item.indexOf( 'ou:') != -1 )
             {
                 ou_count++;
-                $('<li data-icon="delete"><a href="#">' + selected[item] + '</a> <span id="message-recipient-counter" class="ui-li-count">Tap to remove</span></li>').insertAfter('#organisation-unit-list');
+                $('<li onclick="removeRecipient(this);" data-icon="delete" data-key="' + item + '"><a href="#">' + selected[item] + '</a></li>').insertAfter('#organisation-unit-list');
             }
             else if( item.indexOf( 'u:') != -1 )
             {
                 u_count++;
-                $('<li data-icon="delete"><a href="#">' + selected[item] + '</a> <span id="message-recipient-counter" class="ui-li-count">Tap to remove</span></li>').insertAfter('#user-list');
+                $('<li onclick="removeRecipient(this);" data-icon="delete" data-key="' + item + '"><a href="#">' + selected[item] + '</a></li>').insertAfter('#user-list');
             }
             else if( item.indexOf( 'ug:') != -1 )
             {
                 ug_count++;
-                $('<li data-icon="delete"><a href="#">' + selected[item] + '</a> <span id="message-recipient-counter" class="ui-li-count">Tap to remove</span></li>').insertAfter('#user-group-list');
+                $('<li onclick="removeRecipient(this);" data-icon="delete" data-key="' + item + '"><a href="#">' + selected[item] + '</a></li>').insertAfter('#user-group-list');
             }
         });
 
@@ -67,6 +67,16 @@
         }
 
         selected[prefix + ':' + id] = $(e).find('a').html();
+
+        $.mobile.changePage('#manage-recipients-page');
+    }
+
+    function removeRecipient(e)
+    {
+        var key = $(e).jqmData('key');
+        delete selected[key];
+
+        displaySelected();
     }
 
     function manageRecipientsPage()