Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Boutell committed May 7, 2014
2 parents 3bea97b + 473e58d commit 3762018
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -54,5 +54,14 @@ Once the tweets have been fully loaded into the template, an event called 'aposT
$widget.find('.apos-tweets').makeThemMoreAwesome();
});
```
## aposTwitterNull
If no tweets could be found, an event called 'aposTwitterNull' fires. If you want something special to happen if there are no tweets available, this is your event.

```javascript
$('body').on('aposTwitterNull', '.apos-widget', function() {
$widget = $(this);
$widget.find('.apos-tweets').seeYaLaterTemplate();
});
```

Enjoy!
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "apostrophe-twitter",
"version": "0.5.7",
"version": "0.5.8",
"description": "Adds a Twitter feed widget to Apostrophe's rich content editor",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions public/js/content.js
Expand Up @@ -22,6 +22,7 @@ apos.widgetPlayers.twitter = function($widget) {
function(tweets) {
var $tweets = $widget.find('.apos-tweets');
if (!tweets.length) {
$widget.trigger('aposTwitterNull');
return;
}
$tweets.find('.apos-tweet:not(.apos-template)').remove();
Expand Down

0 comments on commit 3762018

Please sign in to comment.