mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-01-03 12:47:13 -06:00
Merge pull request #237 from KiranNiranjan/ELECTRON-211
Electron-211 (Added company filed to the notifications)
This commit is contained in:
commit
4b3749502c
@ -18,6 +18,10 @@
|
|||||||
<label for='image'>image url:</label>
|
<label for='image'>image url:</label>
|
||||||
<input type='text' id='image' value='https://avatars0.githubusercontent.com/u/13243259?v=4&s=460'/>
|
<input type='text' id='image' value='https://avatars0.githubusercontent.com/u/13243259?v=4&s=460'/>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for='company'>company:</label>
|
||||||
|
<input type='text' id='company' value='Symphony'/>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for='flash'>flash:</label>
|
<label for='flash'>flash:</label>
|
||||||
<input type='checkbox' id='flash'/>
|
<input type='checkbox' id='flash'/>
|
||||||
@ -92,6 +96,7 @@
|
|||||||
var shouldStick = document.getElementById('sticky').checked;
|
var shouldStick = document.getElementById('sticky').checked;
|
||||||
var color = document.getElementById('color').value;
|
var color = document.getElementById('color').value;
|
||||||
var tag = document.getElementById('tag').value;
|
var tag = document.getElementById('tag').value;
|
||||||
|
var company = document.getElementById('company').value;
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
@ -104,7 +109,8 @@
|
|||||||
data: {
|
data: {
|
||||||
hello: 'hello word'
|
hello: 'hello word'
|
||||||
},
|
},
|
||||||
tag: tag
|
tag: tag,
|
||||||
|
company: company
|
||||||
});
|
});
|
||||||
|
|
||||||
notf.addEventListener('click', onclick);
|
notf.addEventListener('click', onclick);
|
||||||
|
@ -23,7 +23,7 @@ function setStyle(config) {
|
|||||||
let image = notiDoc.getElementById('image');
|
let image = notiDoc.getElementById('image');
|
||||||
let logo = notiDoc.getElementById('symphony-logo');
|
let logo = notiDoc.getElementById('symphony-logo');
|
||||||
let title = notiDoc.getElementById('title');
|
let title = notiDoc.getElementById('title');
|
||||||
let pod = notiDoc.getElementById('pod');
|
let company = notiDoc.getElementById('company');
|
||||||
let message = notiDoc.getElementById('message');
|
let message = notiDoc.getElementById('message');
|
||||||
let close = notiDoc.getElementById('close');
|
let close = notiDoc.getElementById('close');
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ function setStyle(config) {
|
|||||||
|
|
||||||
setStyleOnDomElement(config.defaultStyleTitle, title);
|
setStyleOnDomElement(config.defaultStyleTitle, title);
|
||||||
|
|
||||||
setStyleOnDomElement(config.defaultStylePod, pod);
|
setStyleOnDomElement(config.defaultStyleCompany, company);
|
||||||
|
|
||||||
setStyleOnDomElement(config.defaultStyleText, message);
|
setStyleOnDomElement(config.defaultStyleText, message);
|
||||||
|
|
||||||
@ -79,7 +79,13 @@ function setContents(event, notificationObj) {
|
|||||||
|
|
||||||
let notiDoc = window.document;
|
let notiDoc = window.document;
|
||||||
|
|
||||||
|
// All the required DOM elements to update the content
|
||||||
let container = notiDoc.getElementById('container');
|
let container = notiDoc.getElementById('container');
|
||||||
|
let titleDoc = notiDoc.getElementById('title');
|
||||||
|
let companyDoc = notiDoc.getElementById('company');
|
||||||
|
let messageDoc = notiDoc.getElementById('message');
|
||||||
|
let imageDoc = notiDoc.getElementById('image');
|
||||||
|
let closeButton = notiDoc.getElementById('close');
|
||||||
|
|
||||||
if (notificationObj.color) {
|
if (notificationObj.color) {
|
||||||
container.style.backgroundColor = notificationObj.color;
|
container.style.backgroundColor = notificationObj.color;
|
||||||
@ -88,13 +94,9 @@ function setContents(event, notificationObj) {
|
|||||||
if (notificationObj.color.match(whiteColorRegExp)) {
|
if (notificationObj.color.match(whiteColorRegExp)) {
|
||||||
logo.src = './assets/symphony-logo-black.png';
|
logo.src = './assets/symphony-logo-black.png';
|
||||||
} else {
|
} else {
|
||||||
let title = notiDoc.getElementById('title');
|
messageDoc.style.color = '#ffffff';
|
||||||
let pod = notiDoc.getElementById('pod');
|
titleDoc.style.color = '#ffffff';
|
||||||
let message = notiDoc.getElementById('message');
|
companyDoc.style.color = notificationObj.color;
|
||||||
|
|
||||||
message.style.color = '#ffffff';
|
|
||||||
title.style.color = '#ffffff';
|
|
||||||
pod.style.color = notificationObj.color;
|
|
||||||
logo.src = './assets/symphony-logo-white.png';
|
logo.src = './assets/symphony-logo-white.png';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,24 +113,26 @@ function setContents(event, notificationObj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
let titleDoc = notiDoc.getElementById('title');
|
|
||||||
titleDoc.innerHTML = notificationObj.title || '';
|
titleDoc.innerHTML = notificationObj.title || '';
|
||||||
|
|
||||||
// message
|
// message
|
||||||
let messageDoc = notiDoc.getElementById('message');
|
|
||||||
messageDoc.innerHTML = notificationObj.text || '';
|
messageDoc.innerHTML = notificationObj.text || '';
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
let imageDoc = notiDoc.getElementById('image');
|
|
||||||
if (notificationObj.image) {
|
if (notificationObj.image) {
|
||||||
imageDoc.src = notificationObj.image;
|
imageDoc.src = notificationObj.image;
|
||||||
} else {
|
} else {
|
||||||
setStyleOnDomElement({ display: 'none'}, imageDoc);
|
setStyleOnDomElement({ display: 'none'}, imageDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const winId = notificationObj.windowId;
|
// Company
|
||||||
|
if (notificationObj.company) {
|
||||||
|
companyDoc.innerHTML = notificationObj.company
|
||||||
|
} else {
|
||||||
|
messageDoc.style.marginTop = '15px';
|
||||||
|
}
|
||||||
|
|
||||||
let closeButton = notiDoc.getElementById('close');
|
const winId = notificationObj.windowId;
|
||||||
|
|
||||||
// note: use onclick because we only want one handler, for case
|
// note: use onclick because we only want one handler, for case
|
||||||
// when content gets overwritten by notf with same tag
|
// when content gets overwritten by notf with same tag
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<span id="title"></span>
|
<span id="title"></span>
|
||||||
<span id="pod"></span>
|
<span id="company"></span>
|
||||||
<span id="message"></span>
|
<span id="message"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="picture">
|
<div id="picture">
|
||||||
|
@ -76,7 +76,7 @@ let config = {
|
|||||||
defaultStyleHeader: {
|
defaultStyleHeader: {
|
||||||
width: 245,
|
width: 245,
|
||||||
minWidth: 230,
|
minWidth: 230,
|
||||||
margin: "12px 10px"
|
margin: "10px 10px"
|
||||||
},
|
},
|
||||||
defaultStyleImage: {
|
defaultStyleImage: {
|
||||||
height: 43,
|
height: 43,
|
||||||
@ -102,7 +102,7 @@ let config = {
|
|||||||
webkitLineClamp: 1,
|
webkitLineClamp: 1,
|
||||||
webkitBoxOrient: 'vertical',
|
webkitBoxOrient: 'vertical',
|
||||||
},
|
},
|
||||||
defaultStylePod: {
|
defaultStyleCompany: {
|
||||||
fontFamily: 'sans-serif',
|
fontFamily: 'sans-serif',
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
color: '#adadad',
|
color: '#adadad',
|
||||||
@ -116,7 +116,7 @@ let config = {
|
|||||||
fontFamily: 'sans-serif',
|
fontFamily: 'sans-serif',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: '#4a4a4a',
|
color: '#4a4a4a',
|
||||||
marginTop: 12,
|
marginTop: 5,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
display: '-webkit-box',
|
display: '-webkit-box',
|
||||||
webkitLineClamp: 1,
|
webkitLineClamp: 1,
|
||||||
|
@ -41,6 +41,7 @@ class Notify {
|
|||||||
color: options.color,
|
color: options.color,
|
||||||
tag: options.tag,
|
tag: options.tag,
|
||||||
sticky: options.sticky || false,
|
sticky: options.sticky || false,
|
||||||
|
company: options.company,
|
||||||
onShowFunc: onShow.bind(this),
|
onShowFunc: onShow.bind(this),
|
||||||
onClickFunc: onClick.bind(this),
|
onClickFunc: onClick.bind(this),
|
||||||
onCloseFunc: onClose.bind(this),
|
onCloseFunc: onClose.bind(this),
|
||||||
|
Loading…
Reference in New Issue
Block a user