dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19239
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8305: mobile: implemented reading messages (read-only for now)
------------------------------------------------------------
revno: 8305
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-09-30 21:58:00 +0700
message:
mobile: implemented reading messages (read-only for now)
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java
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/messages.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.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-api/src/main/java/org/hisp/dhis/message/MessageConversation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java 2012-09-11 06:48:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java 2012-09-30 14:58:00 +0000
@@ -312,7 +312,6 @@
}
@JsonProperty
- @JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JsonView( {DetailedView.class, ExportView.class} )
@JacksonXmlElementWrapper( localName = "messages", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "message", namespace = Dxf2Namespace.NAMESPACE )
=== 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-29 03:50:36 +0000
+++ 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
@@ -1,4 +1,37 @@
+<script>
+ jQuery(document).bind('pagebeforecreate',function(){
+ jQuery.ajax({
+ url: '$baseUrl/../api/messageConversations/${messageId}.json',
+ async: false
+ }).success(function(data) {
+ var tmpl = jQuery('#message-template').html();
+
+ jQuery('section[data-role="content"]').html(
+ _.template( tmpl, data )
+ );
+
+ console.log(data);
+ }).error(function() {
+ console.log('error fetching message')
+ });
+ });
+</script>
+
+<script id="message-template" type="text/template">
+ <ul data-role="listview" data-inset="true">
+ <li data-role="list-divider"><%= subject %></li>
+ <% _( _( messages ).reverse() ).each( function(message, idx) { %>
+ <% var d = new Date( message.lastUpdated ).toDateString(); %>
+ <li>
+ <h3><%= message.sender.name %></h3>
+ <p style="white-space: normal !important"><%= message.name %></p>
+ <p class="ui-li-aside"><strong><%= d %></strong></p>
+ </li>
+ <% }); %>
+ </ul>
+</script>
+
<section data-role="page" id="messagePage" data-theme="c">
<header data-role="header" data-theme="b">
@@ -7,7 +40,6 @@
</header>
<section data-role="content">
- <h1>Reading message $messageId.</h1>
</section>
<footer data-role="footer" data-theme="b">
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm 2012-09-29 03:50:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm 2012-09-30 14:58:00 +0000
@@ -1,16 +1,17 @@
<script>
- $(document).bind('pagebeforecreate',function(){
- $.ajax({
+ jQuery(document).bind('pagebeforecreate',function(){
+ jQuery.ajax({
url: '../api/currentUser/inbox.json',
async: false
}).success(function(data) {
console.log(data);
- $.each(data.messageConversations, function(i, item) {
- $('#messageList').append('<li><a href="messages/' + item.id + '">' + item.name + '</a></li>');
+ jQuery.each(data.messageConversations, function(i, item) {
+ jQuery('#messageList').append('<li><a href="messages/' + item.id + '">' + item.name + '</a></li>');
});
}).error(function() {
+ console.log("error fetching inbox");
});
});
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm 2012-09-29 03:50:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm 2012-09-30 14:58:00 +0000
@@ -9,7 +9,7 @@
$('#surnameInput').val(data.surname);
$('#emailInput').val(data.email);
$('#phoneNumberInput').val(data.phoneNumber);
- $('#job').val(data.jobTitle);
+ $('#jobTitleInput').val(data.jobTitle);
});
$('input:submit').bind('click', function() {