Пример #1
0
 /**
  * Initialize with default events.
  * 
  * @param string $selector
  */
 public function initJsEvents($selector)
 {
     parent::initJsEvents($selector);
     $this->jsChangeCounters = "\n            if (data.success) {\n                \$('{$selector} .vote-count').text(data.aggregate.positive);\n                var label = '';\n                if (data.toggleValue) {\n                    label = button.attr('data-label-remove');\n                    button.addClass('vote-active');\n                } else {\n                    label = button.attr('data-label-add');\n                    button.removeClass('vote-active');\n                }\n                button.find('.vote-label').text(label);\n            }\n        ";
 }
Пример #2
0
 /**
  * @return array
  */
 public function getDefaultButtonOptions()
 {
     return array_merge(parent::getDefaultButtonOptions(), ['icon' => Html::icon('glyphicon glyphicon-heart'), 'label' => Yii::t('vote', 'Like')]);
 }