From 3219ac21018d3178140a15ebcf0f0304a5dfbb87 Mon Sep 17 00:00:00 2001 From: kamidu Date: Fri, 12 Aug 2016 14:04:16 +0530 Subject: [PATCH] Fixing the notification listing ui --- .../listing.hbs | 53 ++++++++++--------- .../cdmf.unit.notification.listing/listing.js | 11 ++-- .../public/js/notification-listing.js | 4 +- .../public/templates/notification-listing.hbs | 8 +-- 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.hbs index 073d9cb3b2..694154c383 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.hbs @@ -15,47 +15,48 @@ specific language governing permissions and limitations under the License. }} - -
-
- -
-
- Device Notifications -
-
-
-
-
- +{{#zone "content"}} + +
+
+ +
+
+ Device Notifications +
+
+
+ -
-
- No unread messages +
+
+ No unread messages +
+
-
-
+{{/zone}} {{#zone "bottomJs"}} {{js "js/notification-listing.js"}} {{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.js index 0086ba8e3e..3512296bda 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/listing.js @@ -16,15 +16,16 @@ * under the License. */ -function onRequest(context){ +function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var constants = require("/app/modules/constants.js"); + var viewModel = {}; var permissions = []; - if(userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/notifications/list")){ + if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/notifications/list")) { permissions.push("LIST_NOTIFICATIONS"); } var currentUser = session.get(constants.USER_SESSION_KEY); - context.permissions = stringify(permissions); - context.currentUser = currentUser; - return context; + viewModel.permissions = stringify(permissions); + viewModel.currentUser = currentUser; + return viewModel; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/js/notification-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/js/notification-listing.js index 52fd96af33..f7f7db822f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/js/notification-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/js/notification-listing.js @@ -91,8 +91,8 @@ function loadNotifications(){ var successCallback = function (data) { var viewModel = {}; data = JSON.parse(data); - viewModel.notifications = data; - if(data.length > 0){ + viewModel.notifications = data.notifications; + if(data.count > 0){ var content = template(viewModel); $("#ast-container").html(content); $('#unread-notifications').datatables_extended(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/templates/notification-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/templates/notification-listing.hbs index d59fc831db..418bef892b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/templates/notification-listing.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.notification.listing/public/templates/notification-listing.hbs @@ -16,10 +16,10 @@ {{#each notifications}} {{#equal "NEW" status }} - + {{description}} - + @@ -54,10 +54,10 @@ {{#each notifications}} - + {{description}} - +