public function init() { Html::addCssClass($this->options, 'dimmable'); if (!$this->loader) { $this->loader = Elements::dimmer(Elements::loader(), ['class' => 'active inverted']); } parent::init(); }
public function renderTitle($item) { $encode = ArrayHelper::getValue($this->titleOptions, 'encode', true); $title = Elements::icon('dropdown') . ($encode ? Html::encode($item['title']) : $item['title']); $options = $this->titleOptions; Html::addCssClass($options, 'title'); if ($item['active']) { Html::addCssClass($options, 'active'); } return Html::tag('div', $title, $options); }
public function renderToggleButton($content, $options = []) { if (!isset($options['id'])) { $options['id'] = $this->getId() . '-button'; } $this->getView()->registerJs(' jQuery("#' . $options['id'] . '").on("click", function(event) { event.preventDefault(); jQuery("#' . $this->getId() . '").modal("show"); }); '); return Elements::button($content, $options); }
protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model, $key) { return Html::a(Elements::icon('eye'), $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => '0']); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model, $key) { return Html::a(Elements::icon('pencil'), $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model, $key) { return Html::a(Elements::icon('trash'), $url, ['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']); }; } }
* @var \yii\data\ActiveDataProvider $dp */ $this->title = Yii::t('app', 'User Log'); ?> <div class="ui orange segment"> <?php echo GridView::widget(['filterModel' => $model, 'dataProvider' => $dp, 'columns' => [['attribute' => 'connection', 'filter' => Yii::$app->getModule('redisman')->connectionList()], ['attribute' => 'db'], ['attribute' => 'time', 'value' => function ($model) { return date('d.m.Y H:i', $model->time); }, 'filter' => false], ['attribute' => 'user.ip'], ['attribute' => 'command', 'filter' => false], ['class' => '\\yii\\grid\\ActionColumn', 'template' => '{user}', 'buttons' => ['user' => function ($url, $model) { return Html::a('<i class="icon circular large user green"></i>', \yii\helpers\Url::to(['/log/user', 'id' => $model->user_id]), ['data-pjax' => 0, 'class' => 'modalink', 'title' => Yii::t('app', 'User Info')]); }]]]]); ?> </div> <?php $modal = \Zelenin\yii\SemanticUI\modules\Modal::begin(['id' => 'quickmodal', 'size' => \Zelenin\yii\SemanticUI\modules\Modal::SIZE_LARGE, 'header' => Yii::t('app', 'User Information'), 'actions' => \Zelenin\yii\SemanticUI\Elements::button(Yii::t('app', 'Close'), ['class' => 'black'])]); ?> <div class="content"></div> <?php $modal::end(); $this->registerJs(' $(document).on("click",".modalink",function(e){ e.preventDefault(); var url=$(this).attr("href"); $.get(url,function(data){ $("#quickmodal .content").html(data); $("#quickmodal").modal({onHide:function(){ $("#quickmodal .content").html("");}}).modal("show"); }); }); ');
echo $form->errorSummary($model); ?> <div class="one"> <?php echo $form->field($model, 'connection')->dropDownList($module->connectionList(), ['id' => 'currentcon']); ?> </div> <div class="one"> <?php echo $form->field($model, 'db')->dropDownList($module->dbList(), ['id' => 'currentdb']); ?> </div><br/> <div class="one right ui aligned"> <?php echo Elements::button('<i class="plug icon"></i>' . \insolita\redisman\Redisman::t('redisman', 'Connect'), ['class' => 'green circular right aligned', 'type' => 'submit', 'tag' => 'button']); ?> </div> <?php ActiveForm::end(); $js = new \yii\web\JsExpression('var url="' . \yii\helpers\Url::to(['/redisman/default/dbload']) . '"; var cur=$("#connectionform-connection").val(); $("#currentcon").dropdown ({ onChange: function(value, text, $selectedItem) { console.log(value + "|"+ cur); if(value && value!=cur) { cur=value;
<div class="ui orange segment"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => '\\Zelenin\\yii\\SemanticUI\\widgets\\CheckboxColumn'], 'key', 'type', 'size', 'ttl', ['class' => '\\yii\\grid\\ActionColumn', 'template' => '{quick} {view} {delete}', 'buttons' => ['quick' => function ($url, $model) { return Html::a('<i class="icon circular large eye green"></i>', \yii\helpers\Url::to(['/redisman/item/quick', 'key' => urlencode($model['key'])]), ['data-pjax' => 0, 'class' => 'modalink', 'title' => Yii::t('app', 'Quick View')]); }, 'view' => function ($url, $model) { return Html::a('<i class="icon circular inverted eye green"></i>', \yii\helpers\Url::to(['/redisman/item/view', 'key' => urlencode($model['key'])]), ['data-pjax' => 0, 'title' => Yii::t('app', 'View')]); }, 'delete' => function ($url, $model) { return Html::a('<i class="icon circular small trash red"></i>', \yii\helpers\Url::to(['/redisman/item/delete']), ['data-pjax' => 0, 'data-params' => ['RedisItem[key]' => urlencode($model['key'])], 'data-confirm' => 'Подтвердите действие', 'data-method' => 'post', 'title' => Yii::t('app', 'Delete')]); }]]]]); ?> </div> <?php $modal = \Zelenin\yii\SemanticUI\modules\Modal::begin(['id' => 'quickmodal', 'size' => \Zelenin\yii\SemanticUI\modules\Modal::SIZE_LARGE, 'header' => \insolita\redisman\Redisman::t('redisman', 'Key Information'), 'actions' => \Zelenin\yii\SemanticUI\Elements::button(\insolita\redisman\Redisman::t('redisman', 'Close'), ['class' => 'black'])]); ?> <div class="content"></div> <?php $modal::end(); $this->registerJs(' $(document).on("click",".modalink",function(e){ e.preventDefault(); var url=$(this).attr("href"); $.get(url,function(data){ $("#quickmodal .content").html(data); $("#quickmodal").modal({onHide:function(){ $("#quickmodal .content").html("");}}).modal("show"); }); }); ');
/** * @return string */ public function renderInput() { return $this->input ?: Elements::input(Html::input('text', null, null, ['class' => 'prompt'])); }
/** * @param $items * * @return string */ public function renderMenuPart($items) { $items = $this->normalizeItems($items, $hasActiveChild); $lines = ''; foreach ($items as $i => $item) { Html::addCssClass($item['options'], 'item'); if ($item['active']) { Html::addCssClass($item['options'], 'active'); } if (isset($item['items'])) { Html::addCssClass($item['options'], 'ui simple dropdown'); $item['label'] = $item['label'] . Elements::icon('dropdown') . Html::tag('div', $this->renderMenuPart($item['items']), ['class' => 'menu']); $menu = $this->renderItem($item); } else { $menu = $this->renderItem($item); } $lines .= $menu; } return $lines; }
echo $form->errorSummary($model); ?> <div class="one"> <?php echo $form->field($model, 'pattern')->textInput()->hint(Redisman::t('redisman', 'support redis patterns (*,?,[var])')); ?> </div> <div class="one"> <?php echo $form->field($model, 'type')->checkboxList([Redisman::REDIS_STRING => Redisman::t('redisman', 'string'), Redisman::REDIS_HASH => Redisman::t('redisman', 'hash'), Redisman::REDIS_LIST => Redisman::t('redisman', 'list'), Redisman::REDIS_SET => Redisman::t('redisman', 'set'), Redisman::REDIS_ZSET => Redisman::t('redisman', 'zset')]); ?> </div> <div class="one"> <?php echo $form->field($model, 'perpage')->dropDownList([20 => 20, 30 => 30, 50 => 50, 100 => 100, 200 => 200, 500 => 500]); ?> </div> <div class="one"> <?php echo $form->field($model, 'encache')->checkbox([]); ?> </div><br/> <div class="one right aligned"> <?php echo Elements::button('<i class="find icon"></i>' . Yii::t('app', 'Search'), ['class' => 'teal circular right ui aligned', 'type' => 'submit', 'tag' => 'button']); echo \yii\helpers\Html::a('<i class="remove icon"></i>' . Yii::t('app', 'Clear'), ['/redisman/default/reset-search'], ['class' => 'ui button blue circular left aligned']); ?> </div> <?php ActiveForm::end();
use yii\web\View; use Zelenin\yii\modules\I18n\models\SourceMessage; use Zelenin\yii\modules\I18n\Module; use Zelenin\yii\SemanticUI\collections\Breadcrumb; use Zelenin\yii\SemanticUI\Elements; use Zelenin\yii\SemanticUI\widgets\ActiveForm; $this->title = Module::t('Update') . ': ' . $model->message; echo Breadcrumb::widget(['links' => [['label' => Module::t('Translations'), 'url' => ['index']], ['label' => $this->title]]]); ?> <div class="message-update"> <div class="message-form"> <?php echo Elements::header(Module::t('Source message'), ['class' => 'top attached']); ?> <?php echo Elements::segment(Html::encode($model->message), ['class' => 'bottom attached']); ?> <?php $form = ActiveForm::begin(); ?> <div class="field"> <div class="ui grid"> <?php foreach ($model->messages as $language => $message) { ?> <div class="four wide column"> <?php echo $form->field($model->messages[$language], '[' . $language . ']translation')->label($language); ?> </div> <?php
/** * @param array $options * * @return string */ public function renderCloseButton($options = []) { if (!isset($options['id'])) { $options['id'] = $this->getId() . '-close-button'; } $this->getView()->registerJs(' jQuery("#' . $options['id'] . '").on("click", function(event) { jQuery("#' . $this->getId() . '").fadeOut(); }); '); return Elements::icon('close', $options); }
echo $form->field($model, 'username', ['options' => ['class' => $model->hasErrors('username') ? 'field error' : 'field']])->textInput(); ?> </div> <div class="one"> <?php echo $form->field($model, 'password', ['options' => ['class' => $model->hasErrors('username') ? 'field error' : 'field']])->passwordInput(); ?> </div> <div class="inline field"> <?php echo $form->field($model, 'rememberMe')->checkbox(); ?> </div> <?php echo Elements::button('<i class="sign in icon"></i>' . Yii::t('app', 'Login'), ['class' => 'green', 'type' => 'submit', 'tag' => 'button']); ActiveForm::end(); ?> <div class="ui bottom attached info icon message"> <i class="info icon"></i> <div class="content"> <div class="header"> <?php echo Yii::t('app', 'Don`t know password?'); ?> </div> <?php echo Yii::t('app', 'To modify the username/password, please check out the code'); ?> <code> app\models\User::$users</code><?php
protected function renderFilterCellContent() { if (is_string($this->filter)) { return $this->filter; } $model = $this->grid->filterModel; if ($this->filter !== false && $model instanceof Model && $this->attribute !== null && $model->isAttributeActive($this->attribute)) { if ($model->hasErrors($this->attribute)) { $error = Html::error($model, $this->attribute, $this->grid->filterErrorOptions); } else { $error = ''; } if (is_array($this->filter)) { $options = array_merge(['prompt' => ''], $this->filterDropdownOptions); if ($model->hasErrors($this->attribute)) { Html::addCssClass($options, 'error'); } return Select::widget(['model' => $model, 'attribute' => $this->attribute, 'items' => $this->filter, 'options' => $options, 'search' => true]) . ' ' . $error; } else { $options = ['class' => 'fluid']; if ($model->hasErrors($this->attribute)) { Html::addCssClass($options, 'error'); } return Elements::input(Html::activeTextInput($model, $this->attribute, $this->filterInputOptions) . $error, $options); } } else { return parent::renderFilterCellContent(); } }