alfa6661/yii2-raty 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alfa6661/yii2-raty

最新稳定版本:1.0

Composer 安装命令:

composer require alfa6661/yii2-raty

包简介

Yii2 wrapper for jQuery Raty plugin

README 文档

README

StyleCI Total Downloads Latest Stable Version Latest Unstable Version License

Yii2-raty is a wrapper for jQuery Raty plugin. jQuery Raty is a plugin that generates a customizable star rating automatically.

Installation

The preferred way to install this extension is through composer.

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 :

// 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);
		}')
	]
]); ?>

统计信息

  • 总下载量: 2.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 3
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2015-06-09