diff --git a/app/locales/en.yml b/app/locales/en.yml index 5e8ac07..6f4bdf7 100644 --- a/app/locales/en.yml +++ b/app/locales/en.yml @@ -17,6 +17,9 @@ app: my: title: 'Account' +my: + title: 'My gists' + gist: untitled: 'Untitled' 404: diff --git a/app/locales/fr.yml b/app/locales/fr.yml index c18322e..e9ef99e 100644 --- a/app/locales/fr.yml +++ b/app/locales/fr.yml @@ -17,6 +17,9 @@ app: my: title: 'Mon compte' +my: + title: 'Mes Gists' + gist: untitled: 'Sans titre' 404: diff --git a/src/Gist/Model/User.php b/src/Gist/Model/User.php index 4702421..fca1a40 100644 --- a/src/Gist/Model/User.php +++ b/src/Gist/Model/User.php @@ -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); + } } diff --git a/src/Gist/Resources/views/My/my.html.twig b/src/Gist/Resources/views/My/my.html.twig index e228a12..d2f1942 100644 --- a/src/Gist/Resources/views/My/my.html.twig +++ b/src/Gist/Resources/views/My/my.html.twig @@ -1,5 +1,43 @@ {% extends 'base.html.twig' %} +{% block title %}{{ 'my.title'|trans }}{% endblock %} + {% block body %} - foo +
+
+
+
+ {{ 'my.title'|trans }} +
+
+
+ {% for gist in user.gists %} +
+

+ {{ gist.title ? gist.title : 'gist.untitled'|trans }}, + {{ gist.createdAt|date('date.format'|trans) }} +

+ +

+ + + {% if not gist.cipher %} + + View + + {% else %} + + {% endif %} +

+
+ {% endfor %} +
+
+
+
+
{% endblock %}