Permalink
Browse files

added tags feature

  • Loading branch information...
inmarelibero committed Dec 3, 2012
1 parent c698dc0 commit 17f58c3a9068a2e085fa5e926d24aca1d825da61
Showing with 1,748 additions and 101 deletions.
  1. +1 −0 app/config/assetic.yml
  2. +1 −1 src/Bricks/SiteBundle/Controller/BrickController.php
  3. +2 −2 src/Bricks/SiteBundle/DependencyInjection/BricksSiteExtension.php
  4. +71 −32 src/Bricks/SiteBundle/Entity/Brick.php
  5. +102 −0 src/Bricks/SiteBundle/Entity/BrickHasTag.php
  6. +15 −0 src/Bricks/SiteBundle/Entity/BrickHasTagRepository.php
  7. +150 −0 src/Bricks/SiteBundle/Entity/Tag.php
  8. +15 −0 src/Bricks/SiteBundle/Entity/TagRepository.php
  9. +53 −0 src/Bricks/SiteBundle/Extension/BrickExtension.php
  10. +0 −20 src/Bricks/SiteBundle/Resources/config/services.xml
  11. +8 −0 src/Bricks/SiteBundle/Resources/config/services.yml
  12. +3 −2 src/Bricks/SiteBundle/Resources/views/Brick/show.html.twig
  13. +2 −0 src/Bricks/SiteBundle/Resources/views/Default/index.html.twig
  14. +1 −1 src/Bricks/SiteBundle/Resources/views/layout.html.twig
  15. +1 −1 src/Bricks/SiteBundle/Resources/views/macros/macrosInfo.html.twig
  16. +29 −26 src/Bricks/UserBundle/Controller/BrickController.php
  17. +116 −0 src/Bricks/UserBundle/Form/DataTransformer/TagsToIdsTransformer.php
  18. +106 −0 src/Bricks/UserBundle/Form/Handler/BrickFormHandler.php
  19. +29 −0 src/Bricks/UserBundle/Form/Type/BrickHasTagType.php
  20. +20 −1 src/Bricks/UserBundle/Form/{ → Type}/BrickType.php
  21. +8 −11 src/Bricks/UserBundle/Resources/config/services.xml
  22. +44 −1 src/Bricks/UserBundle/Resources/less/controller-brick.less
  23. +21 −1 src/Bricks/UserBundle/Resources/translations/UserBundle.en.yml
  24. +19 −1 src/Bricks/UserBundle/Resources/translations/UserBundle.es.yml
  25. +18 −0 src/Bricks/UserBundle/Resources/translations/UserBundle.it.yml
  26. +94 −1 src/Bricks/UserBundle/Resources/views/Brick/edit.html.twig
  27. +19 −0 web/assets/bootstrap-tags/LICENSE
  28. +75 −0 web/assets/bootstrap-tags/README.md
  29. +16 −0 web/assets/bootstrap-tags/cakefile
  30. +62 −0 web/assets/bootstrap-tags/css/bootstrap-tags.css
  31. +315 −0 web/assets/bootstrap-tags/lib/bootstrap-tags.js
  32. +262 −0 web/assets/bootstrap-tags/src/bootstrap-tags.coffee
  33. +70 −0 web/assets/bootstrap-tags/tag-demo.html
View
@@ -34,6 +34,7 @@ assetic:
- %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-alert.js
- %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-modal.js
- %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-tooltip.js
+ - %kernel.root_dir%/../web/assets/bootstrap-tags/lib/bootstrap-tags.js
- bundles/fosjsrouting/js/router.js
- @BricksSiteBundle/Resources/js/*.js
- @BricksSiteBundle/Resources/js/*/*.js
@@ -12,7 +12,7 @@
use JMS\SecurityExtraBundle\Annotation\Secure;
use Bricks\SiteBundle\Entity\Brick;
-use Bricks\UserBundle\Form\BrickType;
+use Bricks\UserBundle\Form\Type\BrickType;
use Bricks\SiteBundle\Entity\UserStarsBrick;
/**
@@ -22,7 +22,7 @@ public function load(array $configs, ContainerBuilder $container)
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
- $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
- $loader->load('services.xml');
+ $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.yml');
}
}
@@ -94,6 +94,11 @@ class Brick
*/
private $created_at;
+ /**
+ * @ORM\OneToMany(targetEntity="Bricks\SiteBundle\Entity\BrickHasTag", mappedBy="brick", cascade={"persist"})
+ */
+ public $brickHasTags;
+
/**
* @ORM\OneToMany(targetEntity="Bricks\SiteBundle\Entity\UserStarsBrick", mappedBy="user", cascade={"persist"})
*/
@@ -113,7 +118,15 @@ public function isNew()
/**************************************************************************************************
* getters and setters
**************************************************************************************************/
-
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->brickHasTags = new \Doctrine\Common\Collections\ArrayCollection();
+ $this->userStarsBricks = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
/**
* Get id
*
@@ -239,6 +252,29 @@ public function getPublished()
return $this->published;
}
+ /**
+ * Set canonicalUrl
+ *
+ * @param string $canonicalUrl
+ * @return Brick
+ */
+ public function setCanonicalUrl($canonicalUrl)
+ {
+ $this->canonicalUrl = $canonicalUrl;
+
+ return $this;
+ }
+
+ /**
+ * Get canonicalUrl
+ *
+ * @return string
+ */
+ public function getCanonicalUrl()
+ {
+ return $this->canonicalUrl;
+ }
+
/**
* Set updated_at
*
@@ -288,7 +324,7 @@ public function getCreatedAt()
/**
* Set user
*
- * @param Bricks\UserBundle\Entity\User $user
+ * @param \Bricks\UserBundle\Entity\User $user
* @return Brick
*/
public function setUser(\Bricks\UserBundle\Entity\User $user = null)
@@ -301,73 +337,76 @@ public function setUser(\Bricks\UserBundle\Entity\User $user = null)
/**
* Get user
*
- * @return Bricks\UserBundle\Entity\User
+ * @return \Bricks\UserBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
+
/**
- * Constructor
- */
- public function __construct()
- {
- $this->userStarsBricks = new \Doctrine\Common\Collections\ArrayCollection();
- }
-
- /**
- * Add userStarsBricks
+ * Add brickHasTags
*
- * @param Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks
+ * @param \Bricks\SiteBundle\Entity\BrickHasTag $brickHasTags
* @return Brick
*/
- public function addUserStarsBrick(\Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks)
+ public function addBrickHasTag(\Bricks\SiteBundle\Entity\BrickHasTag $brickHasTags)
{
- $this->userStarsBricks[] = $userStarsBricks;
+ $this->brickHasTags[] = $brickHasTags;
return $this;
}
/**
- * Remove userStarsBricks
+ * Remove brickHasTags
*
- * @param Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks
+ * @param \Bricks\SiteBundle\Entity\BrickHasTag $brickHasTags
*/
- public function removeUserStarsBrick(\Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks)
+ public function removeBrickHasTag(\Bricks\SiteBundle\Entity\BrickHasTag $brickHasTags)
{
- $this->userStarsBricks->removeElement($userStarsBricks);
+ $this->brickHasTags->removeElement($brickHasTags);
}
/**
- * Get userStarsBricks
+ * Get brickHasTags
*
- * @return Doctrine\Common\Collections\Collection
+ * @return \Doctrine\Common\Collections\Collection
*/
- public function getUserStarsBricks()
+ public function getBrickHasTags()
{
- return $this->userStarsBricks;
+ return $this->brickHasTags;
}
/**
- * Set canonicalUrl
+ * Add userStarsBricks
*
- * @param string $canonicalUrl
+ * @param \Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks
* @return Brick
*/
- public function setCanonicalUrl($canonicalUrl)
+ public function addUserStarsBrick(\Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks)
{
- $this->canonicalUrl = $canonicalUrl;
+ $this->userStarsBricks[] = $userStarsBricks;
return $this;
}
/**
- * Get canonicalUrl
+ * Remove userStarsBricks
*
- * @return string
+ * @param \Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks
*/
- public function getCanonicalUrl()
+ public function removeUserStarsBrick(\Bricks\SiteBundle\Entity\UserStarsBrick $userStarsBricks)
{
- return $this->canonicalUrl;
+ $this->userStarsBricks->removeElement($userStarsBricks);
+ }
+
+ /**
+ * Get userStarsBricks
+ *
+ * @return \Doctrine\Common\Collections\Collection
+ */
+ public function getUserStarsBricks()
+ {
+ return $this->userStarsBricks;
}
-}
+}
@@ -0,0 +1,102 @@
+<?php
+namespace Bricks\SiteBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+use Gedmo\Mapping\Annotation as Gedmo;
+
+/**
+ * Bricks\SiteBundle\Entity\BrickHasTag
+ *
+ * @ORM\Entity
+ * @ORM\Table(name="brick_has_tag")
+ * @ORM\Entity(repositoryClass="Bricks\SiteBundle\Entity\BrickHasTagRepository")
+ */
+class BrickHasTag
+{
+ /**
+ * @ORM\Id
+ * @ORM\Column(type="integer")
+ * @ORM\GeneratedValue(strategy="AUTO")
+ */
+ protected $id;
+
+ /**
+ * @var object $brick
+ *
+ * @ORM\ManyToOne(targetEntity="Bricks\SiteBundle\Entity\Brick", cascade={"persist"})
+ * @ORM\JoinColumn(name="brick_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
+ */
+ private $brick;
+
+ /**
+ * @var object $tag
+ *
+ * @ORM\ManyToOne(targetEntity="Bricks\SiteBundle\Entity\Tag", cascade={"persist"})
+ * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
+ */
+ private $tag;
+
+ /**************************************************************************************************
+ * custom functions
+ **************************************************************************************************/
+
+ /**************************************************************************************************
+ * getters and setters
+ **************************************************************************************************/
+
+ /**
+ * Get id
+ *
+ * @return integer
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Set brick
+ *
+ * @param \Bricks\SiteBundle\Entity\Brick $brick
+ * @return BrickHasTag
+ */
+ public function setBrick(\Bricks\SiteBundle\Entity\Brick $brick = null)
+ {
+ $this->brick = $brick;
+
+ return $this;
+ }
+
+ /**
+ * Get brick
+ *
+ * @return \Bricks\SiteBundle\Entity\Brick
+ */
+ public function getBrick()
+ {
+ return $this->brick;
+ }
+
+ /**
+ * Set tag
+ *
+ * @param \Bricks\SiteBundle\Entity\Tag $tag
+ * @return BrickHasTag
+ */
+ public function setTag(\Bricks\SiteBundle\Entity\Tag $tag = null)
+ {
+ $this->tag = $tag;
+
+ return $this;
+ }
+
+ /**
+ * Get tag
+ *
+ * @return \Bricks\SiteBundle\Entity\Tag
+ */
+ public function getTag()
+ {
+ return $this->tag;
+ }
+}
@@ -0,0 +1,15 @@
+<?php
+
+namespace Bricks\SiteBundle\Entity;
+
+use Doctrine\ORM\EntityRepository;
+
+/**
+ * BrickHasTagRepository
+ *
+ * This class was generated by the Doctrine ORM. Add your own custom
+ * repository methods below.
+ */
+class BrickHasTagRepository extends EntityRepository
+{
+}
Oops, something went wrong.

0 comments on commit 17f58c3

Please sign in to comment.