almeida/ui-kit-laravel

almeida/ui-kit 的 Laravel 驱动程序

0.1.0 2014-03-28 15:46 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:43:39 UTC


README

这只是为了让 UIKit 工作的一个 Laravel 驱动程序。

超级 alpha 版本。欢迎提出建议

通过 Composer 安装

将 UIKit 添加到您的 composer.json 文件中,以要求 UIKit

require : {
	"almeida/ui-kit-laravel" : "dev-master"
}

现在更新 Composer

composer update

最后一个 必需 步骤是将服务提供者添加到 app/config/app.php

	'Almeida\UIKitLaravel\UIKitLaravelServiceProvider',

现在 UIKit 应该可以在您的应用程序中使用。

您可以通过您习惯的 Laravel 组件的静态接口访问 UIKit。

	UIKit::header('Some heading');

待办事项

  • 编写如何使用
  • 示例
  • 编写测试

如何

表格

!! 危险区域 !!!

  • 可能很快会将分页从表格中分离出来

  • 可能直接从 UIKit::table($rows, $options) 渲染表格

	// 1.0 - Make sure data is transformed for output

		// Elquoent collection, Paginator
		$data;

		// Format data for presentation to give us...
		$rows = array(
			array(
				'id' => 1,
				'name' => 'John Doe',
				'gender' => 'Male',
			),
			array(
				'id' => 2,
				'name' => 'Jane Doe',
				'gender' => 'Female',
			),
		);

	// 2.0 - Configure how you want the table to behave
	$options = array(
		// @todo - What do we display when there is no data
		'behaviours' => array(
			'no-data' => array(
				'icon' => 'User',
				'message' => "No users found",
				'subtext' => array(
					'label' => 'Create a new User',
					'url' => '/admin/users/create'
				),
			)
		),
		// Add's a sort link <th><a>
		// match on keys
		'sort' => array(
			'name'   => 'name',
			'gender'    => 'gender',
		),
		// Pass in query manually for now.
		// Its a bit tricky to autodetect framework and use relevant env objects
		'query' => Request::query()
	);

	// 3.0 - Build the table
	$table = UIKit::table($rows, $options);

	// 4.0 -  Render the table
	echo $table->render();

	// 5.0 - (Optional) Print pagination
	$pagination = $table->pagination($data, $options);

表单

扩展 FormBuilder 以渲染 Twitter Bootstrap 输入和按钮
	'Almeida\UIKitLaravel\HtmlServiceProvider',

无需更改任何标记。以下所有项目都将使用正确的 bootstrap 标记渲染。

	{{ Form::text() }}
	{{ Form::checkbox() }}
	{{ Form::radio() }}
	{{ Form::submit() }}

突出显示您的按钮

	{{ Form::submit('Delete', ['feedback' => 'danger']) }}

多个复选框

	{{ Form::mutiple('roles', $list=[], $selected=[], $options=[]) }}