Commit 70ab8d42 by NGUYEN HOANG SON

implement dummy message list json

parent b00b28e6
...@@ -13,7 +13,7 @@ PushMessageList.init = function() { ...@@ -13,7 +13,7 @@ PushMessageList.init = function() {
I18N.initi18n(); I18N.initi18n();
}); });
PushMessageList.getMessageList(function(messageList) { PushMessageList.getMessageList(function(messageList) {
PushMessageList.generateMessageListHtml(messageList); PushMessageList.generateMessageListHtml(messageList.pushMessageList);
}); });
} }
...@@ -33,7 +33,7 @@ PushMessageList.getMessageList = function (callback) { ...@@ -33,7 +33,7 @@ PushMessageList.getMessageList = function (callback) {
}, function() { }, function() {
console.log('PushMessageList.getMessageList error'); console.log('PushMessageList.getMessageList error');
if (callback) { if (callback) {
callback(PushMessageList.dummyMessageList()); callback(PushMessageList.dummyMessageListJson);
} }
}); });
}; };
...@@ -64,12 +64,11 @@ PushMessageList.generateMessageListHtml = function(messageList) { ...@@ -64,12 +64,11 @@ PushMessageList.generateMessageListHtml = function(messageList) {
var mTitle = message.pushMessage; var mTitle = message.pushMessage;
var mDate = message.pushSendDate; var mDate = message.pushSendDate;
var mSubtitle = message.operationName; var mSubtitle = message.operationName;
var unread = !message.readingFlg;
var messageLi = $('<li class="card mb-2" id="pushMessageId_' + messageId + '"/>'); var messageLi = $('<li class="card mb-2" id="pushMessageId_' + messageId + '"/>');
if (unread) { if (message.readingFlg) {
messageLi.addClass('unread');
} else {
messageLi.addClass('read'); messageLi.addClass('read');
} else {
messageLi.addClass('unread');
} }
var messageA = $('<a class="d-block px-3 py-2 text-decoration-none text-dark"/>'); var messageA = $('<a class="d-block px-3 py-2 text-decoration-none text-dark"/>');
messageA.attr('href', "javascript:PushMessageList.clickMessage('" + messageId +"');"); messageA.attr('href', "javascript:PushMessageList.clickMessage('" + messageId +"');");
...@@ -87,24 +86,20 @@ PushMessageList.generateMessageListHtml = function(messageList) { ...@@ -87,24 +86,20 @@ PushMessageList.generateMessageListHtml = function(messageList) {
}; };
/** /**
* dummy message list for test * dummy message list JSON for test
* @returns message List
*/ */
PushMessageList.dummyMessageList = function() { PushMessageList.dummyMessageListJson = {
var messes = []; pushMessageList: [{
messes.push({
pushMessageId: 1, pushMessageId: 1,
pushMessage: 'メッセージ内容が入ります。', pushMessage: 'メッセージ内容が入ります。',
pushSendDate: '2022/07/06 14:14', pushSendDate: '2022/07/06 14:14',
operationName: '作業名が入ります。', operationName: '作業名が入ります。',
readingFlg: false, readingFlg: 0,
}); }, {
messes.push({
pushMessageId: 2, pushMessageId: 2,
pushMessage: 'メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。', pushMessage: 'メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。',
pushSendDate: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', pushSendDate: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
operationName: '作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。', operationName: '作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。',
readingFlg: true, readingFlg: 1,
}); }]
return messes; };
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment