mice-tm/yii2-timeline-widget
最新稳定版本:1.1.4
Composer 安装命令:
composer require mice-tm/yii2-timeline-widget
包简介
A widget to render simple timeline
README 文档
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mice-tm/yii2-timeline-widget "*"
or add
"mice-tm/yii2-timeline-widget": "*"
to the require section of your composer.json file.
Usage
Timeline widget expects array of LogModel-like models (micetm\timeline\LogModel) in items-param.
Where title and body can contain macros strings in yii macros-format {here-is-macros}.
With eventIcons-param you can extend or reassign icons for actions.
class LogModel extends Model { public $action; public $title, public $body; public $log_date; public $macros; public $_id; public function rules() { return [ [['action', 'title'], 'required'], [['action', 'title', 'body'], 'string'], ['log_date', 'integer'], ['macros', 'safe'] ]; } public function attributes() { return [ '_id', 'action', 'title', 'body', 'macros', 'log_date', ]; } public function attributeLabels() { return [ '_id' => '#', 'action' => 'Action', 'macros' => 'Macros', 'title' => 'Title', 'body' => 'Body', 'log_date' => 'Date', ]; } }
Once the extension is installed, simply use it in your code by :
<?php use micetm\timeline\Timeline; /** * @var $dataProvider \yii\data\ActiveDataProvider */ echo Timeline::widget([ 'items' => $dataProvider->getModels(), 'eventIcons' => [ 'update' => 'fa fa-pencil bg-orange', 'add' => 'fa fa-pencil bg-orange', 'create' => 'glyphicon glyphicon-star bg-green', ] ]); ?>
统计信息
- 总下载量: 9.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-29