Skip to content

Instantly share code, notes, and snippets.

@vfrancis
Last active December 5, 2017 15:01
Show Gist options
  • Save vfrancis/ebbec1381ca21d12dd2a to your computer and use it in GitHub Desktop.
Save vfrancis/ebbec1381ca21d12dd2a to your computer and use it in GitHub Desktop.
Connections Cloud Community Customization Examples
{
"name": "iFrameAppName",
"description": "description",
"type":"community_widget",
"urls":{
"icon_url": "https://sampleconnectionswidget.mybluemix.net/icon.png",
"url": "https://<Connections_Cloud_URL>/connections/resources/web/com.ibm.social.urliWidget.web.resources/widget/urlWidget.xml"
},
"payload": {
"defId": "iFrameAppName",
"showInPalette": "true",
"primaryWidget": "false",
"modes": "view",
"themes": "wpthemeThin wpthemeNarrow wpthemeWide wpthemeBanner",
"url": "https://<Connections_Cloud_URL>/connections/resources/web/com.ibm.social.urliWidget.web.resources/widget/urlWidget.xml",
"iconUrl": "https://sampleconnectionswidget.mybluemix.net/icon.png",
"itemSet": [
{
"value": "https://sampleconnectionswidget.mybluemix.net",
"name": "url"
},
{
"value": "100%",
"name": "width"
},
{
"value": "400px",
"name": "height"
}
]
}
}
<html>
<head>
<title>A test frame</title>
<script type="text/javascript">
window.onload = function() {
document.getElementById("host").innerHTML = location.host;
try {
window.addEventListener('message', function(evt) {
// In a production environment, it is recommended check event.origin to ensure the message is coming from a Connections environment. See documentation for details.
console.log("Got msg");
console.log(evt.data);
document.getElementById("contextId").innerHTML = JSON.stringify(evt.data, null, 3);
}, false);
} catch (e) {
console.log(e);
}
parent.postMessage("appReady", "*");
}
</script>
</head>
<body>
<p>
<h2>A test application running at <span id="host"></span>.
</h2>
</p>
<p> The following context is passed from Communities: </p>
<pre id="contextId"></pre>
</body>
</html>
@ChristianLuxem
Copy link

@BerndGewehr, i am also interested in adding widgets only once. Do you have a solution?

@ChristianLuxem
Copy link

Solution is the "uniqueInstance" : "true" property..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment