2017 © Pedro Peláez
 

symfony-bundle star-rating-bundle

Symfony form type and Twig extension for quick integration of FyneWorks' Star Rating widget

image

nurikabe/star-rating-bundle

Symfony form type and Twig extension for quick integration of FyneWorks' Star Rating widget

  • Friday, August 21, 2015
  • by nurikabe
  • Repository
  • 5 Watchers
  • 11 Stars
  • 2,700 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 1 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

NurikabeStarRatingBundle

SensioLabsInsight, (*1)

Form type and Twig filter for FyneWorks' super fine jQuery Star Rating Plugin., (*2)

Installation

Manually add a repository for the Star Rating Plugin

This is the easiest way to ensure that you have the Star Rating Plugin installed. Add a repository to composer.json:, (*3)

``` json "repositories": [ { "type": "package", "package": { "name": "fyneworks/star-rating", "version": "4.11.0", "source": { "type": "git", "url": "https://github.com/fyneworks/star-rating", "reference": "4.11.0" } } } ], (*4)


### Add the library and bundle to your dependencies ``` json "require": { "fyneworks/star-rating": "4.11.0", "nurikabe/star-rating-bundle": "~2.0.1", ... }

Register the bundle in your kernel

``` php public function registerBundles() { $bundles = array( // ... new Nurikabe\StarRatingBundle\NurikabeStarRatingBundle(), // ... );, (*5)


### Update your packages ``` bash $ php composer.phar update nurikabe/star-rating-bundle

If you define a repository for fyneworks/star-rating as per the above then installing nurikabe/star-rating-bundle should also install the fyneworks/star-rating dependency., (*6)

Usage

Load the Star Rating plugin in your layout. For example, if you are using Assetic and you have installed Star Rating via Composer as per above:, (*7)

``` twig {% stylesheets '@NurikabeStarRatingBundle/Resources/rating.css' %} {% endstylesheets %} {% javascripts '%kernel.root_dir%/../vendor/fyneworks/star-rating/jquery.rating.js' %} {% endjavascripts %}, (*8)


Of course, remember to dump your assets if `use_controller` is off: ``` bash $ app/console assetic:dump

This bundle contains a new FormType star_rating field type:, (*9)

``` php $builder->add('rating', 'star_rating', array( 'choices' => array(1 => 'ichi', 2 => 'ni', 3 => 'san', 4=> 'shi', 5 => 'go'), 'expanded' => true, // radio or checkbox... 'multiple' => false // ...but not checkbox ));, (*10)


`star_rating` extends `choice` and will render expanded `choice` fields as a Star Rating field. Original `choice` field: ![before](Resources/doc/before.png) As a `star_rating` field: ![after](Resources/doc/after.png) A Twig filter is also available that will render a static Star Rating widget given a numeric input: ``` twig {{ entity.rating|star_rating }}

The Versions

21/08 2015

dev-master

9999999-dev http://github.com/nurikabe/StarRatingBundle

Symfony form type and Twig extension for quick integration of FyneWorks' Star Rating widget

  Sources   Download

MIT

The Requires

 

by Evan Owens

twig form symfony star-rating fyneworks

10/04 2015

2.0.1

2.0.1.0 http://github.com/nurikabe/StarRatingBundle

Symfony form type and Twig extension for quick integration of FyneWorks' Star Rating widget

  Sources   Download

MIT

The Requires

 

by Evan Owens

twig form symfony star-rating fyneworks

31/12 2014

2.0.0

2.0.0.0 http://github.com/nurikabe/StarRatingBundle

Symfony form type and Twig extension for quick integration of FyneWorks' Star Rating widget

  Sources   Download

MIT

The Requires

 

by Evan Owens

twig form symfony star-rating fyneworks

12/06 2013

v1.0

1.0.0.0 http://github.com/cc-consulting/StarRatingBundle

Twig extension for quick integration of FyneWorks' Star Rating widget

  Sources   Download

MIT

The Requires

 

by Evan Owens

twig form symfony star-rating fyneworks