dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25348
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12552: show apps on the html5 mobile application index page
------------------------------------------------------------
revno: 12552
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-10 11:56:49 +0200
message:
show apps on the html5 mobile application index page
modified:
dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.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/java/org/hisp/dhis/web/mobile/controller/MobileController.java'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java 2013-10-10 09:56:49 +0000
@@ -48,7 +48,7 @@
@Controller
public class MobileController
{
- @RequestMapping(value = "/mobile")
+ @RequestMapping( value = "/mobile" )
public String base()
{
return "redirect:/mobile/index";
@@ -60,7 +60,7 @@
return "redirect:/mobile/index";
}
- @RequestMapping( value = "/index" )
+ @RequestMapping(value = "/index")
public String index( Model model, HttpServletRequest request )
{
populateContextPath( model, request );
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2013-07-02 04:15:25 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2013-10-10 09:56:49 +0000
@@ -26,7 +26,7 @@
function getDashboard() {
return $.ajax({
- url: '$contextPath/api/currentUser/dashboard',
+ url: '$contextPath/api/me/dashboard',
dataType: 'json'
}).success(function(data) {
if( data.unreadMessageConversation > 0 ) {
@@ -35,13 +35,38 @@
});
}
+ function getApps() {
+ return $.ajax({
+ url: '$contextPath/api/apps',
+ dataType: 'json'
+ }).success(function(data) {
+ var tmpl = $('#app-template').html();
+
+ $.each(data, function(idx) {
+ var html = _.template(tmpl, {
+ 'idx': idx,
+ 'name': this.name,
+ 'launchUrl': this.launchUrl
+ });
+
+ if( $('#app-' + idx).length === 0 ) {
+ $('#user-account').after(html);
+ } else {
+ $('#app-' + idx).html(html);
+ }
+
+ $('#listview').listview('refresh');
+ });
+ });
+ }
+
$(document).bind('pagechange',function(){
$.mobile.loading( 'show' );
getDashboard().always(function() {
$('section[data-role="content"] ul').listview('refresh');
- $.when( fm.getMetaData(), fm.uploadDataValueSets()).always(function() {
+ $.when( getApps(), fm.getMetaData(), fm.uploadDataValueSets()).always(function() {
updateMenu();
renderOfflineStatus();
$.mobile.loading( 'hide' );
@@ -73,9 +98,11 @@
if( onlineStatus ) {
$( '#messages').removeClass('ui-disabled');
$( '#user-account').removeClass('ui-disabled');
+ $( '.app').removeClass('ui-disabled');
} else {
$( '#messages').addClass('ui-disabled');
$( '#user-account').addClass('ui-disabled');
+ $( '.app').addClass('ui-disabled');
}
}
@@ -122,6 +149,10 @@
<% } %>
</script>
+<script id="app-template" type="text/template">
+ <li class="app" id="app-<%= idx %>"><a href="<%= launchUrl %>"><%= name %></a></li>
+</script>
+
<section data-role="page" id="index-page" data-theme="c">
<header data-role="header" data-theme="b">
@@ -129,10 +160,11 @@
</header>
<section data-role="content">
- <ul data-role="listview" data-inset="true">
+ <ul id="listview" data-role="listview" data-inset="true">
<li id="data-entry"><a href="data-entry">$i18n.getString("aggregate_reporting")</a></li>
<li id="messages"><a href="messages">$i18n.getString("messages")</a></li>
<li id="user-account"><a href="user-account">$i18n.getString("user_account")</a></li>
+
<li id="offline-status">
<h3></h3>
<p> </p>