Skip to content

Instantly share code, notes, and snippets.

@shrutis22
Created November 28, 2017 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrutis22/58a5e818f33529b3415841b4f064accd to your computer and use it in GitHub Desktop.
Save shrutis22/58a5e818f33529b3415841b4f064accd to your computer and use it in GitHub Desktop.
<apex:page standardStylesheets="false" showHeader="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Announcements</title>
<meta httpequiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--Stylesheets-->
<link rel="stylesheet" href="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/css/SLDS.css' )}" />
<link rel="stylesheet" href="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/css/Custom.css' )}" />
</head>
<body>
<apex:remoteObjects >
<apex:remoteObjectModel name="Acknowledged_User__c" fields="Announcement__c"></apex:remoteObjectModel>
</apex:remoteObjects>
<div class="slds-scope">
<!--No Announcements Message-->
<div id="divNoAnnouncements" class="slds-box slds-theme_shade">
<p>
<span class="slds-icon_container slds-icon-utility-info_alt">
<svg class="slds-icon slds-icon-text-default slds-icon_x-small">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{!URLFOR( $Asset.SLDS, '/assets/icons/utility-sprite/svg/symbols.svg#info_alt')}" />
</svg>
</span>
No Announcements have been made.
</p>
</div>
<!--All Announcements-->
<div id="divAnnouncements"></div>
</div>
<!--Template-->
<script id="announcement-template" type="text/x-handlebars-template">
<div id="{{Id}}" class="slds-notification-container">
<section class="slds-notification" role="dialog">
<div class="slds-notification__body">
<a class="slds-notification__target slds-media" href="javascript:void(0);">
<span class="slds-icon_container slds-icon-standard-announcement slds-media__figure" title="Announcement">
<svg class="slds-icon slds-icon--small">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{!URLFOR( $Asset.SLDS, '/assets/icons/standard-sprite/svg/symbols.svg#announcement')}" />
</svg>
</span>
<div class="slds-media__body">
<h2 class="slds-text-heading--small slds-m-bottom--xx-small">
{{Name}}
</h2>
<p>{{Details__c}}</p>
</div>
</a>
<button class="slds-button slds-button_icon slds-button--icon-container slds-notification__close" title="Dismiss" onclick="AnnouncementsApp.eventHandlers.dismissAnnouncement( '{{Id}}' );">
<svg class="slds-button__icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{!URLFOR( $Asset.SLDS, '/assets/icons/utility-sprite/svg/symbols.svg#close' )}" />
</svg>
</button>
</div>
</section>
</div>
</script>
<!--Scripts-->
<script src="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/js/jquery-1.5.1.js' )}"></script>
<script src="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/js/push.min.js' )}"></script>
<script src="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/js/cometd.js' )}"></script>
<script src="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/js/jquery.cometd.js' )}"></script>
<script src="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/js/handlebars.min.js' )}"></script>
<script src="{!URLFOR( $Resource.AnnouncementsAssets, 'assets/js/AnnouncementsApp.js' )}"></script>
<script>
/**
* Call the init() method
* supplying the Session Id,
* CometD URL, Channel URL
* and path to the Icon(spot it in
* the SR).
*/
AnnouncementsApp.init(
{
SESSION_ID : "{!$API.Session_ID}",
COMETD_URL : "{!LEFT($API.Enterprise_Server_URL_410, FIND('/services', $API.Enterprise_Server_URL_410))}" + "cometd/41.0/",
CHANNEL_URL : "/topic/Announcements",
ICON_PATH : "{!URLFOR( $Resource.AnnouncementsAssets, 'assets/img/announcement.png' )}"
}
);
</script>
</body>
</html>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment