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

<%def name="title()">
    ${_('My Notifications')} ${c.authuser.username}
    %if c.site_name:
        &middot; ${c.site_name}
    %endif
</%def>

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

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

<%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-mini"><a href="${h.url.current()}">${_('All')}</a></span>
      <span id='comment' class="btn btn-mini"><a href="${h.url.current(type=c.comment_type)}">${_('Comments')}</a></span>
      <span id='pull_request' class="btn btn-mini"><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-mini">${_('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())}";
    ypjax(url,'notification_data',function(){run()});
});

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