## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>

<%block name="title">
    ${_('My Notifications')} ${c.authuser.username}
</%block>

<%def name="breadcrumbs_links()">
    ${_('My Notifications')}
</%def>

<%block name="header_menu">
    ${self.menu('admin')}
</%block>

<%def name="main()">
<div class="box">
    <!-- box / title -->
    <div class="title">
        ${self.breadcrumbs()}
    </div>

      <div style="padding:14px 18px;text-align: right;float:left">
      <span id='all' class="btn btn-small"><a href="${h.url.current()}">${_('All')}</a></span>
      <span id='comment' class="btn btn-small"><a href="${h.url.current(type=c.comment_type)}">${_('Comments')}</a></span>
      <span id='pull_request' class="btn btn-small"><a href="${h.url.current(type=c.pull_request_type)}">${_('Pull Requests')}</a></span>
      </div>
      %if c.notifications:
      <div style="padding:14px 18px;text-align: right;float:right">
      <span id='mark_all_read' class="btn btn-small">${_('Mark All Read')}</span>
      </div>
      %endif
  <div id='notification_data'>
    <%include file='notifications_data.html'/>
  </div>
</div>
<script type="text/javascript">
var url_action = "${url('notification', notification_id='__NOTIFICATION_ID__')}";
var run = function(){
  $('.delete-notification').click(function(e){
    var notification_id = e.currentTarget.id;
    deleteNotification(url_action,notification_id);
  });
  $('.read-notification').click(function(e){
    var notification_id = e.currentTarget.id;
    readNotification(url_action,notification_id);
  });
}
run();
$('#mark_all_read').click(function(){
    var url = "${h.url('notifications_mark_all_read', **request.GET.mixed())}";
    asynchtml(url, $('#notification_data'), function(){run();});
});

var current_filter = "${c.current_filter}";
$('#'+current_filter).addClass('active');
</script>
</%def>
