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 */ ?> -