Revised the Group stuff (Controllers, and templates)
Signed-off-by: Polonkai Gergely <polesz@w00d5t0ck.info>
This commit is contained in:
		@@ -9,7 +9,7 @@
 | 
				
			|||||||
								<dt>Csoportjaim</dt>
 | 
													<dt>Csoportjaim</dt>
 | 
				
			||||||
{% for group in app.user.groups %}
 | 
					{% for group in app.user.groups %}
 | 
				
			||||||
{% if group.group.open or group.membershipAcceptedAt %}
 | 
					{% if group.group.open or group.membershipAcceptedAt %}
 | 
				
			||||||
								<dl><a href="{{ path('KekRozsakFrontBundle_groupView', {groupSlug: group.group.slug}) }}">{{ group.group.name }}</a></dl>
 | 
													<dl><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.group.slug}) }}">{{ group.group.name }}</a></dl>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
{% endfor %}
 | 
					{% endfor %}
 | 
				
			||||||
								<dl><a href="{{ path('KekRozsakFrontBundle_groupList') }}">További csoportok</a></dl>
 | 
													<dl><a href="{{ path('KekRozsakFrontBundle_groupList') }}">További csoportok</a></dl>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,7 @@ namespace KekRozsak\FrontBundle\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 KekRozsak\FrontBundle\Entity\UserGroupMembership;
 | 
					use KekRozsak\FrontBundle\Entity\UserGroupMembership;
 | 
				
			||||||
use KekRozsak\FrontBundle\Entity\Group;
 | 
					use KekRozsak\FrontBundle\Entity\Group;
 | 
				
			||||||
@@ -19,74 +20,64 @@ class GroupController extends Controller
 | 
				
			|||||||
	 * @Route("/csoportok", name="KekRozsakFrontBundle_groupList")
 | 
						 * @Route("/csoportok", name="KekRozsakFrontBundle_groupList")
 | 
				
			||||||
	 * @Template()
 | 
						 * @Template()
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function groupListAction()
 | 
						public function listAction()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
 | 
							$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
 | 
				
			||||||
		$groups = $groupRepo->findAll(array('name' => 'DESC'));
 | 
							$groups = $groupRepo->findAll(array('name' => 'ASC'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return array(
 | 
							return array(
 | 
				
			||||||
			'groups' => $groups,
 | 
								'groups' => $groups,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * @Route("/csoport/{groupSlug}", name="KekRozsakFrontBundle_groupView")
 | 
						 * @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView")
 | 
				
			||||||
	 * @Template()
 | 
						 * @Template()
 | 
				
			||||||
 | 
						 * @ParamConverter("group")
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function groupViewAction($groupSlug)
 | 
						public function viewAction(Group $group)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
 | 
					 | 
				
			||||||
		if (!($group = $groupRepo->findOneBySlug($groupSlug)))
 | 
					 | 
				
			||||||
			throw $this->createNotFoundException('A kért csoport nem létezik!');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return array(
 | 
							return array(
 | 
				
			||||||
			'group' => $group,
 | 
								'group' => $group,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * @Route("/csoport/{groupSlug}/tagok", name="KekRozsakFrontBundle_groupMembers")
 | 
						 * @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers")
 | 
				
			||||||
	 * @Template()
 | 
						 * @Template()
 | 
				
			||||||
 | 
						 * @ParamConverter("group")
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function groupMembersAction($groupSlug)
 | 
						public function membersAction(Group $group)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
 | 
					 | 
				
			||||||
		if (!($group = $groupRepo->findOneBySlug($groupSlug)))
 | 
					 | 
				
			||||||
			throw $this->createNotFoundException('A kért csoport nem létezik!');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return array(
 | 
							return array(
 | 
				
			||||||
			'group' => $group,
 | 
								'group' => $group,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * @Route("/csoport/{groupSlug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments")
 | 
						 * @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments")
 | 
				
			||||||
	 * @Template()
 | 
						 * @Template()
 | 
				
			||||||
 | 
						 * @ParamConverter("group")
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function groupDocumentsAction($groupSlug)
 | 
						public function documentsAction(Group $group)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
 | 
					 | 
				
			||||||
		if (!($group = $groupRepo->findOneBySlug($groupSlug)))
 | 
					 | 
				
			||||||
			throw $this->createNotFoundException('A kért csoport nem létezik!');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return array(
 | 
							return array(
 | 
				
			||||||
			'group' => $group,
 | 
								'group' => $group,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * @Route("/csoport/{groupSlug}/belepes", name="KekRozsakFrontBundle_groupJoin")
 | 
						 * @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin")
 | 
				
			||||||
	 * @Template()
 | 
						 * @Template()
 | 
				
			||||||
 | 
						 * @ParamConverter("group")
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function groupJoinAction($groupSlug)
 | 
						public function joinAction(Group $group)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$user = $this->get('security.context')->getToken()->getUser();
 | 
							$user = $this->get('security.context')->getToken()->getUser();
 | 
				
			||||||
		$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group');
 | 
					 | 
				
			||||||
		if (!($group = $groupRepo->findOneBySlug($groupSlug)))
 | 
					 | 
				
			||||||
			throw $this->createNotFoundException('A kért csoport nem létezik!');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($group->isMember($user))
 | 
							if ($group->isMember($user))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array($groupSlug => $group->getSlug())));
 | 
								return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array('slug' => $group->getSlug())));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($group->isRequested($user))
 | 
							if ($group->isRequested($user))
 | 
				
			||||||
@@ -113,7 +104,7 @@ class GroupController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if ($group->isOpen())
 | 
							if ($group->isOpen())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array($groupSlug => $group->getSlug())));
 | 
								return $this->redirect($this->generateUrl('KekRozsakFrontBundle_groupView', array('slug' => $group->getSlug())));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -137,7 +128,7 @@ class GroupController extends Controller
 | 
				
			|||||||
	 * @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate")
 | 
						 * @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate")
 | 
				
			||||||
	 * @Template()
 | 
						 * @Template()
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function groupCreateAction()
 | 
						public function createAction()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$group = new Group();
 | 
							$group = new Group();
 | 
				
			||||||
		$form = $this->createForm(new GroupType(), $group);
 | 
							$form = $this->createForm(new GroupType(), $group);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					{# vim: ft=htmljinja
 | 
				
			||||||
 | 
					#}
 | 
				
			||||||
{% extends '::main_template.html.twig' %}
 | 
					{% extends '::main_template.html.twig' %}
 | 
				
			||||||
{% block title %} - {{ group.name }}{% endblock %}
 | 
					{% block title %} - {{ group.name }}{% endblock %}
 | 
				
			||||||
{% block additional_css %}
 | 
					{% block additional_css %}
 | 
				
			||||||
@@ -5,8 +7,7 @@
 | 
				
			|||||||
{% endblock additional_css %}
 | 
					{% endblock additional_css %}
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
<ul id="submenu">
 | 
					<ul id="submenu">
 | 
				
			||||||
	<li><a href="{{ path('KekRozsakFrontBundle_groupView', { groupSlug: group.slug }) }}">Leírás</a></li>
 | 
						<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li>
 | 
				
			||||||
	<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', { groupSlug: group.slug }) }}">Tagok</a></li>
 | 
					 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
<h3>{{ group.name }} - Dokumentumok</h3>
 | 
					<h3>{{ group.name }} - Dokumentumok</h3>
 | 
				
			||||||
<table>
 | 
					<table>
 | 
				
			||||||
@@ -20,7 +21,7 @@
 | 
				
			|||||||
{% for document in group.documents %}
 | 
					{% for document in group.documents %}
 | 
				
			||||||
		<tr>
 | 
							<tr>
 | 
				
			||||||
			<td>[ikon]</td>
 | 
								<td>[ikon]</td>
 | 
				
			||||||
			<td><a href="{{ path('KekRozsakFrontBundle_documentView', { documentSlug: document.slug }) }}">{{ document.title }}</a></td>
 | 
								<td><a href="{{ path('KekRozsakFrontBundle_documentView', {slug: document.slug}) }}">{{ document.title }}</a></td>
 | 
				
			||||||
			<td>
 | 
								<td>
 | 
				
			||||||
				{{ document.createdBy.displayName }}<br />
 | 
									{{ document.createdBy.displayName }}<br />
 | 
				
			||||||
				{{ document.createdAt|date('Y-m-d H:i') }}
 | 
									{{ document.createdAt|date('Y-m-d H:i') }}
 | 
				
			||||||
@@ -29,5 +30,5 @@
 | 
				
			|||||||
{% endfor %}
 | 
					{% endfor %}
 | 
				
			||||||
	</tbody>
 | 
						</tbody>
 | 
				
			||||||
</table>
 | 
					</table>
 | 
				
			||||||
<a href="{{ path('KekRozsakFrontBundle_documentCreate', { groupSlug: group.slug }) }}">Új dokumentum</a>
 | 
					<a href="{{ path('KekRozsakFrontBundle_documentCreate', {slug: group.slug}) }}">Új dokumentum</a>
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					{# vim: ft=htmljinja
 | 
				
			||||||
 | 
					#}
 | 
				
			||||||
{% extends '::main_template.html.twig' %}
 | 
					{% extends '::main_template.html.twig' %}
 | 
				
			||||||
{% block title %} - Csoportok{% endblock %}
 | 
					{% block title %} - Csoportok{% endblock %}
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
@@ -18,7 +20,7 @@
 | 
				
			|||||||
{% for group in groups %}
 | 
					{% for group in groups %}
 | 
				
			||||||
		<tr>
 | 
							<tr>
 | 
				
			||||||
			<td>[ikon]</td>
 | 
								<td>[ikon]</td>
 | 
				
			||||||
			<td class="csoport" title="{{ group.description }}"><a href="{{ path('KekRozsakFrontBundle_groupView', {groupSlug: group.slug }) }}">{{ group.name }}</a></td>
 | 
								<td class="csoport" title="{{ group.description }}"><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">{{ group.name }}</a></td>
 | 
				
			||||||
			<td>
 | 
								<td>
 | 
				
			||||||
				{% if group.isMember(app.user) %}
 | 
									{% if group.isMember(app.user) %}
 | 
				
			||||||
					<span title="Már tag vagy" class="ikon">[tag ikon]</span>
 | 
										<span title="Már tag vagy" class="ikon">[tag ikon]</span>
 | 
				
			||||||
@@ -26,9 +28,9 @@
 | 
				
			|||||||
					<span title="Már jelentkeztél, de a jelentkezésedet a csoport vezetője még nem fogadta el" class="ikon">[jelentkeztél ikon]</span>
 | 
										<span title="Már jelentkeztél, de a jelentkezésedet a csoport vezetője még nem fogadta el" class="ikon">[jelentkeztél ikon]</span>
 | 
				
			||||||
				{% else %}
 | 
									{% else %}
 | 
				
			||||||
					{% if group.isOpen %}
 | 
										{% if group.isOpen %}
 | 
				
			||||||
						<a href="{{ path('KekRozsakFrontBundle_groupJoin', { groupSlug: group.slug }) }}"><span title="Nyílt csoport, kattints a belépéshez!" class="ikon">[nyílt ikon]</span></a>
 | 
											<a href="{{ path('KekRozsakFrontBundle_groupJoin', {slug: group.slug}) }}"><span title="Nyílt csoport, kattints a belépéshez!" class="ikon">[nyílt ikon]</span></a>
 | 
				
			||||||
					{% else %}
 | 
										{% else %}
 | 
				
			||||||
						<a href="{{ path('KekRozsakFrontBundle_groupJoin', { groupSlug: group.slug }) }}"><span title="Zárt csoport, kattints a jelentkezéshez!" class="ikon">[zárt ikon]</span></a>
 | 
											<a href="{{ path('KekRozsakFrontBundle_groupJoin', {slug: group.slug}) }}"><span title="Zárt csoport, kattints a jelentkezéshez!" class="ikon">[zárt ikon]</span></a>
 | 
				
			||||||
					{% endif %}
 | 
										{% endif %}
 | 
				
			||||||
				{% endif %}
 | 
									{% endif %}
 | 
				
			||||||
			</td>
 | 
								</td>
 | 
				
			||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					{# vim: ft=htmljinja
 | 
				
			||||||
 | 
					#}
 | 
				
			||||||
{% extends '::main_template.html.twig' %}
 | 
					{% extends '::main_template.html.twig' %}
 | 
				
			||||||
{% block title %} - {{ group.name }}{% endblock %}
 | 
					{% block title %} - {{ group.name }}{% endblock %}
 | 
				
			||||||
{% block additional_css %}
 | 
					{% block additional_css %}
 | 
				
			||||||
@@ -5,8 +7,8 @@
 | 
				
			|||||||
{% endblock additional_css %}
 | 
					{% endblock additional_css %}
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
<ul id="submenu">
 | 
					<ul id="submenu">
 | 
				
			||||||
	<li><a href="{{ path('KekRozsakFrontBundle_groupView', {groupSlug: group.slug }) }}">Leírás</a></li>
 | 
						<li><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">Leírás</a></li>
 | 
				
			||||||
	<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {groupSlug: group.slug }) }}">Dokumentumok</a></li>
 | 
						<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
<h3>{{ group.name }} - Tagok</h3>
 | 
					<h3>{{ group.name }} - Tagok</h3>
 | 
				
			||||||
<ul>
 | 
					<ul>
 | 
				
			||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					{# vim: ft=htmljinja
 | 
				
			||||||
 | 
					#}
 | 
				
			||||||
{% extends '::main_template.html.twig' %}
 | 
					{% extends '::main_template.html.twig' %}
 | 
				
			||||||
{% block title %} - {{ group.name }}{% endblock %}
 | 
					{% block title %} - {{ group.name }}{% endblock %}
 | 
				
			||||||
{% block additional_css %}
 | 
					{% block additional_css %}
 | 
				
			||||||
@@ -5,8 +7,8 @@
 | 
				
			|||||||
{% endblock additional_css %}
 | 
					{% endblock additional_css %}
 | 
				
			||||||
{% block content %}
 | 
					{% block content %}
 | 
				
			||||||
<ul id="submenu">
 | 
					<ul id="submenu">
 | 
				
			||||||
	<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {groupSlug: group.slug }) }}">Tagok</a></li>
 | 
						<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li>
 | 
				
			||||||
	<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {groupSlug: group.slug }) }}">Dokumentumok</a></li>
 | 
						<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
<h3>{{ group.name }}</h3>
 | 
					<h3>{{ group.name }}</h3>
 | 
				
			||||||
{{ group.description|raw }}
 | 
					{{ group.description|raw }}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user