← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14822: Adds menu to event-tracker app

 

------------------------------------------------------------
revno: 14822
committer: Mark Polak <markpo@xxxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-14 04:24:15 +0200
message:
  Adds menu to event-tracker app
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.translate.js
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css


--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js	2014-04-04 21:13:39 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js	2014-04-14 02:24:15 +0000
@@ -27,9 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// Make sure that dhis2 object exists
-var dhis2 = dhis2 || {};
-
 /**
  * Created by Mark Polak on 28/01/14.
  */
@@ -44,7 +41,7 @@
          * Object that represents the list of menu items
          * and managers the order of the items to be saved.
          */
-        menuItemsList = (function () {
+            menuItemsList = (function () {
             var menuOrder = [],
                 menuItems = {};
 
@@ -127,7 +124,7 @@
                 onceCallBack(menuItems);
             }
             callBacks.forEach(function (callback, index, callBacks) {
-               callback.apply(dhis2.menu, [menuItems]);
+                callback.apply(dhis2.menu, [menuItems]);
             });
         }
 
@@ -345,7 +342,7 @@
 
         return that;
     }();
-})(dhis2);
+})(dhis2 = dhis2 || {});
 
 /**
  * Created by Mark Polak on 28/01/14.
@@ -353,7 +350,27 @@
  * @description jQuery part of the menu
  *
  * @see jQuery (http://jquery.com)
+ * @see jQuery Template Plugin (http://github.com/jquery/jquery-tmpl)
  */
+(function (required_libs, undefined) {
+    var libraries = [
+        { name: "jQuery", variable: "jQuery", url: "http://jquery.com"; },
+        { name: "jQuery Template Plugin", variable: "jQuery.template", url: "http://github.com/jquery/jquery-tmpl"; }
+    ];
+
+    //In IE 8 we can not use console
+    if (typeof console === "undefined") {
+        return;
+    }
+
+    //Throw error for the required libraries
+    libraries.forEach(function (library, index, libraries) {
+        if (window[library] === undefined) {
+            console.error("Missing required library: " + library.name + ". Please see (" + library.url + ")");
+        }
+    });
+})();
+
 (function ($, menu, undefined) {
     var markup = '',
         selector = 'appsMenu';
@@ -409,10 +426,10 @@
                 type:"POST",
                 url: "../api/menu/"
             }).success(function () {
-                //TODO: Give user feedback for successful save
-            }).error(function () {
-                //TODO: Give user feedback for failure to save
-            });
+                    //TODO: Give user feedback for successful save
+                }).error(function () {
+                    //TODO: Give user feedback for failure to save
+                });
         }
     }
 
@@ -444,24 +461,24 @@
     /**
      * Render the menumanager and the dropdown menu and attach the update handler
      */
-    //TODO: Rename this as the name is not very clear to what it does
+        //TODO: Rename this as the name is not very clear to what it does
     function renderMenu() {
         var options = {
-                placeholder: 'app-menu-placeholder',
-                connectWith: '.app-menu ul',
-                update: function (event, ui) {
-                    var reorderedApps = $("#" + selector + " ul"). sortable('toArray', {attribute: "data-id"});
-
-                    dhis2.menu.updateOrder(reorderedApps);
-                    dhis2.menu.save(saveOrder);
-
-                    //Render the dropdown menu
-                    renderDropDownFavorites();
-                },
-                sort: twoColumnRowFix,
-                tolerance: "pointer",
-                cursorAt: { left: 55, top: 30 }
-            };
+            placeholder: 'app-menu-placeholder',
+            connectWith: '.app-menu ul',
+            update: function (event, ui) {
+                var reorderedApps = $("#" + selector + " ul"). sortable('toArray', {attribute: "data-id"});
+
+                dhis2.menu.updateOrder(reorderedApps);
+                dhis2.menu.save(saveOrder);
+
+                //Render the dropdown menu
+                renderDropDownFavorites();
+            },
+            sort: twoColumnRowFix,
+            tolerance: "pointer",
+            cursorAt: { left: 55, top: 30 }
+        };
 
         renderAppManager(selector);
         renderDropDownFavorites();
@@ -485,12 +502,12 @@
                 menu.addMenuItems(data.modules);
             }
         }).error(function () {
-            //TODO: Give user feedback for failure to load items
-            //TODO: Translate this error message
-            var error_template = '<li class="app-menu-error"><a href="' + window.location.href +'">Unable to load your apps, click to refresh</a></li>';
-            $('#' + selector).addClass('app-menu').html('<ul>' + error_template + '</ul>');
-            $('#appsDropDown .menuDropDownBox').html(error_template);
-        });
+                //TODO: Give user feedback for failure to load items
+                //TODO: Translate this error message
+                var error_template = '<li class="app-menu-error"><a href="' + window.location.href +'">Unable to load your apps, click to refresh</a></li>';
+                $('#' + selector).addClass('app-menu').html('<ul>' + error_template + '</ul>');
+                $('#appsDropDown .menuDropDownBox').html(error_template);
+            });
 
         /**
          * Event handler for the sort order box

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.translate.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.translate.js	2014-03-24 20:21:10 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.translate.js	2014-04-14 02:24:15 +0000
@@ -27,13 +27,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+
+// Make sure that dhis2 object exists
+var dhis2 = dhis2 || {};
+dhis2.translate = dhis2.translate || {};
+
 /**
  * Created by Mark Polak on 28/01/14.
  *
+ * @see jQuery (http://jquery.com)
  * @see Underscore.js (http://underscorejs.org)
  */
-dhis2.util.namespace( 'dhis2.translate' );
-
 (function ($,  _, translate, undefined) {
     var translationCache = {
         get: function (key) {

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-04-02 09:11:11 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-04-14 02:24:15 +0000
@@ -69,4 +69,14 @@
     "yes": "YES",   
     "offline_notification": "You are offline, data will be stored locally",
     "online_nofification": "You are online"
+
+    ,
+    "profile": "Profile",
+    "applications": "Apps",
+    "more_applications": "More apps",
+    "settings": "Settings",
+    "account": "Account",
+    "help": "Help",
+    "log_out": "Log out",
+    "about_dhis2": "About DHIS 2"
 }

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-04-02 13:20:51 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html	2014-04-14 02:24:15 +0000
@@ -6,7 +6,7 @@
 
         <meta name="description" content="DHIS 2">
         <meta name="keywords" content="DHIS 2">        
-        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">              
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
         <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui-1.9.1.custom.min.js"></script>
@@ -21,7 +21,13 @@
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-animate.js"></script>        
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js"></script>
 
-        <script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script>          
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script>
+
+        <!-- Menu dependencies -->
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.tmpl.js"></script>
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui-1.9.1.custom.min.js"></script>
+        <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css">
 
         <script type="text/javascript" src="../dhis-web-commons/javascripts/underscore.min.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
@@ -60,6 +66,10 @@
         <script type="text/javascript" src="scripts/controllers.js"></script>
         <script type="text/javascript" src="scripts/filters.js"></script>
 
+        <!-- Menu scripts -->
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.translate.js"></script>
+        <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.menu.js"></script>
+
         <link type="text/css" rel="stylesheet" href="../dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
         <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
         <link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/widgets.css"/>       
@@ -74,6 +84,76 @@
                 <img ng-click="home()" id="headerBanner" src="../dhis-web-commons/css/light_blue/logo_banner.png" style="cursor:pointer" title="{{'dhis2_home'| translate}}">                    
             </div>
             <div id="headerMessage" class="bold"></div>
+
+            <!-- Menu html -->
+            <ul id="menuLinkArea">
+                <li id="profileDropDown_button">
+                    <a id="profileMenuLink" class="menu-link drop-down-menu-link">
+                        <i class="fa fa-user"></i>{{'profile'| translate}}
+                    </a>
+                </li>
+                <li id="appsDropDown_button">
+                    <a id="appsMenuLink" class="menu-link drop-down-menu-link">
+                        <i class="fa fa-th"></i>{{'applications'| translate}}
+                    </a>
+                </li>
+            </ul>
+
+            <div id="appsDropDown" class="menuDropDownArea app-menu-dropdown appsMenuLink_menu" >
+                <div class="caret-up-border"></div>
+                <div class="caret-up-background"></div>
+                <div class="menu-drop-down-wrap">
+                    <div class="menu-drop-down-scroll">
+                        <ul class="menuDropDownBox"><li class="menu-placeholder"><img src="../images/ajax-loader-bar.gif"></li></ul>
+                    </div>
+                </div>
+                <div class="apps-menu-more"><a href="../dhis-web-commons-about/modules.action">{{'more_applications'| translate}}</a></div>
+            </div>
+
+            <div id="profileDropDown" class="menuDropDownArea app-menu-dropdown ui-helper-clearfix profileMenuLink_menu">
+                <div class="caret-up-border"></div>
+                <div class="caret-up-background"></div>
+                <ul class="menuDropDownBox">
+                    <li>
+                        <a class="app-menu-item" href="../dhis-web-commons-about/userSettings.action">
+                            <img src="../icons/usersettings.png" alt="{{'settings'| translate}}">
+                            <span>{{'settings'| translate}}&nbsp;</span>
+                        </a>
+                    </li>
+                    <li>
+                        <a class="app-menu-item" href="../dhis-web-commons-about/showUpdateUserProfileForm.action">
+                            <img src="../icons/function-profile.png" alt="{{'profile'| translate}}">
+                            <span>{{'settings'| translate}}&nbsp;</span>
+                        </a>
+                    </li>
+                    <li>
+                        <a class="app-menu-item" href="../dhis-web-commons-about/showUpdateUserAccountForm.action">
+                            <img src="../icons/function-account.png" alt="{{'account' | translate}}">
+                            <span>{{'account' | translate}}&nbsp;</span>
+                        </a>
+                    </li>
+                    <li>
+                        <a class="app-menu-item" href="../dhis-web-commons-about/help.action">
+                            <img src="../icons/function-help-center.png" alt="{{'help' | translate}}">
+                            <span>{{'help' | translate}}&nbsp;</span>
+                        </a>
+                    </li>
+                    <li>
+                        <a class="app-menu-item" href="../dhis-web-commons-security/logout.action">
+                            <img src="../icons/function-log-out.png" alt="{{'log_out' | translate}}">
+                            <span>{{'log_out' | translate}}&nbsp;</span>
+                        </a>
+                    </li>
+                    <li>
+                        <a class="app-menu-item" href="../dhis-web-commons-about/about.action">
+                            <img src="../icons/function-about-dhis2.png" alt="{{'about_dhis2' | translate}}">
+                            <span>{{'about_dhis2' | translate}}&nbsp;</span>
+                        </a>
+                    </li>
+                </ul>
+            </div>
+            <!-- /Menu html -->
+
         </div>
 
         <div ng-controller="MainController">

=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-03-31 10:39:30 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-04-14 02:24:15 +0000
@@ -27,11 +27,11 @@
 
 }
 
-// --------------------------------------------------------------
-// App specific
-// --------------------------------------------------------------
+/*----------------------------------------------------------------------------*/
+/* App specific
+/*----------------------------------------------------------------------------*/
 
-// Block level inputs
+/* Block level inputs */
 .container-filters {
     display: block;
     width: 100%;    
@@ -39,7 +39,7 @@
 
 .container-heading {
     color: white;
-    padding: 12px;
+    /*padding: 12px;*/
 }
 
 .container-1-4 {