Added skeleton for news editor
Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
parent
dfeed19fa7
commit
91e5d2336c
@ -4,10 +4,13 @@ namespace KekRozsak\AdminBundle\Controller;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
|
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
|
||||||
use JMS\DiExtraBundle\Annotation as DI;
|
use JMS\DiExtraBundle\Annotation as DI;
|
||||||
|
|
||||||
|
use KekRozsak\FrontBundle\Entity\News;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/admin")
|
* @Route("/admin")
|
||||||
*/
|
*/
|
||||||
@ -34,14 +37,22 @@ class NewsController extends Controller
|
|||||||
*/
|
*/
|
||||||
private $securityContext;
|
private $securityContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Symfony\Component\Security\Acl\Domain\ObjectIdentity $objectIdentity
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->objectIdentity = new ObjectIdentity(self::OBJECT_ID, self::OBJECT_FQCN);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/hirek/", name="KekRozsakAdminBundle_newsList")
|
* @Route("/hirek/", name="KekRozsakAdminBundle_newsList")
|
||||||
* @Template
|
* @Template
|
||||||
*/
|
*/
|
||||||
public function listAction()
|
public function listAction()
|
||||||
{
|
{
|
||||||
$objectIdentity = new ObjectIdentity(self::OBJECT_ID, self::OBJECT_FQCN);
|
if ($this->securityContext->isGranted('OWNER', $this->objectIdentity) === false) {
|
||||||
if ($this->securityContext->isGranted('OWNER', $objectIdentity) === false) {
|
|
||||||
throw new AccessDeniedException('Nincs jogosultságod a hírszerkesztéshez!');
|
throw new AccessDeniedException('Nincs jogosultságod a hírszerkesztéshez!');
|
||||||
}
|
}
|
||||||
$news = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:News')->findAll();
|
$news = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:News')->findAll();
|
||||||
@ -51,6 +62,18 @@ class NewsController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/hirek/{slug}/szerkesztes.html", name="KekRozsakAdminBundle_newsEdit")
|
||||||
|
* @Template
|
||||||
|
* @ParamConverter("news")
|
||||||
|
*/
|
||||||
|
public function editAction(News $news)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'news' => $news,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/sugo/hirek", name="KekRozsakAdminBundle_newsListHelp")
|
* @Route("/sugo/hirek", name="KekRozsakAdminBundle_newsListHelp")
|
||||||
* @Template
|
* @Template
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
{# vim: ft=htmljinja
|
||||||
|
#}
|
||||||
|
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h3>Hírszerkesztő - {{ news.title }}</h3>
|
||||||
|
{% endblock %}
|
@ -8,9 +8,10 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td>Cím</td>
|
||||||
<td>Írta</td>
|
<td>Írta</td>
|
||||||
<td>Dátum</td>
|
<td>Dátum</td>
|
||||||
<td>Cím</td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -21,9 +22,9 @@
|
|||||||
{% if item.sticky %}[Ragadós ikon]{% else %}[Nem ragadós ikon]{% endif %}
|
{% if item.sticky %}[Ragadós ikon]{% else %}[Nem ragadós ikon]{% endif %}
|
||||||
{% if item.draft %}[Vázlat ikon]{% else %}[Publikált ikon]{% endif %}
|
{% if item.draft %}[Vázlat ikon]{% else %}[Publikált ikon]{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.createdBy.displayName }}</td>
|
<td><a href="{{ path('KekRozsakAdminBundle_newsEdit', {slug: item.slug}) }}">{{ item.title }}</a></td>
|
||||||
|
<td>{{ item.createdBy|userdataspan }}</td>
|
||||||
<td>{{ item.createdAt|date('Y-m-d') }}</td>
|
<td>{{ item.createdAt|date('Y-m-d') }}</td>
|
||||||
<td>{{ item.title }}</td>
|
|
||||||
<td>[Törlés ikon]</td>
|
<td>[Törlés ikon]</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user