Skip to content

Commit

Permalink
'smallmodify'
Browse files Browse the repository at this point in the history
  • Loading branch information
yidashi committed Feb 20, 2017
1 parent 9a03f22 commit d3f43ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 29 deletions.
6 changes: 3 additions & 3 deletions backend/views/article/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<?= $form->field($model, 'category_id')->dropDownList(Category::getDropDownList(Tree::build(Category::lists($model->module)))) ?>

<?= $form->boxField($model, 'description')->textarea()?>
<?= $form->field($model, 'description')->textarea()?>

<?php foreach ($moduleModel->formAttributes() as $attribute): ?>
<?= $form->field($moduleModel, $attribute)->widget(\common\widgets\dynamicInput\DynamicInputWidget::className(), ['type' => $moduleModel->getAttributeType($attribute), 'data' => $moduleModel->getAttributeItems($attribute), 'options' => $moduleModel->getAttributeOptions($attribute)]) ?>
Expand All @@ -48,7 +48,7 @@
'pluginOptions' => ['autoclose' => true]
]
) ?>
<?= $form->boxField($model, 'cover', ['collapsed' => true])->widget(\common\widgets\upload\SingleWidget::className()) ?>
<?= $form->field($model, 'cover')->widget(\common\widgets\upload\SingleWidget::className()) ?>

<?= $form->field($model, 'is_top')->checkbox() ?>

Expand All @@ -60,7 +60,7 @@

<?= $form->field($model, 'view')->textInput() ?>

<?= $form->boxField($model, TagBehavior::$formName)->widget(TagsInput::className())->header(TagBehavior::$formLable); ?>
<?= $form->field($model, TagBehavior::$formName)->label(TagBehavior::$formLable)->widget(TagsInput::className()) ?>

<?= $form->field($model, 'source')->textInput() ?>

Expand Down
2 changes: 1 addition & 1 deletion backend/views/category/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="box-body">
<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'pid')->dropDownList(Category::getDropDownList(Category::tree()), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'pid')->dropDownList(Category::getDropDownList(Category::lists()), ['prompt' => '请选择']) ?>

<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

Expand Down
25 changes: 0 additions & 25 deletions common/models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,6 @@ public static function lists($module = null)
return $list;
}

public static function tree($list = null)
{
if (is_null($list)) {
$list = self::find()->asArray()->all();
}

$tree = Tree::build($list);
return $tree;
}

public static function treeList($tree = null, &$result = [], $deep = 0, $separator = '--')
{
if (is_null($tree)) {
$tree = self::tree();
}
$deep++;
foreach($tree as $list) {
$list['title'] = str_repeat($separator, $deep-1) . $list['title'];
$result[] = $list;
if (isset($list['children'])) {
self::treeList($list['children'], $result, $deep, $separator);
}
}
return $result;
}
public static function getDropDownList($tree = [], &$result = [], $deep = 0, $separator = '--')
{
$deep++;
Expand Down

0 comments on commit d3f43ae

Please sign in to comment.