almeida/ui-kit-laravel

Laravel driver for almeida/ui-kit

0.1.0 2014-03-28 15:46 UTC

This package is not auto-updated.

Last update: 2024-11-05 03:29:53 UTC


README

Just a Laravel driver to get UIKit working.

Super alpha release. Suggestions welcome

Installation via Composer

Add UIKit to your composer.json file to require UIKit

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

Now update Composer

composer update

The last required step is to add the service provider to app/config/app.php

	'Almeida\UIKitLaravel\UIKitLaravelServiceProvider',

UIKit should now be avaliable in your application.

You can access the UIKit through the static interface you are used to with Laravel components.

	UIKit::header('Some heading');

Todo

  • Write up how to
  • Examples
  • Write tests

How to :

Tables

!! Dangerzone !!!

  • Probably going to seperate Pagination from Tables soon

  • Probably going to render the table directly from 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);

Forms

Extend the FormBuilder to render Twitter Bootstrap inputs and buttons
	'Almeida\UIKitLaravel\HtmlServiceProvider',

No need to change any markup. The items below will all render with the correct bootstrap markup.

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

Add emphasis to your buttons

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

Multiple checkboxes

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