Пример #1
0
 public function renderTitle($item)
 {
     $options = ArrayHelper::merge($this->titleOptions, ArrayHelper::getValue($item, 'titleOptions', []));
     $encode = ArrayHelper::getValue($options, 'encode', true);
     $title = UI::i('dropdown') . ($encode ? Html::encode($item['title']) : $item['title']);
     UI::addCssClasses($options, ['title']);
     if ($item['active']) {
         UI::addCssClasses($options, ['active']);
     }
     return Html::tag('div', $title, $options);
 }
Пример #2
0
 protected function initDefaultButtons()
 {
     if (!isset($this->button['view'])) {
         $this->buttons['view'] = function ($url, $model, $key) {
             return Html::a(UI::i('eye'), $url, ['class' => 'ui button', 'title' => Yii::t('yii', 'View'), 'data-pjax' => '0']);
         };
     }
     if (!isset($this->button['update'])) {
         $this->buttons['update'] = function ($url, $model, $key) {
             return Html::a(UI::i('pencil'), $url, ['class' => 'ui button', 'title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']);
         };
     }
     if (!isset($this->button['delete'])) {
         $this->buttons['delete'] = function ($url, $model, $key) {
             return Html::a(UI::i('trash'), $url, ['class' => 'ui button', 'title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']);
         };
     }
 }
Пример #3
0
 public function renderMenuPart($items)
 {
     $items = $this->normalizeItems($items, $hasActiveChild);
     $lines = [];
     // $lines = '';
     foreach ($items as $key => $item) {
         UI::addCssClasses($item['options'], ['item']);
         if ($item['active']) {
             UI::addCssClasses($item['options'], ['active']);
         }
         if (isset($item['items'])) {
             UI::addCssClasses($item['options'], ['ui', 'simple', 'dropdown']);
             $item['label'] = $item['label'] . UI::i('dropdown') . Html::tag('div', $this->renderMenuPart($item['items']), ['class' => 'menu']);
             $menu = $this->renderItem($item);
         } else {
             $menu = $this->renderItem($item);
         }
         $lines[] = $menu;
         // $lines .= $menu;
     }
     return implode("\n", $lines);
     // return $lines;
 }
Пример #4
0
 public function renderCloseButton()
 {
     $view = $this->getView();
     UIAsset::register($view);
     $options['id'] = $this->getId() . '-close-button';
     $js = "ui.semantic.initMessageCloseButtons('#" . $options['id'] . "','{$this->closeTransition}');";
     $view->registerJs($js);
     return UI::i('close', $options);
 }