The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Added skeleton for news editor

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
master
Gergely POLONKAI (W00d5t0ck) 10 years ago
parent dfeed19fa7
commit 91e5d2336c
  1. 27
      src/KekRozsak/AdminBundle/Controller/NewsController.php
  2. 7
      src/KekRozsak/AdminBundle/Resources/views/News/edit.html.twig
  3. 7
      src/KekRozsak/AdminBundle/Resources/views/News/list.html.twig

@ -4,10 +4,13 @@ namespace KekRozsak\AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use JMS\DiExtraBundle\Annotation as DI;
use KekRozsak\FrontBundle\Entity\News;
/**
* @Route("/admin")
*/
@ -34,14 +37,22 @@ class NewsController extends Controller
*/
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")
* @Template
*/
public function listAction()
{
$objectIdentity = new ObjectIdentity(self::OBJECT_ID, self::OBJECT_FQCN);
if ($this->securityContext->isGranted('OWNER', $objectIdentity) === false) {
if ($this->securityContext->isGranted('OWNER', $this->objectIdentity) === false) {
throw new AccessDeniedException('Nincs jogosultságod a hírszerkesztéshez!');
}
$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")
* @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>
<tr>
<td></td>
<td>Cím</td>
<td>Írta</td>
<td>Dátum</td>
<td>Cím</td>
<td></td>
</tr>
</thead>
<tbody>
@ -21,9 +22,9 @@
{% if item.sticky %}[Ragadós ikon]{% else %}[Nem ragadós ikon]{% endif %}
{% if item.draft %}[Vázlat ikon]{% else %}[Publikált ikon]{% endif %}
</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.title }}</td>
<td>[Törlés ikon]</td>
</tr>
{% endfor %}

Loading…
Cancel
Save