Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alfa6661/yii2-raty
Yii2-raty is a Star Rating Plugin wrapper for jQuery Raty plugin
https://github.com/alfa6661/yii2-raty
jquery-raty jquery-raty-plugin wrapper yii2 yii2-extension yii2-raty
Last synced: about 2 months ago
JSON representation
Yii2-raty is a Star Rating Plugin wrapper for jQuery Raty plugin
- Host: GitHub
- URL: https://github.com/alfa6661/yii2-raty
- Owner: alfa6661
- Created: 2015-06-09T08:44:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-29T08:51:44.000Z (about 7 years ago)
- Last Synced: 2024-10-31T06:51:37.290Z (about 2 months ago)
- Topics: jquery-raty, jquery-raty-plugin, wrapper, yii2, yii2-extension, yii2-raty
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
yii2-raty
=========[![StyleCI](https://styleci.io/repos/37120762/shield?style=flat)](https://styleci.io/repos/37120762)
[![Total Downloads](https://poser.pugx.org/alfa6661/yii2-raty/downloads)](https://packagist.org/packages/alfa6661/yii2-raty)
[![Latest Stable Version](https://poser.pugx.org/alfa6661/yii2-raty/v/stable)](https://packagist.org/packages/alfa6661/yii2-raty)
[![Latest Unstable Version](https://poser.pugx.org/alfa6661/yii2-raty/v/unstable)](https://packagist.org/packages/alfa6661/yii2-raty)
[![License](https://poser.pugx.org/alfa6661/yii2-raty/license)](https://packagist.org/packages/alfa6661/yii2-raty)Yii2-raty is a wrapper for [jQuery Raty plugin](http://wbotelhos.com/raty). jQuery Raty is a plugin that generates a customizable star rating automatically.
Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist alfa6661/yii2-raty "*"
```or add
```
"alfa6661/yii2-raty": "*"
```to the require section of your `composer.json` file.
Usage
-----Once the extension is installed, simply use it in your code by :
```php
// Usage
= \alfa6661\widgets\Raty::widget([
'name' => 'user-vote',
'options' => [
// the HTML attributes for the widget container
],
'pluginOptions' => [
// the options for the underlying jQuery Raty plugin
// see : https://github.com/wbotelhos/raty#options
]
]); ?>// Usage with model
= \alfa6661\widgets\Raty::widget([
'model' => $model,
'attribute' => 'rating',
'options' => [
// the HTML attributes for the widget container
],
'pluginOptions' => [
// the options for the underlying jQuery Raty plugin
// see : https://github.com/wbotelhos/raty#options
]
]); ?>// Usage with ActiveForm and model
= $form->field($model, 'point')->widget(\alfa6661\widgets\Raty::className(), [
'options' => [
// the HTML attributes for the widget container
],
'pluginOptions' => [
// the options for the underlying jQuery Raty plugin
// see : https://github.com/wbotelhos/raty#options
]
]); ?>// Javascript events handling
// Available event callbacks: Read Only, Click, Mouseover and Mouseout
= \alfa6661\widgets\Raty::widget([
'name' => 'user-vote',
'options' => [
'class' => 'pull-left',
'id' => 'user-vote'
],
'pluginOptions' => [
'click' => new \yii\web\JsExpression('function(score, e) {
alert(score);
}')
]
]); ?>
```