{% load static %}

{% block js %}
<script src="{% static "js/tooltip.js" %}"></script>
<script src="{% static "js/popover.js" %}"></script>
<script src="{% static "js/moment.min.js" %}"></script>
<script src="{% static "js/moment-twitter.js" %}"></script>
<script>
	$(function () {
  $('[data-toggle="popover"]').popover().click(function(){
    if($(this).attr('href')){
      window.location.href = $(this).attr('href');
    }
  });

      // This keeps timeago values correct, but uses an insane amount of resources
      // $(function () {
      //     setInterval(function() {
      //         $('.date').each(function (index, dateElem) {
      //           var $dateElem = $(dateElem);
      //           var formatted = moment($dateElem.attr('data-date')).fromNow();
      //           $dateElem.text(formatted);
      //          })
      //        });
      //     }, 10000);
        moment().twitter();

})
  $(document).ready(function() {
    $(function () {
        $( "#activity" ).hide();
        $( "#activity" ).load( "{% url 'activity_feed' %}", function() {
          $('#activity_loading').slideUp('slow',function(){
              $('#activity').slideDown('slow');
          });

          $('#activity [data-toggle="popover"]').popover();

          $('.date').each(function (index, dateElem) {
            var $dateElem = $(dateElem);
            var formatted = moment($dateElem.attr('data-date')).twitterLong();
            $dateElem.text(formatted);
          });

        });
    });
  });
</script>
{% endblock %}

    <div class="panel panel-default">
      <div class="panel-heading">
        <h4 class="panel-title">Recent Changes</h4>
      </div>
      
      <div class="list-group">
        <div id="activity_loading" class="list-group-item loading-animation">
          <div class="circle"></div>
          <div class="circle1"></div>
        </div>
        <div id="activity">
        </div>
      </div> 
      
    </div>

