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

<%block name="title">
    %if c.show_private:
        ${_('Private Gists for User %s') % request.authuser.username}
    %elif c.show_public:
        ${_('Public Gists for User %s') % request.authuser.username}
    %else:
        ${_('Public Gists')}
    %endif
</%block>

<%def name="breadcrumbs_links()">
    %if c.show_private:
        ${_('Private Gists for User %s') % request.authuser.username}
    %elif c.show_public:
        ${_('Public Gists for User %s') % request.authuser.username}
    %else:
        ${_('Public Gists')}
    %endif
    - ${c.gists_pager.item_count}
</%def>

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

<%def name="main()">
<div class="panel panel-primary">
    <div class="panel-heading clearfix">
        <div class="pull-left">
            ${self.breadcrumbs()}
        </div>
        %if request.authuser.username != 'default':
        <div class="pull-right">
             <a href="${h.url('new_gist')}" class="btn btn-success btn-xs"><i class="icon-plus"></i>${_('Create New Gist')}</a>
        </div>
        %endif
    </div>
    <div class="panel-body">
      %if c.gists_pager.item_count>0:
        % for gist in c.gists_pager:
          <div class="gist-item clearfix">
            ${h.gravatar_div(gist.owner.email, size=28)}
            <span title="${gist.owner.full_contact}" class="user">
                <b>${gist.owner.username}</b> /
                <b><a href="${h.url('gist',gist_id=gist.gist_access_id)}">gist: ${gist.gist_access_id}</a></b>
            </span>
            <div>
                ${_('Created')} ${h.age(gist.created_on)} /
                <span class="text-muted">
                  %if gist.gist_expires == -1:
                   ${_('Expires')}: ${_('Never')}
                  %else:
                   ${_('Expires')}: ${h.age(h.time_to_datetime(gist.gist_expires))}
                  %endif
                </span>
            </div>

            <div class="text-muted">${gist.gist_description}</div>
          </div>
        % endfor
        ${c.gists_pager.pager()}
      %else:
        <div>${_('There are no gists yet')}</div>
      %endif
    </div>
</div>
</%def>
