flame/navbarbuilder-component

Nette Framework component for simple building of navigation (used TwitterBootstrap)

dev-master 2013-02-28 22:14 UTC

This package is not auto-updated.

Last update: 2024-10-26 13:32:50 UTC


README

#NavbarBuilder-Component Build Status

About

Nette Framework component for simple building of navigation (used TwitterBootstrap)

Installation

Preferred way of installation is using Composer. Add the following dependency to your composer.json file and you're ready to go.

{
	"require": {
		"flame/navbarbuilder-component": "@dev"
	}
}

Usage

###In config.neon

factories:
	navbarBuilderControl:
        implement: \Flame\Components\NavbarBuilder\INavbarBuilderControlFactory
	...

###In base presenter

	/**
	 * @autowire
	 * @var \Flame\Components\NavbarBuilder\INavbarBuilderControlFactory
	 */
	protected $navbarBuilderControlFactory;

	/**
	 * @return \Flame\Components\NavbarBuilder\NavbarBuilderControl
	 */
	protected function createComponentNavbarBuilder()
	{
		$control = $this->navbarBuilderControlFactory->create();
		$control->setTitle('Dashboard', 'Dashboard:');

		$navbar = $control->getNavbarControl();
		$navbar->addItem('Posts', 'Post:');
		$navbar->addItem('List', 'Post:', 'Posts');
		$navbar->addItem('Import', 'Import:', 'Posts', true);
		$navbar->addItem('Comments', 'Comment:', 'Posts');

		$navbar->addItem('Newsreel', 'Newsreel:');
		$navbar->addItem('Images', 'Image:');

		$userbar = $control->getUserbarControl();
		$userbar->addItem('Account settings', 'User:edit');
		$userbar->addItem('Password edit', 'User:password');
		$userbar->setUserName($this->getUser()->getIdentity());

		return $control;
	}

###In template (e.g. @layout.latte)

{control navbarBuilder}