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> | ||||
| {% for group in app.user.groups %} | ||||
| {% 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 %} | ||||
| {% endfor %} | ||||
| 								<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 Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||||
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||||
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | ||||
|  | ||||
| use KekRozsak\FrontBundle\Entity\UserGroupMembership; | ||||
| use KekRozsak\FrontBundle\Entity\Group; | ||||
| @@ -19,74 +20,64 @@ class GroupController extends Controller | ||||
| 	 * @Route("/csoportok", name="KekRozsakFrontBundle_groupList") | ||||
| 	 * @Template() | ||||
| 	 */ | ||||
| 	public function groupListAction() | ||||
| 	public function listAction() | ||||
| 	{ | ||||
| 		$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Group'); | ||||
| 		$groups = $groupRepo->findAll(array('name' => 'DESC')); | ||||
| 		$groups = $groupRepo->findAll(array('name' => 'ASC')); | ||||
|  | ||||
| 		return array( | ||||
| 			'groups' => $groups, | ||||
| 		); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @Route("/csoport/{groupSlug}", name="KekRozsakFrontBundle_groupView") | ||||
| 	 * @Route("/csoport/{slug}", name="KekRozsakFrontBundle_groupView") | ||||
| 	 * @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( | ||||
| 			'group' => $group, | ||||
| 		); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @Route("/csoport/{groupSlug}/tagok", name="KekRozsakFrontBundle_groupMembers") | ||||
| 	 * @Route("/csoport/{slug}/tagok", name="KekRozsakFrontBundle_groupMembers") | ||||
| 	 * @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( | ||||
| 			'group' => $group, | ||||
| 		); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @Route("/csoport/{groupSlug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments") | ||||
| 	 * @Route("/csoport/{slug}/dokumentumok", name="KekRozsakFrontBundle_groupDocuments") | ||||
| 	 * @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( | ||||
| 			'group' => $group, | ||||
| 		); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @Route("/csoport/{groupSlug}/belepes", name="KekRozsakFrontBundle_groupJoin") | ||||
| 	 * @Route("/csoport/{slug}/belepes", name="KekRozsakFrontBundle_groupJoin") | ||||
| 	 * @Template() | ||||
| 	 * @ParamConverter("group") | ||||
| 	 */ | ||||
| 	public function groupJoinAction($groupSlug) | ||||
| 	public function joinAction(Group $group) | ||||
| 	{ | ||||
| 		$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)) | ||||
| 		{ | ||||
| 			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)) | ||||
| @@ -113,7 +104,7 @@ class GroupController extends Controller | ||||
|  | ||||
| 		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 | ||||
| 		{ | ||||
| @@ -137,7 +128,7 @@ class GroupController extends Controller | ||||
| 	 * @Route("/csoportok/uj", name="KekRozsakFrontBundle_groupCreate") | ||||
| 	 * @Template() | ||||
| 	 */ | ||||
| 	public function groupCreateAction() | ||||
| 	public function createAction() | ||||
| 	{ | ||||
| 		$group = new Group(); | ||||
| 		$form = $this->createForm(new GroupType(), $group); | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| {# vim: ft=htmljinja | ||||
| #} | ||||
| {% extends '::main_template.html.twig' %} | ||||
| {% block title %} - {{ group.name }}{% endblock %} | ||||
| {% block additional_css %} | ||||
| @@ -5,8 +7,7 @@ | ||||
| {% endblock additional_css %} | ||||
| {% block content %} | ||||
| <ul id="submenu"> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupView', { groupSlug: group.slug }) }}">Leírás</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', { groupSlug: group.slug }) }}">Tagok</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li> | ||||
| </ul> | ||||
| <h3>{{ group.name }} - Dokumentumok</h3> | ||||
| <table> | ||||
| @@ -20,7 +21,7 @@ | ||||
| {% for document in group.documents %} | ||||
| 		<tr> | ||||
| 			<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> | ||||
| 				{{ document.createdBy.displayName }}<br /> | ||||
| 				{{ document.createdAt|date('Y-m-d H:i') }} | ||||
| @@ -29,5 +30,5 @@ | ||||
| {% endfor %} | ||||
| 	</tbody> | ||||
| </table> | ||||
| <a href="{{ path('KekRozsakFrontBundle_documentCreate', { groupSlug: group.slug }) }}">Új dokumentum</a> | ||||
| <a href="{{ path('KekRozsakFrontBundle_documentCreate', {slug: group.slug}) }}">Új dokumentum</a> | ||||
| {% endblock %} | ||||
| @@ -1,3 +1,5 @@ | ||||
| {# vim: ft=htmljinja | ||||
| #} | ||||
| {% extends '::main_template.html.twig' %} | ||||
| {% block title %} - Csoportok{% endblock %} | ||||
| {% block content %} | ||||
| @@ -18,7 +20,7 @@ | ||||
| {% for group in groups %} | ||||
| 		<tr> | ||||
| 			<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> | ||||
| 				{% if group.isMember(app.user) %} | ||||
| 					<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> | ||||
| 				{% else %} | ||||
| 					{% 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 %} | ||||
| 						<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 %} | ||||
| 			</td> | ||||
| @@ -1,3 +1,5 @@ | ||||
| {# vim: ft=htmljinja | ||||
| #} | ||||
| {% extends '::main_template.html.twig' %} | ||||
| {% block title %} - {{ group.name }}{% endblock %} | ||||
| {% block additional_css %} | ||||
| @@ -5,8 +7,8 @@ | ||||
| {% endblock additional_css %} | ||||
| {% block content %} | ||||
| <ul id="submenu"> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupView', {groupSlug: group.slug }) }}">Leírás</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {groupSlug: group.slug }) }}">Dokumentumok</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupView', {slug: group.slug}) }}">Leírás</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li> | ||||
| </ul> | ||||
| <h3>{{ group.name }} - Tagok</h3> | ||||
| <ul> | ||||
| @@ -1,3 +1,5 @@ | ||||
| {# vim: ft=htmljinja | ||||
| #} | ||||
| {% extends '::main_template.html.twig' %} | ||||
| {% block title %} - {{ group.name }}{% endblock %} | ||||
| {% block additional_css %} | ||||
| @@ -5,8 +7,8 @@ | ||||
| {% endblock additional_css %} | ||||
| {% block content %} | ||||
| <ul id="submenu"> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {groupSlug: group.slug }) }}">Tagok</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {groupSlug: group.slug }) }}">Dokumentumok</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {slug: group.slug}) }}">Tagok</a></li> | ||||
| 	<li><a href="{{ path('KekRozsakFrontBundle_groupDocuments', {slug: group.slug}) }}">Dokumentumok</a></li> | ||||
| </ul> | ||||
| <h3>{{ group.name }}</h3> | ||||
| {{ group.description|raw }} | ||||
		Reference in New Issue
	
	Block a user