{% extends "feedme/base.html" %}
{% block content %}


{% for item in feed_items %}
    <div class="feed un-read" id="{{ item.id }}" style='border-bottom: 1px solid #999; padding-bottom:12px;'>
    <h2><a href="{{ item.link }}" target="_blank">{{ item.title }}</a> <small>{{ item.feed.title }}</small></h2>
    {{ item.content|safe }}
    </div>
{% endfor %}

{% endblock %}
{% block extra_js %}
<script>
    $('.un-read').waypoint(function(direction) {
        mark_read($(this).attr('id'));
    });

    function mark_read(item_id){
        $.ajax({
            type: "POST",
            url: '{% url feedme-mark-as-read-ajax %}',
            data: {'feed_item_id': item_id},
        });
    }
</script>

{% endblock %}
{% block sidebar %}
<div class="span3">
    <div class="well sidebar-nav">
        <ul class="nav nav-list">
            <li class="nav-header">Feeds</li>
            {% for category in categories %}
            <li class="nav-header"><a href="{% url feedme-feed-list-by-category category=category.slug %}"><span class='badge'>{{ category.get_unread_count }}</span> {{ category }}</a></li>
            {% for feed in category.feed_set.all %}
                <li><a href="{{ feed.get_absolute_url }}"><span class="badge">{{ feed.get_unread_count }}</span> {{ feed.title }}</a></li>
            {% endfor %}
            {% endfor %}

        </ul>
    </div><!--/.well -->
</div><!--/span-->
{% endblock %}