godzie44/yii2-thumbs-up Thumbs up rating module for Yii 2

widgetmodulethumbs-up

yii2-thumbs-up

Thumbs up rating yii2 module (used ajax).

Installation

composer require godzie44/yii2-thumbs-up

Configuration

In config /protected/config/main.php

<?php
return [
    // ...
    'modules' => [
      /* other modules */

        'thumbsup' => [
            'class' => 'godzie44\yii\module\thumbsup\Module',
                  'useRbac' => true, 
                  ]
    ],
    // ...
];

In auth manager add rules (if Module::$useRbac = true):

<?php
use godzie44\yii\module\thumbsup;

$thumbsUpChange = new \yii\rbac\Permission([
            'name' => thumbsup\Permission::CHANGE,
            'description' => 'Can change thumb state',
        ]);
$authManager->add($thumbsUpChange);

Updating database schema

After you downloaded and configured, updating your database schema by applying the migrations:

In command line:

php yii migrate/up --migrationPath=@vendor/godzie44/yii2-thumbs-up/migrations/

Usage

In controller


public function actions()
    {
        return [
            'thumb-rate' => [
                'class' => 'godzie44\yii\module\thumbsup\ThumbRateAction'
            ],

            /* other actions */
        ];
    }

In view

<?php
// ...

use godzie44\yii\module\thumbsup;

echo thumbsup\widgets\ThumbsUpWidget::widget(['entity' => "entity-44"]);

Parameters

 Module parameters

  • useRbac (optional, boolean) Default TRUE. Defines if the rating system will use Rbac validation to check permissions when trying to rate some entity.

Widget parameters

  • entity (required, string) The identify of rating.
  • tooltip (optional, array) Define this array to use custom tooltip labels.

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.1.0 is the latest of 3 releases



MIT license
Stats
2 github stars & 3 github forks
0 downloads in the last day
0 downloads in the last 30 days
66 total downloads