This commit is contained in:
Simon Vieille 2015-11-23 21:09:32 +01:00
parent c0eadc3433
commit 1f03baafb5
4 changed files with 56 additions and 1 deletions

View file

@ -17,6 +17,9 @@ app:
my:
title: 'Account'
my:
title: 'My gists'
gist:
untitled: 'Untitled'
404:

View file

@ -17,6 +17,9 @@ app:
my:
title: 'Mon compte'
my:
title: 'Mes Gists'
gist:
untitled: 'Sans titre'
404:

View file

@ -4,6 +4,8 @@ namespace Gist\Model;
use Gist\Model\Base\User as BaseUser;
use Symfony\Component\Security\Core\User\UserInterface;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Connection\ConnectionInterface;
class User extends BaseUser implements UserInterface
{
@ -16,4 +18,13 @@ class User extends BaseUser implements UserInterface
{
return explode(',', parent::getRoles());
}
public function getGists(Criteria $criteria = null, ConnectionInterface $con = null)
{
if ($criteria === null) {
$criteria = GistQuery::create()->orderById(Criteria::DESC);
}
return parent::getGists($criteria, $con);
}
}

View file

@ -1,5 +1,43 @@
{% extends 'base.html.twig' %}
{% block title %}{{ 'my.title'|trans }}{% endblock %}
{% block body %}
foo
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
{{ 'my.title'|trans }}
</div>
<div class="panel-body">
<div class="tab-content">
{% for gist in user.gists %}
<div class="commit">
<p>
<strong>{{ gist.title ? gist.title : 'gist.untitled'|trans }}</strong>,
{{ gist.createdAt|date('date.format'|trans) }}
</p>
<p>
<button class="btn btn-info btn-sm">
{{ gist.type }}
</button>
{% if not gist.cipher %}
<a href="{{ path('view', {gist: gist.file}) }}" class="btn btn-warning btn-sm">
View
</a>
{% else %}
<button class="btn btn-error btn-sm">
<span class="glyphicon glyphicon-lock"></span>
</button>
{% endif %}
</p>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}