[Kimchi-devel] [Wok][PATCH 7/7] Multi-Culture support : Format datetime in user activity log as per locale

pkulkark at linux.vnet.ibm.com pkulkark at linux.vnet.ibm.com
Wed May 4 05:57:17 UTC 2016


From: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>

co-authored by: Archana Singh <archus at linux.vnet.ibm.com>

This patch formats the datetime fields
in user activity log as per locale by
using suitable formatters.

Signed-off-by: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
---
 ui/js/wok.bootgrid.js | 10 +++++++++-
 ui/js/wok.user-log.js |  3 ++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ui/js/wok.bootgrid.js b/ui/js/wok.bootgrid.js
index 1312fe5..bc4f993 100644
--- a/ui/js/wok.bootgrid.js
+++ b/ui/js/wok.bootgrid.js
@@ -72,6 +72,14 @@ wok.createBootgrid = function(opts) {
       },
       "settings-user-log-message": function(column, row) {
         return '<span class="trim" data-toggle="tooltip"  data-placement="auto bottom" title="'+row.message+'">' +row.message+ '</span> ';
+      },
+      "settings-user-log-date": function(column, row) {
+        var dte = new Date(row.date);
+        return dte.toLocaleDateString(wok.lang.get_loc().replace('_','-'));
+      },
+      "settings-user-log-time": function(column, row) {
+        var dte = new Date(row.date); 
+        return dte.toLocaleTimeString(wok.lang.get_loc().replace('_','-'));
       }
     },
     css: {
@@ -138,4 +146,4 @@ wok.showBootgridData = function(opts) {
 
 wok.hideBootgridData = function(opts) {
   $("#" + opts['gridId'] + " tbody").hide();
-};
\ No newline at end of file
+};
diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
index 8c2b4a7..1bdbd31 100644
--- a/ui/js/wok.user-log.js
+++ b/ui/js/wok.user-log.js
@@ -94,6 +94,7 @@ wok.listUserLogConfig = function() {
       "title": i18n['WOKSETT0004M']
     }, {
       "column-id": 'time',
+      "formatter": "settings-user-log-time",
       "converter": 'string',
       "order": 'desc',
       "title": i18n['WOKSETT0005M']
@@ -243,4 +244,4 @@ wok.initUserLogWindow = function() {
       });
       $('#form-advanced-search').submit();
   });
-};
\ No newline at end of file
+};
-- 
2.1.0




More information about the Kimchi-devel mailing list