diff --git a/common/models/Category.php b/common/models/Category.php
index 7b5feff..cf98e09 100644
--- a/common/models/Category.php
+++ b/common/models/Category.php
@@ -19,6 +19,14 @@ use yii\behaviors\TimestampBehavior;
*/
class Category extends \yii\db\ActiveRecord {
+ const ICON_TYPE_BOOSTARAP = 1;
+ const ICON_TYPE_AWESOME = 2;
+
+ public static $iconType = [
+ self::ICON_TYPE_BOOSTARAP => "boostrap",
+ self::ICON_TYPE_AWESOME => "awesome"
+ ];
+
/**
* {@inheritdoc}
*/
@@ -26,20 +34,18 @@ class Category extends \yii\db\ActiveRecord {
return 'category';
}
-
-
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => 'ID',
- 'cat_name' => 'Cat Name',
+ 'cat_name' => '类名',
'icon' => 'Icon',
- 'icon_type' => 'Icon Type',
- 'description' => 'Description',
+ 'icon_type' => '图标类型',
+ 'description' => '描述',
'sort_order' => 'Sort Order',
- 'created_at' => 'Created At',
+ 'created_at' => '添加日期',
'updated_at' => 'Updated At',
];
}
diff --git a/common/models/CategorySearch.php b/common/models/CategorySearch.php
index c22a1d6..1cc05e6 100644
--- a/common/models/CategorySearch.php
+++ b/common/models/CategorySearch.php
@@ -16,7 +16,7 @@ class CategorySearch extends Category {
*/
public function rules() {
return [
- [['id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'],
+ [['cat_name','id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'],
[['cat_name', 'icon', 'description'], 'safe'],
];
}
diff --git a/kcadmin/assets/AppAsset.php b/kcadmin/assets/AppAsset.php
index 43351e5..64d62bb 100644
--- a/kcadmin/assets/AppAsset.php
+++ b/kcadmin/assets/AppAsset.php
@@ -15,6 +15,7 @@ class AppAsset extends AssetBundle
'css/site.css',
];
public $js = [
+ 'js/common.js'
];
public $depends = [
'yii\web\YiiAsset',
diff --git a/kcadmin/views/category/_search.php b/kcadmin/views/category/_search.php
index 77ac48e..0343634 100644
--- a/kcadmin/views/category/_search.php
+++ b/kcadmin/views/category/_search.php
@@ -8,34 +8,47 @@ use yii\widgets\ActiveForm;
/* @var $form yii\widgets\ActiveForm */
?>
-
- ['index'],
- 'method' => 'get',
- ]); ?>
-
- = $form->field($model, 'id') ?>
-
- = $form->field($model, 'cat_name') ?>
-
- = $form->field($model, 'icon') ?>
-
- = $form->field($model, 'icon_type') ?>
-
- = $form->field($model, 'description') ?>
-
- field($model, 'sort_order') ?>
-
- field($model, 'created_at') ?>
-
- field($model, 'updated_at') ?>
+ ['index'],
+ 'method' => 'get',
+ 'validateOnType' => true,
+ ]);
+?>
-
- = Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
- = Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
+
+
+ =
+ $form->field($model, 'id', [
+ "template" => "{input}{error}",
+ "inputOptions" => [
+ "placeholder" => "检索的id",
+ "class" => "form-control",
+ ],
+ "errorOptions" => [
+ "class" => "error-tips"
+ ]
+ ])
+ ?>
+
+ =
+ $form->field($model, 'cat_name', [
+ "template" => "{input}{error}",
+ "inputOptions" => [
+ "placeholder" => "检索类名",
+ "class" => "form-control",
+ ],
+ "errorOptions" => [
+ "class" => "error-tips"
+ ]
+ ])
+ ?>
-
-
-
+
+ = Html::submitButton(' ', ['class' => 'btn btn-default']) ?>
+ = Html::resetButton(' ', ['class' => 'btn btn-default']) ?>
+
+
+
diff --git a/kcadmin/views/category/index.php b/kcadmin/views/category/index.php
index 6db2deb..b24015f 100644
--- a/kcadmin/views/category/index.php
+++ b/kcadmin/views/category/index.php
@@ -12,31 +12,47 @@ use blobt\grid\GridView;
$this->title = 'Categories';
$this->params['breadcrumbs'][] = $this->title;
?>
-
$this->render("_search", ['model' => $searchModel]),
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id',
- 'label' => 'Id',
- "width" => "30px",
+ 'width' => '5%',
'align' => 'center'
],
+ [
+ 'attribute' => 'created_at',
+ 'width' => '7%',
+ 'format' => 'date'
+ ],
[
'attribute' => 'cat_name',
- 'label' => '类名'
+ 'width' => '13%',
+ ],
+ [
+ 'attribute' => 'icon',
+ 'width' => '5%',
+ ],
+ [
+ 'attribute' => 'icon_type',
+ 'width' => '7%',
+ 'showConstText' => true
+ ],
+ [
+ 'attribute' => 'description',
+ 'format' => 'ntext',
+ 'width' => '50%',
],
- 'icon',
- 'icon_type',
- 'description:ntext',
[
'class' => 'yii\grid\ActionColumn',
],
],
]);
+
?>
\ No newline at end of file
diff --git a/kcadmin/views/site/test.php b/kcadmin/views/site/test.php
index 1155a39..d75f18b 100644
--- a/kcadmin/views/site/test.php
+++ b/kcadmin/views/site/test.php
@@ -2,9 +2,67 @@
use yii\widgets\ActiveForm;
use yii\helpers\Html;
+use blobt\web\DaterangeBootstrap;
$this->title = '测试';
$this->params['subtitle'] = '这是一个小小的测试';
$this->params['breadcrumbs'][] = $this->title;
+
+$js = <<
registerJs($js);
?>
-= $name ?>
\ No newline at end of file
+
+
+
+ 日期范围
+
+
+
\ No newline at end of file
diff --git a/kcadmin/web/js/common.js b/kcadmin/web/js/common.js
new file mode 100644
index 0000000..ff74713
--- /dev/null
+++ b/kcadmin/web/js/common.js
@@ -0,0 +1,3 @@
+$(function(){
+ $("[data-toggle='tooltip']").tooltip();
+});
\ No newline at end of file