Statistics
| Branch: | Tag: | Revision:

root / cloudcms / templates / content / twitter_feed.html @ c1468bcc

History | View | Annotate | Download (1.1 kB)

1
<div class="section twitter-feed">
2
    {% if content.title %}
3
        <h2>{{ content.title|safe }}</h2>
4
    {% endif %}
5
    <div id="twitter_feeds_section_{{ content.pk }}">
6
    </div>
7
</div>
8

    
9
<script id="feeds-template-{{ content.pk }}" type="text/x-jquery-tmpl">
10
    <li><b>${Name}</b> (${ReleaseYear})</li>
11
</script>
12
<script>
13
    $(document).ready(function(){
14
        var el = $("#twitter_feeds_section_{{ content.pk }}");
15
        $.twitter({{ content.js_conf|safe}}, function(tweets){
16
            $.each(tweets.results, function(i,t){
17
                console.log(t);
18
                var tweet = $('<div class="tweet">');
19
                var date = $('<span class="date">');
20
                var text = $('<span class="text">');
21
                
22
                text.html(linkify(t.text));
23
                date.html('<a href="http://twitter.com/#!/' + t.from_user + 
24
                '">' + $.timeago(new Date(t.created_at)) + 
25
                '</a>');
26

27
                tweet.append(date);
28
                tweet.append(text);
29
                el.append(tweet);
30
            })
31
        })
32

33
    })
34
</script>