Notifications

The notifications app lets users know when they are @mentioned, when someone likes what they did or when something they follow is updated.

Properties

Type: notifications
Full type: Weavy.Areas.Apps.Models.Notifications
Guid: f667c9ee-b1f1-49e6-b32f-8a363f5cdb96

Code

To create a new notifications app from the client, you use the Object definifion syntax to create it. You need to specify key, type and optionally the container where to place it and a name.

var weavy = new Weavy();
var notifications = weavy.space("my_space_key").app({ 
    key: "my_notifications_key", 
    name: "Notifications",
    type: "notifications", 
    container: "#mynotificationscontainer" 
});

Features

User specific notifications

The list of notifications is specific to the current user. It keeps track of read and unread notifications and you can see where the notification originated from.

Settings

The user may control which spaces, apps or items to receive notifications from by toggling settings on that specific item. Notification settings are inherited from the parent item.

Integrated navigation

The notification list requires the navigation to be set up for full functionality. When clicking the notification, navigation will then handle opening of the correct app in the correct place in the web site or web app.

Badges

The Client provides an event which provides the number of unread notifications. This event gets triggered whenever a new notification is receivied. It is useful to for instance place a badge on an icon you use to toggle the notifications app.

Event: "badge"
Data: data.notifications

var weavy = new Weavy();

function setBadge(selector, count) {
    if (count > 0) {
        var $badge = $(selector + " .badge");
        if ($badge.length) {
            $badge.text(count);
        } else {
            $('<span class="badge">' + count + '</span>').appendTo(selector);
        }
    } else {
        $(selector + " .badge").remove();
    }
}

weavy.on("badge", function (e, data) {
    setBadge("#weavyNotificationsButton", data.notifications);
});