Announcement API
The Announcement API provides the functionality to show an announcement or a list of announcements on the announcement board located in the top right of the SmartEdit interface. Announcements inform users about something that requires their attention, such as tasks assigned to them in active workflows.
You use the showAnnouncement method provided by the Announcement API to create the announcements that are displayed in the SmartEdit interface and the closeAnnouncement method to close an announcement.
SmartEdit has two default types of announcements for workflows:
- Single task announcement: Displays information about a single workflow inbox task. When the user clicks on the announcement, SmartEdit redirects the user to page specified in the task and opens the Page Tasks menu.
- Multiple task announcement: If the user receives more than one new announcement at the same time, SmartEdit groups the announcements and displays them together. The announcement indicates the number of new notifications for the user. When the user clicks on the grouped announcement, SmartEdit opens the Inbox panel.
showAnnouncement Method
You create an announcement using the showAnnouncement method within an AccouncementConfig. You can use the following properties in your announcement:
|
Property |
Type |
Description |
|---|---|---|
|
message |
String |
The message to display in the announcement. To display an announcement, you must specify one of the following:
|
|
messageTitle |
String |
An optional title for the announcement message. This is used only when a message is available. |
|
template |
String |
The HTML template to use in the announcement. To display an announcement, you must specify one of the following:
|
|
templateUrl |
String |
The template URL to use in the announcement. To display an announcement, you must specify one of the following:
|
|
controller |
angular.IControllerConstructor |
The custom controller that defines the specified template or templateUrl. The content of the controller in the template or templateUrl can be accessed using $announcementCtrl alias. |
|
closeable |
Boolean |
An optional boolean that specifies if a close button (x) is displayed in the announcement or not. The default value is True. |
|
timeout |
Number |
An optional timeout in milliseconds that specifies when to close the announcement. The default value is 5000. |
The following sections provide examples of the announcements you can define using the properties provided by the showAnnouncement method.
Simple Announcement
announcementService.showAnnouncement({
messageTitle: 'This is the message title',
message: 'This is a simple announcement'
});
Announcement using a Non-closeable Template and a Custom Controller
announcementId = announcementService.showAnnouncement({
template: '<div>{{$announcementCtrl.taskName}}<br/>{{$announcementCtrl.pageDetails}}<br/><br/>{{$announcementCtrl.body}}</div>',
controller: function ctrl() {
'ngInject';
this.taskName = 'Translation (DE)';
this.pageDetails = 'Electronics Staged | Homepage';
this.body = 'This is a template based announcement';
},
closeable: false
});
Announcement using a Closeable templateUrl and a Timeout
announcementId = announcementService.showAnnouncement({
templateUrl: 'sampleAnnouncement1Template.html'
closeable: true,
timeout: 7000
});
Announcement using a TemplateUrl and a Custom Controller
announcementId = announcementService.showAnnouncement({
templateUrl: 'sampleAnnouncement2Template.html',
controller: function ctrl() {
'ngInject';
this.data = 'This is the data coming from a custom controller';
},
closeable: true
});
closeAnnouncement Method
To close an announcement manually, use the closeAnnouncement method with the announcementId parameter as shown in the following example:
announcementService.closeAnnouncement(announcementId);