Permalink
Browse files

installed KnpMarkdownBundle

created page to show a brick
  • Loading branch information...
inmarelibero committed Oct 25, 2012
1 parent 2af1c78 commit 14094d82c0fa3e14f41b5e37a008892e81ba6ee2
View
@@ -26,6 +26,9 @@ public function registerBundles()
// StofDoctrineExtensionsBundle
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
+ // KnpMarkdownBundle
+ new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
+
// Bricks bundles
new Bricks\SiteBundle\BricksSiteBundle(),
new Bricks\UserBundle\BricksUserBundle(),
View
@@ -21,8 +21,8 @@
"friendsofsymfony/user-bundle": "*",
"leafo/lessphp": "dev-master",
-
- "stof/doctrine-extensions-bundle": "dev-master"
+ "stof/doctrine-extensions-bundle": "dev-master",
+ "knplabs/knp-markdown-bundle": "1.2.*@dev"
},
"scripts": {
"post-install-cmd": [
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,76 @@
+<?php
+
+namespace Bricks\SiteBundle\Controller;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\Security\Core\Exception\AccessDeniedException;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
+use Bricks\SiteBundle\Entity\Brick;
+use Bricks\UserBundle\Form\BrickType;
+
+/**
+ * Brick controller.
+ *
+ * @Route("/brick")
+ */
+class BrickController extends Controller
+{
+ /**
+ * Lists all Brick entities.
+ *
+ * @Route("/", name="brick")
+ * @Template()
+ */
+ public function indexAction()
+ {
+ $em = $this->getDoctrine()->getManager();
+
+ $entities = $em->getRepository('BricksSiteBundle:Brick')->findBy(array('published' => true));
+
+ return array(
+ 'entities' => $entities,
+ );
+ }
+
+ /**
+ * Display a page to inform that a brick is not published
+ *
+ * @Route("/not-published", name="brick_not_published")
+ * @Template()
+ */
+ public function notPublishedAction()
+ {
+ return array();
+ }
+
+ /**
+ * Show a brick
+ *
+ * @Route("/{id}/{slug}", name="brick_show")
+ * @Template()
+ */
+ public function showAction($id)
+ {
+ $em = $this->getDoctrine()->getManager();
+
+ $entity = $em->getRepository('BricksSiteBundle:Brick')->find($id);
+
+ if (!$entity) {
+ throw $this->createNotFoundException('Unable to find Brick entity.');
+ }
+
+ /**
+ * if the brick is not published, return a temporary redirection
+ */
+ if (!$entity->getPublished()) {
+ return $this->redirect($this->generateUrl('brick_not_published'), 307);
+ }
+
+ return array(
+ 'brick' => $entity
+ );
+ }
+}
@@ -85,6 +85,10 @@ table {
&, * { vertical-align: top }
}
+hr {
+ border-top: 1px solid #CCC;
+}
+
/******************************************************************************************
GENERAL CLASSES
@@ -0,0 +1,24 @@
+/******************************************************************************************
+SECTION: BRICK
+
+all the pages related with bricks: show, etc..
+******************************************************************************************/
+/* show a brick */
+#brick-show-wrapper {
+ .description {
+ margin-bottom: 40px;
+ font-size: 14px;
+ }
+
+ .content {
+ h1 {
+ font-size: 20px;
+ }
+
+ ul { margin: 0 0 10px 25px;
+ li {
+ list-style-type: disc;
+ }
+ }
+ }
+}
@@ -2,11 +2,6 @@
SECTION: INDEX
******************************************************************************************/
#index-wrapper {
-
- hr {
- border-top: 1px solid #CCC;
- }
-
.right-col {
ul { margin-bottom: 10px;
li {
@@ -0,0 +1,23 @@
+{% extends 'BricksSiteBundle::layout.html.twig' %}
+
+{% block main %}
+
+ <div id="brick-not-published-wrapper">
+
+ <div class="row">
+ <div class="span12">
+
+ <h1>Content not available</h1>
+
+ <br><br>
+
+ <p>
+ The content you are trying to access exists, but it is currently not published.
+ </p>
+
+ </div>
+ </div>
+
+ </div>
+
+{% endblock %}
Oops, something went wrong.

0 comments on commit 14094d8

Please sign in to comment.